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.JavaCore;
17 import net.sourceforge.phpdt.core.JavaModelException;
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
29 * <code>"net.sourceforge.phpdt.ui"</code>). This class provides static
32 * <li> creating various kinds of selection dialogs to present a collection of
33 * 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>"net.sourceforge.phpdt.ui"</code>).
52 // public static final String ID_PLUGIN= "net.sourceforge.phpdt.ui";
55 * The id of the Java perspective (value
56 * <code>"net.sourceforge.phpdt.ui.JavaPerspective"</code>).
58 // public static final String ID_PERSPECTIVE=
59 // "net.sourceforge.phpdt.ui.JavaPerspective"; //$NON-NLS-1$
61 * The id of the Java hierarchy perspective (value
62 * <code>"net.sourceforge.phpdt.ui.JavaHierarchyPerspective"</code>).
64 // public static final String ID_HIERARCHYPERSPECTIVE=
65 // "net.sourceforge.phpdt.ui.JavaHierarchyPerspective"; //$NON-NLS-1$
67 * The id of the Java action set (value
68 * <code>"net.sourceforge.phpdt.ui.JavaActionSet"</code>).
70 // public static final String ID_ACTION_SET=
71 // "net.sourceforge.phpdt.ui.JavaActionSet"; //$NON-NLS-1$
73 * The id of the Java Element Creation action set (value
74 * <code>"net.sourceforge.phpdt.ui.JavaElementCreationActionSet"</code>).
78 // public static final String ID_ELEMENT_CREATION_ACTION_SET=
79 // "net.sourceforge.phpdt.ui.JavaElementCreationActionSet"; //$NON-NLS-1$
81 * The id of the Java Coding action set (value
82 * <code>"net.sourceforge.phpdt.ui.CodingActionSet"</code>).
86 // public static final String ID_CODING_ACTION_SET=
87 // "net.sourceforge.phpdt.ui.CodingActionSet"; //$NON-NLS-1$
89 * The id of the Java action set for open actions (value
90 * <code>"net.sourceforge.phpdt.ui.A_OpenActionSet"</code>).
94 // public static final String ID_OPEN_ACTION_SET=
95 // "net.sourceforge.phpdt.ui.A_OpenActionSet"; //$NON-NLS-1$
97 * The id of the Java Search action set (value
98 * <code>net.sourceforge.phpdt.ui.SearchActionSet"</code>).
102 // public static final String ID_SEARCH_ACTION_SET=
103 // "net.sourceforge.phpdt.ui.SearchActionSet"; //$NON-NLS-1$
105 * The editor part id of the editor that presents Java compilation units
106 * (value <code>"net.sourceforge.phpdt.ui.CompilationUnitEditor"</code>).
108 // public static final String ID_CU_EDITOR=
109 // "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>"net.sourceforge.phpdt.ui.ClassFileEditor"</code>).
114 // public static final String ID_CF_EDITOR=
115 // "net.sourceforge.phpdt.ui.ClassFileEditor"; //$NON-NLS-1$
117 * The editor part id of the code snippet editor (value
118 * <code>"net.sourceforge.phpdt.ui.SnippetEditor"</code>).
120 // public static final String ID_SNIPPET_EDITOR=
121 // "net.sourceforge.phpdt.ui.SnippetEditor"; //$NON-NLS-1$
123 * The view part id of the Packages view (value
124 * <code>"net.sourceforge.phpdt.ui.PackageExplorer"</code>).
126 * When this id is used to access a view part with
127 * <code>IWorkbenchPage.findView</code> or <code>showView</code>, the
128 * returned <code>IViewPart</code> can be safely cast to an
129 * <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. (value
140 * <code>"net.sourceforge.phpdt.ui.TypeHierarchy"</code>).
142 * When this id is used to access a view part with
143 * <code>IWorkbenchPage.findView</code> or <code>showView</code>, the
144 * returned <code>IViewPart</code> can be safely cast to an
145 * <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 = "net.sourceforge.phpdt.ui.TypeHierarchy"; //$NON-NLS-1$
155 * The id of the Java Browsing Perspective (value
156 * <code>"net.sourceforge.phpdt.ui.JavaBrowsingPerspective"</code>).
160 // public static String ID_BROWSING_PERSPECTIVE=
161 // "net.sourceforge.phpdt.ui.JavaBrowsingPerspective"; //$NON-NLS-1$
163 * The view part id of the Java Browsing Projects view (value
164 * <code>"net.sourceforge.phpdt.ui.ProjectsView"</code>).
168 // public static String ID_PROJECTS_VIEW=
169 // "net.sourceforge.phpdt.ui.ProjectsView"; //$NON-NLS-1$
171 * The view part id of the Java Browsing Packages view (value
172 * <code>"net.sourceforge.phpdt.ui.PackagesView"</code>).
176 // public static String ID_PACKAGES_VIEW=
177 // "net.sourceforge.phpdt.ui.PackagesView"; //$NON-NLS-1$
179 * The view part id of the Java Browsing Types view (value
180 * <code>"net.sourceforge.phpdt.ui.TypesView"</code>).
184 // public static String ID_TYPES_VIEW= "net.sourceforge.phpdt.ui.TypesView";
187 * The view part id of the Java Browsing Members view (value
188 * <code>"net.sourceforge.phpdt.ui.MembersView"</code>).
192 // public static String ID_MEMBERS_VIEW=
193 // "net.sourceforge.phpdt.ui.MembersView"; //$NON-NLS-1$
195 * The class org.eclipse.debug.core.model.IProcess allows attaching String
196 * properties to processes. The Java UI contributes a property page for
197 * IProcess that will show the contents of the property with this key. The
198 * intent of this property is to show the command line a process was
203 // public final static String ATTR_CMDLINE=
204 // "net.sourceforge.phpdt.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
219 * project. The caller is responsible for opening the dialog with
220 * <code>Window.open</code>, and subsequently extracting the selected
221 * package (of type <code>IPackageFragment</code>) via
222 * <code>SelectionDialog.getResult</code>.
225 * the parent shell of the dialog to be created
229 * flags defining the style of the dialog; the valid flags are:
230 * <code>IJavaElementSearchConstants.CONSIDER_BINARIES</code>,
231 * indicating that packages from binary package fragment roots
232 * should be included in addition to those from source package
234 * <code>IJavaElementSearchConstants.CONSIDER_REQUIRED_PROJECTS</code>,
235 * indicating that packages from required projects should be
238 * the initial pattern to filter the set of packages. For example
239 * "com" shows all packages starting with "com". The meta
240 * character '?' representing any character and '*' representing
241 * any string are supported. Clients can pass an empty string if
242 * no filtering is required.
243 * @return a new selection dialog
244 * @exception JavaModelException
245 * if the selection dialog could not be opened
249 // public static SelectionDialog createPackageDialog(Shell parent,
250 // IJavaProject project, int style, String filter) throws JavaModelException
252 // Assert.isTrue((style | IJavaElementSearchConstants.CONSIDER_BINARIES |
253 // IJavaElementSearchConstants.CONSIDER_REQUIRED_PROJECTS) ==
254 // (IJavaElementSearchConstants.CONSIDER_BINARIES |
255 // IJavaElementSearchConstants.CONSIDER_REQUIRED_PROJECTS));
257 // IPackageFragmentRoot[] roots= null;
258 // if ((style & IJavaElementSearchConstants.CONSIDER_REQUIRED_PROJECTS) !=
260 // roots= project.getAllPackageFragmentRoots();
262 // roots= project.getPackageFragmentRoots();
265 // List consideredRoots= null;
266 // if ((style & IJavaElementSearchConstants.CONSIDER_BINARIES) != 0) {
267 // consideredRoots= Arrays.asList(roots);
269 // consideredRoots= new ArrayList(roots.length);
270 // for (int i= 0; i < roots.length; i++) {
271 // IPackageFragmentRoot root= roots[i];
272 // if (root.getKind() != IPackageFragmentRoot.K_BINARY)
273 // consideredRoots.add(root);
278 // int flags= JavaElementLabelProvider.SHOW_DEFAULT;
279 // if (consideredRoots.size() > 1)
280 // flags= flags | JavaElementLabelProvider.SHOW_ROOT;
282 // List packages= new ArrayList();
283 // Iterator iter= consideredRoots.iterator();
284 // while(iter.hasNext()) {
285 // IPackageFragmentRoot root= (IPackageFragmentRoot)iter.next();
286 // packages.addAll(Arrays.asList(root.getChildren()));
288 // ElementListSelectionDialog dialog= new ElementListSelectionDialog(parent,
289 // new JavaElementLabelProvider(flags));
290 // dialog.setIgnoreCase(false);
291 // dialog.setElements(packages.toArray()); // XXX inefficient
292 // dialog.setFilter(filter);
296 * Creates a selection dialog that lists all packages of the given Java
297 * project. The caller is responsible for opening the dialog with
298 * <code>Window.open</code>, and subsequently extracting the selected
299 * package (of type <code>IPackageFragment</code>) via
300 * <code>SelectionDialog.getResult</code>.
303 * the parent shell of the dialog to be created
307 * flags defining the style of the dialog; the valid flags are:
308 * <code>IJavaElementSearchConstants.CONSIDER_BINARIES</code>,
309 * indicating that packages from binary package fragment roots
310 * should be included in addition to those from source package
312 * <code>IJavaElementSearchConstants.CONSIDER_REQUIRED_PROJECTS</code>,
313 * indicating that packages from required projects should be
315 * @return a new selection dialog
316 * @exception JavaModelException
317 * if the selection dialog could not be opened
319 // public static SelectionDialog createPackageDialog(Shell parent,
320 // IJavaProject project, int style) throws JavaModelException {
321 // return createPackageDialog(parent, project, style, ""); //$NON-NLS-1$
324 * Creates a selection dialog that lists all packages under the given
325 * package fragment root. The caller is responsible for opening the dialog
326 * with <code>Window.open</code>, and subsequently extracting the
327 * selected package (of type <code>IPackageFragment</code>) via
328 * <code>SelectionDialog.getResult</code>.
331 * the parent shell of the dialog to be created
333 * the package fragment root
335 * the initial pattern to filter the set of packages. For example
336 * "com" shows all packages starting with "com". The meta
337 * character '?' representing any character and '*' representing
338 * any string are supported. Clients can pass an empty string if
339 * no filtering is required.
340 * @return a new selection dialog
341 * @exception JavaModelException
342 * if the selection dialog could not be opened
346 // public static SelectionDialog createPackageDialog(Shell parent,
347 // IPackageFragmentRoot root, String filter) throws JavaModelException {
348 // ElementListSelectionDialog dialog= new ElementListSelectionDialog(parent,
349 // new JavaElementLabelProvider(JavaElementLabelProvider.SHOW_DEFAULT));
350 // dialog.setIgnoreCase(false);
351 // dialog.setElements(root.getChildren());
352 // dialog.setFilter(filter);
356 * Creates a selection dialog that lists all packages under the given
357 * package fragment root. The caller is responsible for opening the dialog
358 * with <code>Window.open</code>, and subsequently extracting the
359 * selected package (of type <code>IPackageFragment</code>) via
360 * <code>SelectionDialog.getResult</code>.
363 * the parent shell of the dialog to be created
365 * the package fragment root
366 * @return a new selection dialog
367 * @exception JavaModelException
368 * if the selection dialog could not be opened
370 // public static SelectionDialog createPackageDialog(Shell parent,
371 // IPackageFragmentRoot root) throws JavaModelException {
372 // return createPackageDialog(parent, root, ""); //$NON-NLS-1$
375 * Creates a selection dialog that lists all types in the given scope. The
376 * caller is responsible for opening the dialog with
377 * <code>Window.open</code>, and subsequently extracting the selected
378 * type(s) (of type <code>IType</code>) via
379 * <code>SelectionDialog.getResult</code>.
382 * the parent shell of the dialog to be created
384 * the runnable context used to show progress when the dialog is
387 * the scope that limits which types are included
389 * flags defining the style of the dialog; the only valid values
390 * are <code>IJavaElementSearchConstants.CONSIDER_CLASSES</code>,
391 * <code>CONSIDER_INTERFACES</code>, or their bitwise OR
392 * (equivalent to <code>CONSIDER_TYPES</code>)
393 * @param multipleSelection
394 * <code>true</code> if multiple selection is allowed
396 * the initial pattern to filter the set of types. For example
397 * "Abstract" shows all types starting with "abstract". The meta
398 * character '?' representing any character and '*' representing
399 * any string are supported. Clients can pass an empty string if
400 * no filtering is required.
401 * @exception JavaModelException
402 * if the selection dialog could not be opened
406 // public static SelectionDialog createTypeDialog(Shell parent,
407 // IRunnableContext context, IJavaSearchScope scope, int style, boolean
408 // multipleSelection, String filter) throws JavaModelException {
409 // int elementKinds= 0;
410 // if (style == IJavaElementSearchConstants.CONSIDER_TYPES) {
411 // elementKinds= IJavaSearchConstants.TYPE;
412 // } else if (style == IJavaElementSearchConstants.CONSIDER_INTERFACES) {
413 // elementKinds= IJavaSearchConstants.INTERFACE;
414 // } else if (style == IJavaElementSearchConstants.CONSIDER_CLASSES) {
415 // elementKinds= IJavaSearchConstants.CLASS;
417 // Assert.isTrue(false, "illegal style"); //$NON-NLS-1$
419 // if (multipleSelection) {
420 // MultiTypeSelectionDialog dialog= new MultiTypeSelectionDialog(parent,
421 // context, elementKinds, scope);
422 // dialog.setMessage(JavaUIMessages.getString("JavaUI.defaultDialogMessage"));
424 // dialog.setFilter(filter);
427 // TypeSelectionDialog dialog= new TypeSelectionDialog(parent, context,
428 // elementKinds, scope);
429 // dialog.setMessage(JavaUIMessages.getString("JavaUI.defaultDialogMessage"));
431 // dialog.setFilter(filter);
436 * Creates a selection dialog that lists all types in the given scope. The
437 * caller is responsible for opening the dialog with
438 * <code>Window.open</code>, and subsequently extracting the selected
439 * type(s) (of type <code>IType</code>) via
440 * <code>SelectionDialog.getResult</code>.
443 * the parent shell of the dialog to be created
445 * the runnable context used to show progress when the dialog is
448 * the scope that limits which types are included
450 * flags defining the style of the dialog; the only valid values
451 * are <code>IJavaElementSearchConstants.CONSIDER_CLASSES</code>,
452 * <code>CONSIDER_INTERFACES</code>, or their bitwise OR
453 * (equivalent to <code>CONSIDER_TYPES</code>)
454 * @param multipleSelection
455 * <code>true</code> if multiple selection is allowed
456 * @return a new selection dialog
457 * @exception JavaModelException
458 * if the selection dialog could not be opened
460 // public static SelectionDialog createTypeDialog(Shell parent,
461 // IRunnableContext context, IJavaSearchScope scope, int style, boolean
462 // multipleSelection) throws JavaModelException {
463 // return createTypeDialog(parent, context, scope, style, multipleSelection,
467 * Creates a selection dialog that lists all types in the given scope
468 * containing a standard <code>main</code> method. The caller is
469 * responsible for opening the dialog with <code>Window.open</code>, and
470 * subsequently extracting the selected type(s) (of type <code>IType</code>)
471 * via <code>SelectionDialog.getResult</code>.
474 * the parent shell of the dialog to be created
476 * the runnable context used to show progress when the dialog is
479 * the scope that limits which types are included
481 * flags defining the style of the dialog; the only valid values
482 * are <code>IJavaElementSearchConstants.CONSIDER_BINARIES</code>,
483 * <code>CONSIDER_EXTERNAL_JARS</code>, or their bitwise OR,
485 * @param multipleSelection
486 * <code>true</code> if multiple selection is allowed
488 * the initial pattern to filter the set of types containg a main
489 * method. For example "App" shows all types starting with "app".
490 * The meta character '?' representing any character and '*'
491 * representing any string are supported. Clients can pass an
492 * empty string if no filtering is required.
493 * @return a new selection dialog
497 // public static SelectionDialog createMainTypeDialog(Shell parent,
498 // IRunnableContext context, IJavaSearchScope scope, int style, boolean
499 // multipleSelection, String filter) {
500 // if (multipleSelection) {
501 // MultiMainTypeSelectionDialog dialog= new
502 // MultiMainTypeSelectionDialog(parent, context, scope, style);
503 // dialog.setFilter(filter);
506 // MainTypeSelectionDialog dialog= new MainTypeSelectionDialog(parent,
507 // context, scope, style);
508 // dialog.setFilter(filter);
513 * Creates a selection dialog that lists all types in the given scope
514 * containing a standard <code>main</code> method. The caller is
515 * responsible for opening the dialog with <code>Window.open</code>, and
516 * subsequently extracting the selected type(s) (of type <code>IType</code>)
517 * via <code>SelectionDialog.getResult</code>.
520 * the parent shell of the dialog to be created
522 * the runnable context used to show progress when the dialog is
525 * the scope that limits which types are included
527 * flags defining the style of the dialog; the only valid values
528 * are <code>IJavaElementSearchConstants.CONSIDER_BINARIES</code>,
529 * <code>CONSIDER_EXTERNAL_JARS</code>, or their bitwise OR,
531 * @param multipleSelection
532 * <code>true</code> if multiple selection is allowed
533 * @return a new selection dialog
535 // public static SelectionDialog createMainTypeDialog(Shell parent,
536 // IRunnableContext context, IJavaSearchScope scope, int style, boolean
537 // multipleSelection) {
538 // return createMainTypeDialog(parent, context, scope, style,
539 // multipleSelection, "");//$NON-NLS-1$
542 * Creates a selection dialog that lists all types in the given project. The
543 * caller is responsible for opening the dialog with
544 * <code>Window.open</code>, and subsequently extracting the selected
545 * type(s) (of type <code>IType</code>) via
546 * <code>SelectionDialog.getResult</code>.
549 * the parent shell of the dialog to be created
551 * the runnable context used to show progress when the dialog is
556 * flags defining the style of the dialog; the only valid values
557 * are <code>IJavaElementSearchConstants.CONSIDER_CLASSES</code>,
558 * <code>CONSIDER_INTERFACES</code>, or their bitwise OR
559 * (equivalent to <code>CONSIDER_TYPES</code>)
560 * @param multipleSelection
561 * <code>true</code> if multiple selection is allowed
562 * @return a new selection dialog
563 * @exception JavaModelException
564 * if the selection dialog could not be opened
566 // public static SelectionDialog createTypeDialog(Shell parent,
567 // IRunnableContext context, IProject project, int style, boolean
568 // multipleSelection) throws JavaModelException {
569 // IJavaSearchScope scope= SearchEngine.createJavaSearchScope(new
570 // IJavaProject[] { JavaCore.create(project) });
571 // return createTypeDialog(parent, context, scope, style,
572 // multipleSelection);
575 * Opens a Java editor on the given Java element. The element can be a
576 * compilation unit or class file. If there already is an open Java editor
577 * for the given element, it is returned.
580 * the input element; either a compilation unit (<code>ICompilationUnit</code>)
581 * or a class file (</code>IClassFile</code>)
582 * @return the editor, or </code>null</code> if wrong element type or
584 * @exception PartInitException
585 * if the editor could not be initialized
586 * @exception JavaModelException
587 * if this element does not exist or if an exception occurs
588 * while accessing its underlying resource
590 public static IEditorPart openInEditor(IJavaElement element)
591 throws JavaModelException, PartInitException {
592 return EditorUtility.openInEditor(element);
596 * Reveals the source range of the given source reference element in the
597 * given editor. No checking is done if the editor displays a compilation
598 * unit or class file that contains the given source reference. The editor
599 * simply reveals the source range denoted by the given source reference.
602 * the editor displaying the compilation unit or class file
604 * the source reference element defining the source range to be
607 * @deprecated use <code>revealInEditor(IEditorPart, IJavaElement)</code>
610 // public static void revealInEditor(IEditorPart part, ISourceReference
612 // if (element instanceof IJavaElement)
613 // revealInEditor(part, (IJavaElement) element);
616 * Reveals the given java element in the given editor. If the element is not
617 * an instance of <code>ISourceReference</code> this method result in a
618 * NOP. If it is a source reference no checking is done if the editor
619 * displays a compilation unit or class file that contains the source
620 * reference element. The editor simply reveals the source range denoted by
624 * the editor displaying a compilation unit or class file
626 * the element to be revealed
630 // public static void revealInEditor(IEditorPart part, IJavaElement element)
632 // EditorUtility.revealInEditor(part, element);
635 * Returns the working copy manager for the Java UI plug-in.
637 * @return the working copy manager for the Java UI plug-in
639 public static IWorkingCopyManager getWorkingCopyManager() {
640 return PHPeclipsePlugin.getDefault().getWorkingCopyManager();
644 * Answers the shared working copies currently registered for the Java
645 * plug-in. Note that the returned array can include working copies that are
646 * not on the class path of a Java project.
648 * @return the list of shared working copies
650 * @see net.sourceforge.phpdt.core.JavaCore#getSharedWorkingCopies(net.sourceforge.phpdt.core.IBufferFactory)
653 public static IWorkingCopy[] getSharedWorkingCopies() {
654 return JavaCore.getSharedWorkingCopies(getBufferFactory());
658 * Answers the shared working copies that are on the class path of a Java
659 * project currently registered for the Java plug-in.
662 * @return the list of shared working copies
664 * @see #getSharedWorkingCopies()
667 // public static IWorkingCopy[] getSharedWorkingCopiesOnClasspath() {
668 // IWorkingCopy[] wcs= getSharedWorkingCopies();
669 // List result= new ArrayList(wcs.length);
670 // for (int i = 0; i < wcs.length; i++) {
671 // IWorkingCopy wc= wcs[i];
672 // if (wc instanceof IJavaElement) {
673 // IJavaElement je= (IJavaElement)wc;
674 // if (je.getJavaProject().isOnClasspath(je)) {
679 // return (IWorkingCopy[])result.toArray(new IWorkingCopy[result.size()]);
682 * Returns the BufferFactory for the Java UI plug-in.
684 * @return the BufferFactory for the Java UI plug-in
686 * @see net.sourceforge.phpdt.core.IBufferFactory
688 * @deprecated {@link IBufferFactory} has been replaced by
689 * {@link net.sourceforge.phpdt.core.WorkingCopyOwner}. The
690 * Java UI plug-in uses the <i>primary working copy owner</i>
691 * that can be accessed with <code>null</code> in API's that
694 public static IBufferFactory getBufferFactory() {
695 return PHPeclipsePlugin.getDefault().getBufferFactory();
699 * Returns the DocumentProvider used for Java compilation units.
701 * @return the DocumentProvider for Java compilation units.
703 * @see IDocumentProvider
706 public static IDocumentProvider getDocumentProvider() {
707 return PHPeclipsePlugin.getDefault()
708 .getCompilationUnitDocumentProvider();
712 * Sets the Javadoc location for an archive with the given path.
715 * the path of the library; this can be an workspace path or an
716 * external path in case of an external library.
718 * The Javadoc location to set. This location should contain
719 * index.html and a file 'package-list'. <code>null</code>
720 * clears the current documentation location.
724 // public static void setLibraryJavadocLocation(IPath archivePath, URL url)
726 // JavaDocLocations.setLibraryJavadocLocation(archivePath, url);
729 * Returns the Javadoc location for an archive or <code>null</code> if no
730 * location is available.
733 * the path of the library. This can be an workspace path or an
734 * external path in case of an external library.
738 // public static URL getLibraryJavadocLocation(IPath archivePath) {
739 // return JavaDocLocations.getLibraryJavadocLocation(archivePath);
742 * Sets the Javadoc location for a Java project. This location is used for
743 * all types located in the project's source folders.
748 * The Javadoc location to set. This location should contain
749 * index.html and a file 'package-list'. <code>null</code>
750 * clears the current documentation location.
754 // public static void setProjectJavadocLocation(IJavaProject project, URL
756 // JavaDocLocations.setProjectJavadocLocation(project, url);
759 * Returns the Javadoc location for a Java project or <code>null</code> if
760 * no location is available. This location is used for all types located in
761 * the project's source folders.
768 // public static URL getProjectJavadocLocation(IJavaProject project) {
769 // return JavaDocLocations.getProjectJavadocLocation(project);
772 * Returns the Javadoc base URL for an element. The base location contains
773 * the index file. This location doesn't have to exist. Returns
774 * <code>null</code> if no javadoc location has been attached to the
775 * element's library or project. Example of a returned URL is <i>http://www.
776 * junit. org/junit/javadoc</i>.
779 * element for which the doc URL is requested.
783 // public static URL getJavadocBaseLocation(IJavaElement element) throws
784 // JavaModelException {
785 // return JavaDocLocations.getJavadocBaseLocation(element);
788 * Returns the Javadoc URL for an element. Example of a returned URL is
789 * <i>http://www.junit.org/junit/javadoc/junit/extensions/TestSetup.html</i>.
790 * This returned location doesn't have to exist. Returns <code>null</code>
791 * if no javadoc location has been attached to the element's library or
795 * element for which the doc URL is requested.
796 * @param includeAnchor
797 * If set, the URL contains an anchor for member references:
798 * <i>http://www.junit.org/junit/javadoc/junit/extensions/TestSetup.html#run(junit.framework.TestResult)</i>.
799 * Note that this involves type resolving and is a more expensive
800 * call than without anchor.
804 // public static URL getJavadocLocation(IJavaElement element, boolean
805 // includeAnchor) throws JavaModelException {
806 // return JavaDocLocations.getJavadocLocation(element, includeAnchor);