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;
21 import org.eclipse.ui.IEditorPart;
22 import org.eclipse.ui.ISharedImages;
23 import org.eclipse.ui.PartInitException;
24 import org.eclipse.ui.internal.SharedImages;
25 import org.eclipse.ui.texteditor.IDocumentProvider;
28 * Central access point for the Java UI plug-in (id <code>"org.eclipse.jdt.ui"</code>).
29 * This class provides static methods for:
31 * <li> creating various kinds of selection dialogs to present a collection
32 * of Java elements to the user and let them make a selection.</li>
33 * <li> opening a Java editor on a compilation unit.</li>
36 * This class provides static methods and fields only; it is not intended to be
37 * instantiated or subclassed by clients.
40 public final class JavaUI {
42 private static ISharedImages fgSharedImages= null;
45 // prevent instantiation of JavaUI.
49 * The id of the Java plugin (value <code>"org.eclipse.jdt.ui"</code>).
51 // public static final String ID_PLUGIN= "org.eclipse.jdt.ui"; //$NON-NLS-1$
54 * The id of the Java perspective
55 * (value <code>"org.eclipse.jdt.ui.JavaPerspective"</code>).
57 // public static final String ID_PERSPECTIVE= "org.eclipse.jdt.ui.JavaPerspective"; //$NON-NLS-1$
60 * The id of the Java hierarchy perspective
61 * (value <code>"org.eclipse.jdt.ui.JavaHierarchyPerspective"</code>).
63 // public static final String ID_HIERARCHYPERSPECTIVE= "org.eclipse.jdt.ui.JavaHierarchyPerspective"; //$NON-NLS-1$
66 * The id of the Java action set
67 * (value <code>"org.eclipse.jdt.ui.JavaActionSet"</code>).
69 // public static final String ID_ACTION_SET= "org.eclipse.jdt.ui.JavaActionSet"; //$NON-NLS-1$
72 * The id of the Java Element Creation action set
73 * (value <code>"org.eclipse.jdt.ui.JavaElementCreationActionSet"</code>).
77 // public static final String ID_ELEMENT_CREATION_ACTION_SET= "org.eclipse.jdt.ui.JavaElementCreationActionSet"; //$NON-NLS-1$
80 * The id of the Java Coding action set
81 * (value <code>"org.eclipse.jdt.ui.CodingActionSet"</code>).
85 // public static final String ID_CODING_ACTION_SET= "org.eclipse.jdt.ui.CodingActionSet"; //$NON-NLS-1$
88 * The id of the Java action set for open actions
89 * (value <code>"org.eclipse.jdt.ui.A_OpenActionSet"</code>).
93 // public static final String ID_OPEN_ACTION_SET= "org.eclipse.jdt.ui.A_OpenActionSet"; //$NON-NLS-1$
96 * The id of the Java Search action set
97 * (value <code>org.eclipse.jdt.ui.SearchActionSet"</code>).
101 // public static final String ID_SEARCH_ACTION_SET= "org.eclipse.jdt.ui.SearchActionSet"; //$NON-NLS-1$
104 * The editor part id of the editor that presents Java compilation units
105 * (value <code>"org.eclipse.jdt.ui.CompilationUnitEditor"</code>).
107 // public static final String ID_CU_EDITOR= "net.sourceforge.phpdt.ui.PHPUnitEditor"; //$NON-NLS-1$
110 * The editor part id of the editor that presents Java binary class files
111 * (value <code>"org.eclipse.jdt.ui.ClassFileEditor"</code>).
113 // public static final String ID_CF_EDITOR= "org.eclipse.jdt.ui.ClassFileEditor"; //$NON-NLS-1$
116 * The editor part id of the code snippet editor
117 * (value <code>"org.eclipse.jdt.ui.SnippetEditor"</code>).
119 // public static final String ID_SNIPPET_EDITOR= "org.eclipse.jdt.ui.SnippetEditor"; //$NON-NLS-1$
122 * The view part id of the Packages view
123 * (value <code>"org.eclipse.jdt.ui.PackageExplorer"</code>).
125 * When this id is used to access
126 * a view part with <code>IWorkbenchPage.findView</code> or
127 * <code>showView</code>, the returned <code>IViewPart</code>
128 * can be safely cast to an <code>IPackagesViewPart</code>.
131 * @see IPackagesViewPart
132 * @see org.eclipse.ui.IWorkbenchPage#findView(java.lang.String)
133 * @see org.eclipse.ui.IWorkbenchPage#showView(java.lang.String)
135 public static final String ID_PACKAGES= "net.sourceforge.phpdt.ui.PackageExplorer"; //$NON-NLS-1$
138 * The view part id of the type hierarchy part.
139 * (value <code>"org.eclipse.jdt.ui.TypeHierarchy"</code>).
141 * When this id is used to access
142 * a view part with <code>IWorkbenchPage.findView</code> or
143 * <code>showView</code>, the returned <code>IViewPart</code>
144 * can be safely cast to an <code>ITypeHierarchyViewPart</code>.
147 * @see ITypeHierarchyViewPart
148 * @see org.eclipse.ui.IWorkbenchPage#findView(java.lang.String)
149 * @see org.eclipse.ui.IWorkbenchPage#showView(java.lang.String)
151 public static final String ID_TYPE_HIERARCHY= "net.sourceforge.phpdt.ui.TypeHierarchy"; //$NON-NLS-1$
154 * The id of the Java Browsing Perspective
155 * (value <code>"org.eclipse.jdt.ui.JavaBrowsingPerspective"</code>).
159 // public static String ID_BROWSING_PERSPECTIVE= "org.eclipse.jdt.ui.JavaBrowsingPerspective"; //$NON-NLS-1$
162 * The view part id of the Java Browsing Projects view
163 * (value <code>"org.eclipse.jdt.ui.ProjectsView"</code>).
167 // public static String ID_PROJECTS_VIEW= "org.eclipse.jdt.ui.ProjectsView"; //$NON-NLS-1$
170 * The view part id of the Java Browsing Packages view
171 * (value <code>"org.eclipse.jdt.ui.PackagesView"</code>).
175 // public static String ID_PACKAGES_VIEW= "org.eclipse.jdt.ui.PackagesView"; //$NON-NLS-1$
178 * The view part id of the Java Browsing Types view
179 * (value <code>"org.eclipse.jdt.ui.TypesView"</code>).
183 // public static String ID_TYPES_VIEW= "org.eclipse.jdt.ui.TypesView"; //$NON-NLS-1$
186 * The view part id of the Java Browsing Members view
187 * (value <code>"org.eclipse.jdt.ui.MembersView"</code>).
191 // public static String ID_MEMBERS_VIEW= "org.eclipse.jdt.ui.MembersView"; //$NON-NLS-1$
194 * The class org.eclipse.debug.core.model.IProcess allows attaching
195 * String properties to processes. The Java UI contributes a property
196 * page for IProcess that will show the contents of the property
198 * The intent of this property is to show the command line a process
202 // public final static String ATTR_CMDLINE= "org.eclipse.jdt.ui.launcher.cmdLine"; //$NON-NLS-1$
205 * Returns the shared images for the Java UI.
207 * @return the shared images manager
209 public static ISharedImages getSharedImages() {
210 if (fgSharedImages == null)
211 fgSharedImages= new SharedImages();
213 return fgSharedImages;
217 * Creates a selection dialog that lists all packages of the given Java project.
218 * The caller is responsible for opening the dialog with <code>Window.open</code>,
219 * and subsequently extracting the selected package (of type
220 * <code>IPackageFragment</code>) via <code>SelectionDialog.getResult</code>.
222 * @param parent the parent shell of the dialog to be created
223 * @param project the Java project
224 * @param style flags defining the style of the dialog; the valid flags are:
225 * <code>IJavaElementSearchConstants.CONSIDER_BINARIES</code>, indicating that
226 * packages from binary package fragment roots should be included in addition
227 * to those from source package fragment roots;
228 * <code>IJavaElementSearchConstants.CONSIDER_REQUIRED_PROJECTS</code>, indicating that
229 * packages from required projects should be included as well.
230 * @param filter the initial pattern to filter the set of packages. For example "com" shows
231 * all packages starting with "com". The meta character '?' representing any character and
232 * '*' representing any string are supported. Clients can pass an empty string if no filtering
234 * @return a new selection dialog
235 * @exception JavaModelException if the selection dialog could not be opened
239 // public static SelectionDialog createPackageDialog(Shell parent, IJavaProject project, int style, String filter) throws JavaModelException {
240 // Assert.isTrue((style | IJavaElementSearchConstants.CONSIDER_BINARIES | IJavaElementSearchConstants.CONSIDER_REQUIRED_PROJECTS) ==
241 // (IJavaElementSearchConstants.CONSIDER_BINARIES | IJavaElementSearchConstants.CONSIDER_REQUIRED_PROJECTS));
243 // IPackageFragmentRoot[] roots= null;
244 // if ((style & IJavaElementSearchConstants.CONSIDER_REQUIRED_PROJECTS) != 0) {
245 // roots= project.getAllPackageFragmentRoots();
247 // roots= project.getPackageFragmentRoots();
250 // List consideredRoots= null;
251 // if ((style & IJavaElementSearchConstants.CONSIDER_BINARIES) != 0) {
252 // consideredRoots= Arrays.asList(roots);
254 // consideredRoots= new ArrayList(roots.length);
255 // for (int i= 0; i < roots.length; i++) {
256 // IPackageFragmentRoot root= roots[i];
257 // if (root.getKind() != IPackageFragmentRoot.K_BINARY)
258 // consideredRoots.add(root);
263 // int flags= JavaElementLabelProvider.SHOW_DEFAULT;
264 // if (consideredRoots.size() > 1)
265 // flags= flags | JavaElementLabelProvider.SHOW_ROOT;
267 // List packages= new ArrayList();
268 // Iterator iter= consideredRoots.iterator();
269 // while(iter.hasNext()) {
270 // IPackageFragmentRoot root= (IPackageFragmentRoot)iter.next();
271 // packages.addAll(Arrays.asList(root.getChildren()));
273 // ElementListSelectionDialog dialog= new ElementListSelectionDialog(parent, new JavaElementLabelProvider(flags));
274 // dialog.setIgnoreCase(false);
275 // dialog.setElements(packages.toArray()); // XXX inefficient
276 // dialog.setFilter(filter);
281 * Creates a selection dialog that lists all packages of the given Java project.
282 * The caller is responsible for opening the dialog with <code>Window.open</code>,
283 * and subsequently extracting the selected package (of type
284 * <code>IPackageFragment</code>) via <code>SelectionDialog.getResult</code>.
286 * @param parent the parent shell of the dialog to be created
287 * @param project the Java project
288 * @param style flags defining the style of the dialog; the valid flags are:
289 * <code>IJavaElementSearchConstants.CONSIDER_BINARIES</code>, indicating that
290 * packages from binary package fragment roots should be included in addition
291 * to those from source package fragment roots;
292 * <code>IJavaElementSearchConstants.CONSIDER_REQUIRED_PROJECTS</code>, indicating that
293 * packages from required projects should be included as well.
294 * @return a new selection dialog
295 * @exception JavaModelException if the selection dialog could not be opened
297 // public static SelectionDialog createPackageDialog(Shell parent, IJavaProject project, int style) throws JavaModelException {
298 // return createPackageDialog(parent, project, style, ""); //$NON-NLS-1$
302 * Creates a selection dialog that lists all packages under the given package
304 * The caller is responsible for opening the dialog with <code>Window.open</code>,
305 * and subsequently extracting the selected package (of type
306 * <code>IPackageFragment</code>) via <code>SelectionDialog.getResult</code>.
308 * @param parent the parent shell of the dialog to be created
309 * @param root the package fragment root
310 * @param filter the initial pattern to filter the set of packages. For example "com" shows
311 * all packages starting with "com". The meta character '?' representing any character and
312 * '*' representing any string are supported. Clients can pass an empty string if no filtering
314 * @return a new selection dialog
315 * @exception JavaModelException if the selection dialog could not be opened
319 // public static SelectionDialog createPackageDialog(Shell parent, IPackageFragmentRoot root, String filter) throws JavaModelException {
320 // ElementListSelectionDialog dialog= new ElementListSelectionDialog(parent, new JavaElementLabelProvider(JavaElementLabelProvider.SHOW_DEFAULT));
321 // dialog.setIgnoreCase(false);
322 // dialog.setElements(root.getChildren());
323 // dialog.setFilter(filter);
328 * Creates a selection dialog that lists all packages under the given package
330 * The caller is responsible for opening the dialog with <code>Window.open</code>,
331 * and subsequently extracting the selected package (of type
332 * <code>IPackageFragment</code>) via <code>SelectionDialog.getResult</code>.
334 * @param parent the parent shell of the dialog to be created
335 * @param root the package fragment root
336 * @return a new selection dialog
337 * @exception JavaModelException if the selection dialog could not be opened
339 // public static SelectionDialog createPackageDialog(Shell parent, IPackageFragmentRoot root) throws JavaModelException {
340 // return createPackageDialog(parent, root, ""); //$NON-NLS-1$
344 * Creates a selection dialog that lists all types in the given scope.
345 * The caller is responsible for opening the dialog with <code>Window.open</code>,
346 * and subsequently extracting the selected type(s) (of type
347 * <code>IType</code>) via <code>SelectionDialog.getResult</code>.
349 * @param parent the parent shell of the dialog to be created
350 * @param context the runnable context used to show progress when the dialog
352 * @param scope the scope that limits which types are included
353 * @param style flags defining the style of the dialog; the only valid values are
354 * <code>IJavaElementSearchConstants.CONSIDER_CLASSES</code>,
355 * <code>CONSIDER_INTERFACES</code>, or their bitwise OR
356 * (equivalent to <code>CONSIDER_TYPES</code>)
357 * @param multipleSelection <code>true</code> if multiple selection is allowed
358 * @param filter the initial pattern to filter the set of types. For example "Abstract" shows
359 * all types starting with "abstract". The meta character '?' representing any character and
360 * '*' representing any string are supported. Clients can pass an empty string if no filtering
362 * @exception JavaModelException if the selection dialog could not be opened
366 // public static SelectionDialog createTypeDialog(Shell parent, IRunnableContext context, IJavaSearchScope scope, int style, boolean multipleSelection, String filter) throws JavaModelException {
367 // int elementKinds= 0;
368 // if (style == IJavaElementSearchConstants.CONSIDER_TYPES) {
369 // elementKinds= IJavaSearchConstants.TYPE;
370 // } else if (style == IJavaElementSearchConstants.CONSIDER_INTERFACES) {
371 // elementKinds= IJavaSearchConstants.INTERFACE;
372 // } else if (style == IJavaElementSearchConstants.CONSIDER_CLASSES) {
373 // elementKinds= IJavaSearchConstants.CLASS;
375 // Assert.isTrue(false, "illegal style"); //$NON-NLS-1$
377 // if (multipleSelection) {
378 // MultiTypeSelectionDialog dialog= new MultiTypeSelectionDialog(parent, context, elementKinds, scope);
379 // dialog.setMessage(JavaUIMessages.getString("JavaUI.defaultDialogMessage")); //$NON-NLS-1$
380 // dialog.setFilter(filter);
383 // TypeSelectionDialog dialog= new TypeSelectionDialog(parent, context, elementKinds, scope);
384 // dialog.setMessage(JavaUIMessages.getString("JavaUI.defaultDialogMessage")); //$NON-NLS-1$
385 // dialog.setFilter(filter);
391 * Creates a selection dialog that lists all types in the given scope.
392 * The caller is responsible for opening the dialog with <code>Window.open</code>,
393 * and subsequently extracting the selected type(s) (of type
394 * <code>IType</code>) via <code>SelectionDialog.getResult</code>.
396 * @param parent the parent shell of the dialog to be created
397 * @param context the runnable context used to show progress when the dialog
399 * @param scope the scope that limits which types are included
400 * @param style flags defining the style of the dialog; the only valid values are
401 * <code>IJavaElementSearchConstants.CONSIDER_CLASSES</code>,
402 * <code>CONSIDER_INTERFACES</code>, or their bitwise OR
403 * (equivalent to <code>CONSIDER_TYPES</code>)
404 * @param multipleSelection <code>true</code> if multiple selection is allowed
405 * @return a new selection dialog
406 * @exception JavaModelException if the selection dialog could not be opened
408 // public static SelectionDialog createTypeDialog(Shell parent, IRunnableContext context, IJavaSearchScope scope, int style, boolean multipleSelection) throws JavaModelException {
409 // return createTypeDialog(parent, context, scope, style, multipleSelection, "");//$NON-NLS-1$
413 * Creates a selection dialog that lists all types in the given scope containing
414 * a standard <code>main</code> method.
415 * The caller is responsible for opening the dialog with <code>Window.open</code>,
416 * and subsequently extracting the selected type(s) (of type
417 * <code>IType</code>) via <code>SelectionDialog.getResult</code>.
419 * @param parent the parent shell of the dialog to be created
420 * @param context the runnable context used to show progress when the dialog
422 * @param scope the scope that limits which types are included
423 * @param style flags defining the style of the dialog; the only valid values are
424 * <code>IJavaElementSearchConstants.CONSIDER_BINARIES</code>,
425 * <code>CONSIDER_EXTERNAL_JARS</code>, or their bitwise OR, or <code>0</code>
426 * @param multipleSelection <code>true</code> if multiple selection is allowed
427 * @param filter the initial pattern to filter the set of types containg a main method. For
428 * example "App" shows all types starting with "app". The meta character '?' representing
429 * any character and '*' representing any string are supported. Clients can pass an empty
430 * string if no filtering is required.
431 * @return a new selection dialog
435 // public static SelectionDialog createMainTypeDialog(Shell parent, IRunnableContext context, IJavaSearchScope scope, int style, boolean multipleSelection, String filter) {
436 // if (multipleSelection) {
437 // MultiMainTypeSelectionDialog dialog= new MultiMainTypeSelectionDialog(parent, context, scope, style);
438 // dialog.setFilter(filter);
441 // MainTypeSelectionDialog dialog= new MainTypeSelectionDialog(parent, context, scope, style);
442 // dialog.setFilter(filter);
448 * Creates a selection dialog that lists all types in the given scope containing
449 * a standard <code>main</code> method.
450 * The caller is responsible for opening the dialog with <code>Window.open</code>,
451 * and subsequently extracting the selected type(s) (of type
452 * <code>IType</code>) via <code>SelectionDialog.getResult</code>.
454 * @param parent the parent shell of the dialog to be created
455 * @param context the runnable context used to show progress when the dialog
457 * @param scope the scope that limits which types are included
458 * @param style flags defining the style of the dialog; the only valid values are
459 * <code>IJavaElementSearchConstants.CONSIDER_BINARIES</code>,
460 * <code>CONSIDER_EXTERNAL_JARS</code>, or their bitwise OR, or <code>0</code>
461 * @param multipleSelection <code>true</code> if multiple selection is allowed
462 * @return a new selection dialog
464 // public static SelectionDialog createMainTypeDialog(Shell parent, IRunnableContext context, IJavaSearchScope scope, int style, boolean multipleSelection) {
465 // return createMainTypeDialog(parent, context, scope, style, multipleSelection, "");//$NON-NLS-1$
469 * Creates a selection dialog that lists all types in the given project.
470 * The caller is responsible for opening the dialog with <code>Window.open</code>,
471 * and subsequently extracting the selected type(s) (of type
472 * <code>IType</code>) via <code>SelectionDialog.getResult</code>.
474 * @param parent the parent shell of the dialog to be created
475 * @param context the runnable context used to show progress when the dialog
477 * @param project the Java project
478 * @param style flags defining the style of the dialog; the only valid values are
479 * <code>IJavaElementSearchConstants.CONSIDER_CLASSES</code>,
480 * <code>CONSIDER_INTERFACES</code>, or their bitwise OR
481 * (equivalent to <code>CONSIDER_TYPES</code>)
482 * @param multipleSelection <code>true</code> if multiple selection is allowed
483 * @return a new selection dialog
484 * @exception JavaModelException if the selection dialog could not be opened
486 // public static SelectionDialog createTypeDialog(Shell parent, IRunnableContext context, IProject project, int style, boolean multipleSelection) throws JavaModelException {
487 // IJavaSearchScope scope= SearchEngine.createJavaSearchScope(new IJavaProject[] { JavaCore.create(project) });
488 // return createTypeDialog(parent, context, scope, style, multipleSelection);
492 * Opens a Java editor on the given Java element. The element can be a compilation unit
493 * or class file. If there already is an open Java editor for the given element, it is returned.
495 * @param element the input element; either a compilation unit
496 * (<code>ICompilationUnit</code>) or a class file (</code>IClassFile</code>)
497 * @return the editor, or </code>null</code> if wrong element type or opening failed
498 * @exception PartInitException if the editor could not be initialized
499 * @exception JavaModelException if this element does not exist or if an
500 * exception occurs while accessing its underlying resource
502 public static IEditorPart openInEditor(IJavaElement element) throws JavaModelException, PartInitException {
503 return EditorUtility.openInEditor(element);
507 * Reveals the source range of the given source reference element in the
508 * given editor. No checking is done if the editor displays a compilation unit or
509 * class file that contains the given source reference. The editor simply reveals
510 * the source range denoted by the given source reference.
512 * @param part the editor displaying the compilation unit or class file
513 * @param element the source reference element defining the source range to be revealed
515 * @deprecated use <code>revealInEditor(IEditorPart, IJavaElement)</code> instead
517 // public static void revealInEditor(IEditorPart part, ISourceReference element) {
518 // if (element instanceof IJavaElement)
519 // revealInEditor(part, (IJavaElement) element);
523 * Reveals the given java element in the given editor. If the element is not an instance
524 * of <code>ISourceReference</code> this method result in a NOP. If it is a source
525 * reference no checking is done if the editor displays a compilation unit or class file that
526 * contains the source reference element. The editor simply reveals the source range
527 * denoted by the given element.
529 * @param part the editor displaying a compilation unit or class file
530 * @param element the element to be revealed
534 // public static void revealInEditor(IEditorPart part, IJavaElement element) {
535 // EditorUtility.revealInEditor(part, element);
539 * Returns the working copy manager for the Java UI plug-in.
541 * @return the working copy manager for the Java UI plug-in
543 public static IWorkingCopyManager getWorkingCopyManager() {
544 return PHPeclipsePlugin.getDefault().getWorkingCopyManager();
548 * Answers the shared working copies currently registered for the Java plug-in.
549 * Note that the returned array can include working copies that are
550 * not on the class path of a Java project.
552 * @return the list of shared working copies
554 * @see org.eclipse.jdt.core.JavaCore#getSharedWorkingCopies(org.eclipse.jdt.core.IBufferFactory)
557 public static IWorkingCopy[] getSharedWorkingCopies() {
558 return JavaCore.getSharedWorkingCopies(getBufferFactory());
562 * Answers the shared working copies that are on the class path of a Java
563 * project currently registered for the Java plug-in.
566 * @return the list of shared working copies
568 * @see #getSharedWorkingCopies()
571 // public static IWorkingCopy[] getSharedWorkingCopiesOnClasspath() {
572 // IWorkingCopy[] wcs= getSharedWorkingCopies();
573 // List result= new ArrayList(wcs.length);
574 // for (int i = 0; i < wcs.length; i++) {
575 // IWorkingCopy wc= wcs[i];
576 // if (wc instanceof IJavaElement) {
577 // IJavaElement je= (IJavaElement)wc;
578 // if (je.getJavaProject().isOnClasspath(je)) {
583 // return (IWorkingCopy[])result.toArray(new IWorkingCopy[result.size()]);
587 * Returns the BufferFactory for the Java UI plug-in.
589 * @return the BufferFactory for the Java UI plug-in
591 * @see org.eclipse.jdt.core.IBufferFactory
593 * @deprecated {@link IBufferFactory} has been replaced by {@link org.eclipse.jdt.core.WorkingCopyOwner}.
594 * The Java UI plug-in uses the <i>primary working copy owner</i> that can be accessed with <code>null</code> in
595 * API's that require an owner
597 public static IBufferFactory getBufferFactory() {
598 return PHPeclipsePlugin.getDefault().getBufferFactory();
601 * Returns the DocumentProvider used for Java compilation units.
603 * @return the DocumentProvider for Java compilation units.
605 * @see IDocumentProvider
608 public static IDocumentProvider getDocumentProvider() {
609 return PHPeclipsePlugin.getDefault().getCompilationUnitDocumentProvider();
613 * Sets the Javadoc location for an archive with the given path.
615 * @param archivePath the path of the library; this can be an workspace path
616 * or an external path in case of an external library.
617 * @param url The Javadoc location to set. This location should contain index.html and
618 * a file 'package-list'. <code>null</code> clears the current documentation
623 // public static void setLibraryJavadocLocation(IPath archivePath, URL url) {
624 // JavaDocLocations.setLibraryJavadocLocation(archivePath, url);
628 * Returns the Javadoc location for an archive or <code>null</code> if no
629 * location is available.
631 * @param archivePath the path of the library. This can be an workspace path
632 * or an external path in case of an external library.
636 // public static URL getLibraryJavadocLocation(IPath archivePath) {
637 // return JavaDocLocations.getLibraryJavadocLocation(archivePath);
641 * Sets the Javadoc location for a Java project. This location is used for
642 * all types located in the project's source folders.
644 * @param project the project
645 * @param url The Javadoc location to set. This location should contain index.html and
646 * a file 'package-list'. <code>null</code> clears the current documentation
651 // public static void setProjectJavadocLocation(IJavaProject project, URL url) {
652 // JavaDocLocations.setProjectJavadocLocation(project, url);
656 * Returns the Javadoc location for a Java project or <code>null</code> if no
657 * location is available. This location is used for all types located in the project's
660 * @param project the project
664 // public static URL getProjectJavadocLocation(IJavaProject project) {
665 // return JavaDocLocations.getProjectJavadocLocation(project);
669 * Returns the Javadoc base URL for an element. The base location contains the
670 * index file. This location doesn't have to exist. Returns
671 * <code>null</code> if no javadoc location has been attached to the
672 * element's library or project. Example of a returned URL is <i>http://www.
673 * junit. org/junit/javadoc</i>.
675 * @param The element for which the doc URL is requested.
679 // public static URL getJavadocBaseLocation(IJavaElement element) throws JavaModelException {
680 // return JavaDocLocations.getJavadocBaseLocation(element);
684 * Returns the Javadoc URL for an element. Example of a returned URL is
685 * <i>http://www.junit.org/junit/javadoc/junit/extensions/TestSetup.html</i>.
686 * This returned location doesn't have to exist. Returns <code>null</code>
687 * if no javadoc location has been attached to the element's library or
690 * @param The element for which the doc URL is requested.
691 * @param includeAnchor If set, the URL contains an anchor for member references:
692 * <i>http://www.junit.org/junit/javadoc/junit/extensions/TestSetup.html#run(junit.framework.TestResult)</i>. Note
693 * that this involves type resolving and is a more expensive call than without anchor.
697 // public static URL getJavadocLocation(IJavaElement element, boolean includeAnchor) throws JavaModelException {
698 // return JavaDocLocations.getJavadocLocation(element, includeAnchor);