1 /*******************************************************************************
2 * Copyright (c) 2000, 2003 IBM Corporation and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Common Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/cpl-v10.html
9 * IBM Corporation - initial API and implementation
10 *******************************************************************************/
11 package net.sourceforge.phpdt.ui;
13 import net.sourceforge.phpdt.core.IBufferFactory;
14 import net.sourceforge.phpdt.core.IJavaElement;
15 import net.sourceforge.phpdt.core.IWorkingCopy;
16 import net.sourceforge.phpdt.core.JavaModelException;
17 import net.sourceforge.phpdt.core.JavaCore;
18 import net.sourceforge.phpeclipse.PHPeclipsePlugin;
19 import net.sourceforge.phpeclipse.phpeditor.EditorUtility;
20 import net.sourceforge.phpeclipse.phpeditor.PHPDocumentProvider;
22 import org.eclipse.ui.IEditorPart;
23 import org.eclipse.ui.ISharedImages;
24 import org.eclipse.ui.PartInitException;
25 import org.eclipse.ui.internal.SharedImages;
26 import org.eclipse.ui.texteditor.IDocumentProvider;
29 * Central access point for the Java UI plug-in (id <code>"org.eclipse.jdt.ui"</code>).
30 * This class provides static methods for:
32 * <li> creating various kinds of selection dialogs to present a collection
33 * of Java elements to the user and let them make a selection.</li>
34 * <li> opening a Java editor on a compilation unit.</li>
37 * This class provides static methods and fields only; it is not intended to be
38 * instantiated or subclassed by clients.
41 public final class JavaUI {
43 private static ISharedImages fgSharedImages= null;
46 // prevent instantiation of JavaUI.
50 * The id of the Java plugin (value <code>"org.eclipse.jdt.ui"</code>).
52 // public static final String ID_PLUGIN= "org.eclipse.jdt.ui"; //$NON-NLS-1$
55 * The id of the Java perspective
56 * (value <code>"org.eclipse.jdt.ui.JavaPerspective"</code>).
58 // public static final String ID_PERSPECTIVE= "org.eclipse.jdt.ui.JavaPerspective"; //$NON-NLS-1$
61 * The id of the Java hierarchy perspective
62 * (value <code>"org.eclipse.jdt.ui.JavaHierarchyPerspective"</code>).
64 // public static final String ID_HIERARCHYPERSPECTIVE= "org.eclipse.jdt.ui.JavaHierarchyPerspective"; //$NON-NLS-1$
67 * The id of the Java action set
68 * (value <code>"org.eclipse.jdt.ui.JavaActionSet"</code>).
70 // public static final String ID_ACTION_SET= "org.eclipse.jdt.ui.JavaActionSet"; //$NON-NLS-1$
73 * The id of the Java Element Creation action set
74 * (value <code>"org.eclipse.jdt.ui.JavaElementCreationActionSet"</code>).
78 // public static final String ID_ELEMENT_CREATION_ACTION_SET= "org.eclipse.jdt.ui.JavaElementCreationActionSet"; //$NON-NLS-1$
81 * The id of the Java Coding action set
82 * (value <code>"org.eclipse.jdt.ui.CodingActionSet"</code>).
86 // public static final String ID_CODING_ACTION_SET= "org.eclipse.jdt.ui.CodingActionSet"; //$NON-NLS-1$
89 * The id of the Java action set for open actions
90 * (value <code>"org.eclipse.jdt.ui.A_OpenActionSet"</code>).
94 // public static final String ID_OPEN_ACTION_SET= "org.eclipse.jdt.ui.A_OpenActionSet"; //$NON-NLS-1$
97 * The id of the Java Search action set
98 * (value <code>org.eclipse.jdt.ui.SearchActionSet"</code>).
102 // public static final String ID_SEARCH_ACTION_SET= "org.eclipse.jdt.ui.SearchActionSet"; //$NON-NLS-1$
105 * The editor part id of the editor that presents Java compilation units
106 * (value <code>"org.eclipse.jdt.ui.CompilationUnitEditor"</code>).
108 // public static final String ID_CU_EDITOR= "net.sourceforge.phpdt.ui.PHPUnitEditor"; //$NON-NLS-1$
111 * The editor part id of the editor that presents Java binary class files
112 * (value <code>"org.eclipse.jdt.ui.ClassFileEditor"</code>).
114 // public static final String ID_CF_EDITOR= "org.eclipse.jdt.ui.ClassFileEditor"; //$NON-NLS-1$
117 * The editor part id of the code snippet editor
118 * (value <code>"org.eclipse.jdt.ui.SnippetEditor"</code>).
120 // public static final String ID_SNIPPET_EDITOR= "org.eclipse.jdt.ui.SnippetEditor"; //$NON-NLS-1$
123 * The view part id of the Packages view
124 * (value <code>"org.eclipse.jdt.ui.PackageExplorer"</code>).
126 * When this id is used to access
127 * a view part with <code>IWorkbenchPage.findView</code> or
128 * <code>showView</code>, the returned <code>IViewPart</code>
129 * can be safely cast to an <code>IPackagesViewPart</code>.
132 * @see IPackagesViewPart
133 * @see org.eclipse.ui.IWorkbenchPage#findView(java.lang.String)
134 * @see org.eclipse.ui.IWorkbenchPage#showView(java.lang.String)
136 public static final String ID_PACKAGES= "net.sourceforge.phpdt.ui.PackageExplorer"; //$NON-NLS-1$
139 * The view part id of the type hierarchy part.
140 * (value <code>"org.eclipse.jdt.ui.TypeHierarchy"</code>).
142 * When this id is used to access
143 * a view part with <code>IWorkbenchPage.findView</code> or
144 * <code>showView</code>, the returned <code>IViewPart</code>
145 * can be safely cast to an <code>ITypeHierarchyViewPart</code>.
148 * @see ITypeHierarchyViewPart
149 * @see org.eclipse.ui.IWorkbenchPage#findView(java.lang.String)
150 * @see org.eclipse.ui.IWorkbenchPage#showView(java.lang.String)
152 // public static final String ID_TYPE_HIERARCHY= "org.eclipse.jdt.ui.TypeHierarchy"; //$NON-NLS-1$
155 * The id of the Java Browsing Perspective
156 * (value <code>"org.eclipse.jdt.ui.JavaBrowsingPerspective"</code>).
160 // public static String ID_BROWSING_PERSPECTIVE= "org.eclipse.jdt.ui.JavaBrowsingPerspective"; //$NON-NLS-1$
163 * The view part id of the Java Browsing Projects view
164 * (value <code>"org.eclipse.jdt.ui.ProjectsView"</code>).
168 // public static String ID_PROJECTS_VIEW= "org.eclipse.jdt.ui.ProjectsView"; //$NON-NLS-1$
171 * The view part id of the Java Browsing Packages view
172 * (value <code>"org.eclipse.jdt.ui.PackagesView"</code>).
176 // public static String ID_PACKAGES_VIEW= "org.eclipse.jdt.ui.PackagesView"; //$NON-NLS-1$
179 * The view part id of the Java Browsing Types view
180 * (value <code>"org.eclipse.jdt.ui.TypesView"</code>).
184 // public static String ID_TYPES_VIEW= "org.eclipse.jdt.ui.TypesView"; //$NON-NLS-1$
187 * The view part id of the Java Browsing Members view
188 * (value <code>"org.eclipse.jdt.ui.MembersView"</code>).
192 // public static String ID_MEMBERS_VIEW= "org.eclipse.jdt.ui.MembersView"; //$NON-NLS-1$
195 * The class org.eclipse.debug.core.model.IProcess allows attaching
196 * String properties to processes. The Java UI contributes a property
197 * page for IProcess that will show the contents of the property
199 * The intent of this property is to show the command line a process
203 // public final static String ATTR_CMDLINE= "org.eclipse.jdt.ui.launcher.cmdLine"; //$NON-NLS-1$
206 * Returns the shared images for the Java UI.
208 * @return the shared images manager
210 public static ISharedImages getSharedImages() {
211 if (fgSharedImages == null)
212 fgSharedImages= new SharedImages();
214 return fgSharedImages;
218 * Creates a selection dialog that lists all packages of the given Java project.
219 * The caller is responsible for opening the dialog with <code>Window.open</code>,
220 * and subsequently extracting the selected package (of type
221 * <code>IPackageFragment</code>) via <code>SelectionDialog.getResult</code>.
223 * @param parent the parent shell of the dialog to be created
224 * @param project the Java project
225 * @param style flags defining the style of the dialog; the valid flags are:
226 * <code>IJavaElementSearchConstants.CONSIDER_BINARIES</code>, indicating that
227 * packages from binary package fragment roots should be included in addition
228 * to those from source package fragment roots;
229 * <code>IJavaElementSearchConstants.CONSIDER_REQUIRED_PROJECTS</code>, indicating that
230 * packages from required projects should be included as well.
231 * @param filter the initial pattern to filter the set of packages. For example "com" shows
232 * all packages starting with "com". The meta character '?' representing any character and
233 * '*' representing any string are supported. Clients can pass an empty string if no filtering
235 * @return a new selection dialog
236 * @exception JavaModelException if the selection dialog could not be opened
240 // public static SelectionDialog createPackageDialog(Shell parent, IJavaProject project, int style, String filter) throws JavaModelException {
241 // Assert.isTrue((style | IJavaElementSearchConstants.CONSIDER_BINARIES | IJavaElementSearchConstants.CONSIDER_REQUIRED_PROJECTS) ==
242 // (IJavaElementSearchConstants.CONSIDER_BINARIES | IJavaElementSearchConstants.CONSIDER_REQUIRED_PROJECTS));
244 // IPackageFragmentRoot[] roots= null;
245 // if ((style & IJavaElementSearchConstants.CONSIDER_REQUIRED_PROJECTS) != 0) {
246 // roots= project.getAllPackageFragmentRoots();
248 // roots= project.getPackageFragmentRoots();
251 // List consideredRoots= null;
252 // if ((style & IJavaElementSearchConstants.CONSIDER_BINARIES) != 0) {
253 // consideredRoots= Arrays.asList(roots);
255 // consideredRoots= new ArrayList(roots.length);
256 // for (int i= 0; i < roots.length; i++) {
257 // IPackageFragmentRoot root= roots[i];
258 // if (root.getKind() != IPackageFragmentRoot.K_BINARY)
259 // consideredRoots.add(root);
264 // int flags= JavaElementLabelProvider.SHOW_DEFAULT;
265 // if (consideredRoots.size() > 1)
266 // flags= flags | JavaElementLabelProvider.SHOW_ROOT;
268 // List packages= new ArrayList();
269 // Iterator iter= consideredRoots.iterator();
270 // while(iter.hasNext()) {
271 // IPackageFragmentRoot root= (IPackageFragmentRoot)iter.next();
272 // packages.addAll(Arrays.asList(root.getChildren()));
274 // ElementListSelectionDialog dialog= new ElementListSelectionDialog(parent, new JavaElementLabelProvider(flags));
275 // dialog.setIgnoreCase(false);
276 // dialog.setElements(packages.toArray()); // XXX inefficient
277 // dialog.setFilter(filter);
282 * Creates a selection dialog that lists all packages of the given Java project.
283 * The caller is responsible for opening the dialog with <code>Window.open</code>,
284 * and subsequently extracting the selected package (of type
285 * <code>IPackageFragment</code>) via <code>SelectionDialog.getResult</code>.
287 * @param parent the parent shell of the dialog to be created
288 * @param project the Java project
289 * @param style flags defining the style of the dialog; the valid flags are:
290 * <code>IJavaElementSearchConstants.CONSIDER_BINARIES</code>, indicating that
291 * packages from binary package fragment roots should be included in addition
292 * to those from source package fragment roots;
293 * <code>IJavaElementSearchConstants.CONSIDER_REQUIRED_PROJECTS</code>, indicating that
294 * packages from required projects should be included as well.
295 * @return a new selection dialog
296 * @exception JavaModelException if the selection dialog could not be opened
298 // public static SelectionDialog createPackageDialog(Shell parent, IJavaProject project, int style) throws JavaModelException {
299 // return createPackageDialog(parent, project, style, ""); //$NON-NLS-1$
303 * Creates a selection dialog that lists all packages under the given package
305 * The caller is responsible for opening the dialog with <code>Window.open</code>,
306 * and subsequently extracting the selected package (of type
307 * <code>IPackageFragment</code>) via <code>SelectionDialog.getResult</code>.
309 * @param parent the parent shell of the dialog to be created
310 * @param root the package fragment root
311 * @param filter the initial pattern to filter the set of packages. For example "com" shows
312 * all packages starting with "com". The meta character '?' representing any character and
313 * '*' representing any string are supported. Clients can pass an empty string if no filtering
315 * @return a new selection dialog
316 * @exception JavaModelException if the selection dialog could not be opened
320 // public static SelectionDialog createPackageDialog(Shell parent, IPackageFragmentRoot root, String filter) throws JavaModelException {
321 // ElementListSelectionDialog dialog= new ElementListSelectionDialog(parent, new JavaElementLabelProvider(JavaElementLabelProvider.SHOW_DEFAULT));
322 // dialog.setIgnoreCase(false);
323 // dialog.setElements(root.getChildren());
324 // dialog.setFilter(filter);
329 * Creates a selection dialog that lists all packages under the given package
331 * The caller is responsible for opening the dialog with <code>Window.open</code>,
332 * and subsequently extracting the selected package (of type
333 * <code>IPackageFragment</code>) via <code>SelectionDialog.getResult</code>.
335 * @param parent the parent shell of the dialog to be created
336 * @param root the package fragment root
337 * @return a new selection dialog
338 * @exception JavaModelException if the selection dialog could not be opened
340 // public static SelectionDialog createPackageDialog(Shell parent, IPackageFragmentRoot root) throws JavaModelException {
341 // return createPackageDialog(parent, root, ""); //$NON-NLS-1$
345 * Creates a selection dialog that lists all types in the given scope.
346 * The caller is responsible for opening the dialog with <code>Window.open</code>,
347 * and subsequently extracting the selected type(s) (of type
348 * <code>IType</code>) via <code>SelectionDialog.getResult</code>.
350 * @param parent the parent shell of the dialog to be created
351 * @param context the runnable context used to show progress when the dialog
353 * @param scope the scope that limits which types are included
354 * @param style flags defining the style of the dialog; the only valid values are
355 * <code>IJavaElementSearchConstants.CONSIDER_CLASSES</code>,
356 * <code>CONSIDER_INTERFACES</code>, or their bitwise OR
357 * (equivalent to <code>CONSIDER_TYPES</code>)
358 * @param multipleSelection <code>true</code> if multiple selection is allowed
359 * @param filter the initial pattern to filter the set of types. For example "Abstract" shows
360 * all types starting with "abstract". The meta character '?' representing any character and
361 * '*' representing any string are supported. Clients can pass an empty string if no filtering
363 * @exception JavaModelException if the selection dialog could not be opened
367 // public static SelectionDialog createTypeDialog(Shell parent, IRunnableContext context, IJavaSearchScope scope, int style, boolean multipleSelection, String filter) throws JavaModelException {
368 // int elementKinds= 0;
369 // if (style == IJavaElementSearchConstants.CONSIDER_TYPES) {
370 // elementKinds= IJavaSearchConstants.TYPE;
371 // } else if (style == IJavaElementSearchConstants.CONSIDER_INTERFACES) {
372 // elementKinds= IJavaSearchConstants.INTERFACE;
373 // } else if (style == IJavaElementSearchConstants.CONSIDER_CLASSES) {
374 // elementKinds= IJavaSearchConstants.CLASS;
376 // Assert.isTrue(false, "illegal style"); //$NON-NLS-1$
378 // if (multipleSelection) {
379 // MultiTypeSelectionDialog dialog= new MultiTypeSelectionDialog(parent, context, elementKinds, scope);
380 // dialog.setMessage(JavaUIMessages.getString("JavaUI.defaultDialogMessage")); //$NON-NLS-1$
381 // dialog.setFilter(filter);
384 // TypeSelectionDialog dialog= new TypeSelectionDialog(parent, context, elementKinds, scope);
385 // dialog.setMessage(JavaUIMessages.getString("JavaUI.defaultDialogMessage")); //$NON-NLS-1$
386 // dialog.setFilter(filter);
392 * Creates a selection dialog that lists all types in the given scope.
393 * The caller is responsible for opening the dialog with <code>Window.open</code>,
394 * and subsequently extracting the selected type(s) (of type
395 * <code>IType</code>) via <code>SelectionDialog.getResult</code>.
397 * @param parent the parent shell of the dialog to be created
398 * @param context the runnable context used to show progress when the dialog
400 * @param scope the scope that limits which types are included
401 * @param style flags defining the style of the dialog; the only valid values are
402 * <code>IJavaElementSearchConstants.CONSIDER_CLASSES</code>,
403 * <code>CONSIDER_INTERFACES</code>, or their bitwise OR
404 * (equivalent to <code>CONSIDER_TYPES</code>)
405 * @param multipleSelection <code>true</code> if multiple selection is allowed
406 * @return a new selection dialog
407 * @exception JavaModelException if the selection dialog could not be opened
409 // public static SelectionDialog createTypeDialog(Shell parent, IRunnableContext context, IJavaSearchScope scope, int style, boolean multipleSelection) throws JavaModelException {
410 // return createTypeDialog(parent, context, scope, style, multipleSelection, "");//$NON-NLS-1$
414 * Creates a selection dialog that lists all types in the given scope containing
415 * a standard <code>main</code> method.
416 * The caller is responsible for opening the dialog with <code>Window.open</code>,
417 * and subsequently extracting the selected type(s) (of type
418 * <code>IType</code>) via <code>SelectionDialog.getResult</code>.
420 * @param parent the parent shell of the dialog to be created
421 * @param context the runnable context used to show progress when the dialog
423 * @param scope the scope that limits which types are included
424 * @param style flags defining the style of the dialog; the only valid values are
425 * <code>IJavaElementSearchConstants.CONSIDER_BINARIES</code>,
426 * <code>CONSIDER_EXTERNAL_JARS</code>, or their bitwise OR, or <code>0</code>
427 * @param multipleSelection <code>true</code> if multiple selection is allowed
428 * @param filter the initial pattern to filter the set of types containg a main method. For
429 * example "App" shows all types starting with "app". The meta character '?' representing
430 * any character and '*' representing any string are supported. Clients can pass an empty
431 * string if no filtering is required.
432 * @return a new selection dialog
436 // public static SelectionDialog createMainTypeDialog(Shell parent, IRunnableContext context, IJavaSearchScope scope, int style, boolean multipleSelection, String filter) {
437 // if (multipleSelection) {
438 // MultiMainTypeSelectionDialog dialog= new MultiMainTypeSelectionDialog(parent, context, scope, style);
439 // dialog.setFilter(filter);
442 // MainTypeSelectionDialog dialog= new MainTypeSelectionDialog(parent, context, scope, style);
443 // dialog.setFilter(filter);
449 * Creates a selection dialog that lists all types in the given scope containing
450 * a standard <code>main</code> method.
451 * The caller is responsible for opening the dialog with <code>Window.open</code>,
452 * and subsequently extracting the selected type(s) (of type
453 * <code>IType</code>) via <code>SelectionDialog.getResult</code>.
455 * @param parent the parent shell of the dialog to be created
456 * @param context the runnable context used to show progress when the dialog
458 * @param scope the scope that limits which types are included
459 * @param style flags defining the style of the dialog; the only valid values are
460 * <code>IJavaElementSearchConstants.CONSIDER_BINARIES</code>,
461 * <code>CONSIDER_EXTERNAL_JARS</code>, or their bitwise OR, or <code>0</code>
462 * @param multipleSelection <code>true</code> if multiple selection is allowed
463 * @return a new selection dialog
465 // public static SelectionDialog createMainTypeDialog(Shell parent, IRunnableContext context, IJavaSearchScope scope, int style, boolean multipleSelection) {
466 // return createMainTypeDialog(parent, context, scope, style, multipleSelection, "");//$NON-NLS-1$
470 * Creates a selection dialog that lists all types in the given project.
471 * The caller is responsible for opening the dialog with <code>Window.open</code>,
472 * and subsequently extracting the selected type(s) (of type
473 * <code>IType</code>) via <code>SelectionDialog.getResult</code>.
475 * @param parent the parent shell of the dialog to be created
476 * @param context the runnable context used to show progress when the dialog
478 * @param project the Java project
479 * @param style flags defining the style of the dialog; the only valid values are
480 * <code>IJavaElementSearchConstants.CONSIDER_CLASSES</code>,
481 * <code>CONSIDER_INTERFACES</code>, or their bitwise OR
482 * (equivalent to <code>CONSIDER_TYPES</code>)
483 * @param multipleSelection <code>true</code> if multiple selection is allowed
484 * @return a new selection dialog
485 * @exception JavaModelException if the selection dialog could not be opened
487 // public static SelectionDialog createTypeDialog(Shell parent, IRunnableContext context, IProject project, int style, boolean multipleSelection) throws JavaModelException {
488 // IJavaSearchScope scope= SearchEngine.createJavaSearchScope(new IJavaProject[] { JavaCore.create(project) });
489 // return createTypeDialog(parent, context, scope, style, multipleSelection);
493 * Opens a Java editor on the given Java element. The element can be a compilation unit
494 * or class file. If there already is an open Java editor for the given element, it is returned.
496 * @param element the input element; either a compilation unit
497 * (<code>ICompilationUnit</code>) or a class file (</code>IClassFile</code>)
498 * @return the editor, or </code>null</code> if wrong element type or opening failed
499 * @exception PartInitException if the editor could not be initialized
500 * @exception JavaModelException if this element does not exist or if an
501 * exception occurs while accessing its underlying resource
503 public static IEditorPart openInEditor(IJavaElement element) throws JavaModelException, PartInitException {
504 return EditorUtility.openInEditor(element);
508 * Reveals the source range of the given source reference element in the
509 * given editor. No checking is done if the editor displays a compilation unit or
510 * class file that contains the given source reference. The editor simply reveals
511 * the source range denoted by the given source reference.
513 * @param part the editor displaying the compilation unit or class file
514 * @param element the source reference element defining the source range to be revealed
516 * @deprecated use <code>revealInEditor(IEditorPart, IJavaElement)</code> instead
518 // public static void revealInEditor(IEditorPart part, ISourceReference element) {
519 // if (element instanceof IJavaElement)
520 // revealInEditor(part, (IJavaElement) element);
524 * Reveals the given java element in the given editor. If the element is not an instance
525 * of <code>ISourceReference</code> this method result in a NOP. If it is a source
526 * reference no checking is done if the editor displays a compilation unit or class file that
527 * contains the source reference element. The editor simply reveals the source range
528 * denoted by the given element.
530 * @param part the editor displaying a compilation unit or class file
531 * @param element the element to be revealed
535 // public static void revealInEditor(IEditorPart part, IJavaElement element) {
536 // EditorUtility.revealInEditor(part, element);
540 * Returns the working copy manager for the Java UI plug-in.
542 * @return the working copy manager for the Java UI plug-in
544 public static IWorkingCopyManager getWorkingCopyManager() {
545 return PHPeclipsePlugin.getDefault().getWorkingCopyManager();
549 * Answers the shared working copies currently registered for the Java plug-in.
550 * Note that the returned array can include working copies that are
551 * not on the class path of a Java project.
553 * @return the list of shared working copies
555 * @see org.eclipse.jdt.core.JavaCore#getSharedWorkingCopies(org.eclipse.jdt.core.IBufferFactory)
558 public static IWorkingCopy[] getSharedWorkingCopies() {
559 return JavaCore.getSharedWorkingCopies(getBufferFactory());
563 * Answers the shared working copies that are on the class path of a Java
564 * project currently registered for the Java plug-in.
567 * @return the list of shared working copies
569 * @see #getSharedWorkingCopies()
572 // public static IWorkingCopy[] getSharedWorkingCopiesOnClasspath() {
573 // IWorkingCopy[] wcs= getSharedWorkingCopies();
574 // List result= new ArrayList(wcs.length);
575 // for (int i = 0; i < wcs.length; i++) {
576 // IWorkingCopy wc= wcs[i];
577 // if (wc instanceof IJavaElement) {
578 // IJavaElement je= (IJavaElement)wc;
579 // if (je.getJavaProject().isOnClasspath(je)) {
584 // return (IWorkingCopy[])result.toArray(new IWorkingCopy[result.size()]);
588 * Returns the BufferFactory for the Java UI plug-in.
590 * @return the BufferFactory for the Java UI plug-in
592 * @see org.eclipse.jdt.core.IBufferFactory
595 public static IBufferFactory getBufferFactory() {
596 PHPDocumentProvider provider= PHPeclipsePlugin.getDefault().getCompilationUnitDocumentProvider();
597 if (provider != null)
598 return provider.getBufferFactory();
603 * Returns the DocumentProvider used for Java compilation units.
605 * @return the DocumentProvider for Java compilation units.
607 * @see IDocumentProvider
610 public static IDocumentProvider getDocumentProvider() {
611 return PHPeclipsePlugin.getDefault().getCompilationUnitDocumentProvider();
615 * Sets the Javadoc location for an archive with the given path.
617 * @param archivePath the path of the library; this can be an workspace path
618 * or an external path in case of an external library.
619 * @param url The Javadoc location to set. This location should contain index.html and
620 * a file 'package-list'. <code>null</code> clears the current documentation
625 // public static void setLibraryJavadocLocation(IPath archivePath, URL url) {
626 // JavaDocLocations.setLibraryJavadocLocation(archivePath, url);
630 * Returns the Javadoc location for an archive or <code>null</code> if no
631 * location is available.
633 * @param archivePath the path of the library. This can be an workspace path
634 * or an external path in case of an external library.
638 // public static URL getLibraryJavadocLocation(IPath archivePath) {
639 // return JavaDocLocations.getLibraryJavadocLocation(archivePath);
643 * Sets the Javadoc location for a Java project. This location is used for
644 * all types located in the project's source folders.
646 * @param project the project
647 * @param url The Javadoc location to set. This location should contain index.html and
648 * a file 'package-list'. <code>null</code> clears the current documentation
653 // public static void setProjectJavadocLocation(IJavaProject project, URL url) {
654 // JavaDocLocations.setProjectJavadocLocation(project, url);
658 * Returns the Javadoc location for a Java project or <code>null</code> if no
659 * location is available. This location is used for all types located in the project's
662 * @param project the project
666 // public static URL getProjectJavadocLocation(IJavaProject project) {
667 // return JavaDocLocations.getProjectJavadocLocation(project);
671 * Returns the Javadoc base URL for an element. The base location contains the
672 * index file. This location doesn't have to exist. Returns
673 * <code>null</code> if no javadoc location has been attached to the
674 * element's library or project. Example of a returned URL is <i>http://www.
675 * junit. org/junit/javadoc</i>.
677 * @param The element for which the doc URL is requested.
681 // public static URL getJavadocBaseLocation(IJavaElement element) throws JavaModelException {
682 // return JavaDocLocations.getJavadocBaseLocation(element);
686 * Returns the Javadoc URL for an element. Example of a returned URL is
687 * <i>http://www.junit.org/junit/javadoc/junit/extensions/TestSetup.html</i>.
688 * This returned location doesn't have to exist. Returns <code>null</code>
689 * if no javadoc location has been attached to the element's library or
692 * @param The element for which the doc URL is requested.
693 * @param includeAnchor If set, the URL contains an anchor for member references:
694 * <i>http://www.junit.org/junit/javadoc/junit/extensions/TestSetup.html#run(junit.framework.TestResult)</i>. Note
695 * that this involves type resolving and is a more expensive call than without anchor.
699 // public static URL getJavadocLocation(IJavaElement element, boolean includeAnchor) throws JavaModelException {
700 // return JavaDocLocations.getJavadocLocation(element, includeAnchor);