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;
20 import net.sourceforge.phpeclipse.ui.WebUI;
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
30 * <code>"net.sourceforge.phpdt.ui"</code>). This class provides static
33 * <li> creating various kinds of selection dialogs to present a collection of
34 * Java elements to the user and let them make a selection.</li>
35 * <li> opening a Java editor on a compilation unit.</li>
38 * This class provides static methods and fields only; it is not intended to be
39 * instantiated or subclassed by clients.
42 public final class JavaUI {
44 private static ISharedImages fgSharedImages = null;
47 // prevent instantiation of JavaUI.
51 * The id of the Java plugin (value <code>"net.sourceforge.phpdt.ui"</code>).
53 // public static final String ID_PLUGIN= "net.sourceforge.phpdt.ui";
56 * The id of the Java perspective (value
57 * <code>"net.sourceforge.phpdt.ui.JavaPerspective"</code>).
59 public static final String ID_PERSPECTIVE=
60 "net.sourceforge.phpdt.ui.JavaPerspective"; //$NON-NLS-1$
62 * The id of the Java hierarchy perspective (value
63 * <code>"net.sourceforge.phpdt.ui.JavaHierarchyPerspective"</code>).
65 // public static final String ID_HIERARCHYPERSPECTIVE=
66 // "net.sourceforge.phpdt.ui.JavaHierarchyPerspective"; //$NON-NLS-1$
68 * The id of the Java action set (value
69 * <code>"net.sourceforge.phpdt.ui.JavaActionSet"</code>).
71 // public static final String ID_ACTION_SET=
72 // "net.sourceforge.phpdt.ui.JavaActionSet"; //$NON-NLS-1$
74 * The id of the Java Element Creation action set (value
75 * <code>"net.sourceforge.phpdt.ui.JavaElementCreationActionSet"</code>).
79 // public static final String ID_ELEMENT_CREATION_ACTION_SET=
80 // "net.sourceforge.phpdt.ui.JavaElementCreationActionSet"; //$NON-NLS-1$
82 * The id of the Java Coding action set (value
83 * <code>"net.sourceforge.phpdt.ui.CodingActionSet"</code>).
87 // public static final String ID_CODING_ACTION_SET=
88 // "net.sourceforge.phpdt.ui.CodingActionSet"; //$NON-NLS-1$
90 * The id of the Java action set for open actions (value
91 * <code>"net.sourceforge.phpdt.ui.A_OpenActionSet"</code>).
95 // public static final String ID_OPEN_ACTION_SET=
96 // "net.sourceforge.phpdt.ui.A_OpenActionSet"; //$NON-NLS-1$
98 * The id of the Java Search action set (value
99 * <code>net.sourceforge.phpdt.ui.SearchActionSet"</code>).
103 // public static final String ID_SEARCH_ACTION_SET=
104 // "net.sourceforge.phpdt.ui.SearchActionSet"; //$NON-NLS-1$
106 * The editor part id of the editor that presents Java compilation units
107 * (value <code>"net.sourceforge.phpdt.ui.CompilationUnitEditor"</code>).
109 // public static final String ID_CU_EDITOR=
110 // "net.sourceforge.phpdt.ui.PHPUnitEditor"; //$NON-NLS-1$
112 * The editor part id of the editor that presents Java binary class files
113 * (value <code>"net.sourceforge.phpdt.ui.ClassFileEditor"</code>).
115 // public static final String ID_CF_EDITOR=
116 // "net.sourceforge.phpdt.ui.ClassFileEditor"; //$NON-NLS-1$
118 * The editor part id of the code snippet editor (value
119 * <code>"net.sourceforge.phpdt.ui.SnippetEditor"</code>).
121 // public static final String ID_SNIPPET_EDITOR=
122 // "net.sourceforge.phpdt.ui.SnippetEditor"; //$NON-NLS-1$
124 * The view part id of the Packages view (value
125 * <code>"net.sourceforge.phpdt.ui.PackageExplorer"</code>).
127 * When this id is used to access a view part with
128 * <code>IWorkbenchPage.findView</code> or <code>showView</code>, the
129 * returned <code>IViewPart</code> can be safely cast to an
130 * <code>IPackagesViewPart</code>.
133 * @see IPackagesViewPart
134 * @see org.eclipse.ui.IWorkbenchPage#findView(java.lang.String)
135 * @see org.eclipse.ui.IWorkbenchPage#showView(java.lang.String)
137 public static final String ID_PACKAGES = "net.sourceforge.phpdt.ui.PackageExplorer"; //$NON-NLS-1$
140 * The view part id of the type hierarchy part. (value
141 * <code>"net.sourceforge.phpdt.ui.TypeHierarchy"</code>).
143 * When this id is used to access a view part with
144 * <code>IWorkbenchPage.findView</code> or <code>showView</code>, the
145 * returned <code>IViewPart</code> can be safely cast to an
146 * <code>ITypeHierarchyViewPart</code>.
149 * @see ITypeHierarchyViewPart
150 * @see org.eclipse.ui.IWorkbenchPage#findView(java.lang.String)
151 * @see org.eclipse.ui.IWorkbenchPage#showView(java.lang.String)
153 public static final String ID_TYPE_HIERARCHY = "net.sourceforge.phpdt.ui.TypeHierarchy"; //$NON-NLS-1$
156 * The id of the Java Browsing Perspective (value
157 * <code>"net.sourceforge.phpdt.ui.JavaBrowsingPerspective"</code>).
161 // public static String ID_BROWSING_PERSPECTIVE=
162 // "net.sourceforge.phpdt.ui.JavaBrowsingPerspective"; //$NON-NLS-1$
164 * The view part id of the Java Browsing Projects view (value
165 * <code>"net.sourceforge.phpdt.ui.ProjectsView"</code>).
169 // public static String ID_PROJECTS_VIEW=
170 // "net.sourceforge.phpdt.ui.ProjectsView"; //$NON-NLS-1$
172 * The view part id of the Java Browsing Packages view (value
173 * <code>"net.sourceforge.phpdt.ui.PackagesView"</code>).
177 // public static String ID_PACKAGES_VIEW=
178 // "net.sourceforge.phpdt.ui.PackagesView"; //$NON-NLS-1$
180 * The view part id of the Java Browsing Types view (value
181 * <code>"net.sourceforge.phpdt.ui.TypesView"</code>).
185 // public static String ID_TYPES_VIEW= "net.sourceforge.phpdt.ui.TypesView";
188 * The view part id of the Java Browsing Members view (value
189 * <code>"net.sourceforge.phpdt.ui.MembersView"</code>).
193 // public static String ID_MEMBERS_VIEW=
194 // "net.sourceforge.phpdt.ui.MembersView"; //$NON-NLS-1$
196 * The class org.eclipse.debug.core.model.IProcess allows attaching String
197 * properties to processes. The Java UI contributes a property page for
198 * IProcess that will show the contents of the property with this key. The
199 * intent of this property is to show the command line a process was
204 // public final static String ATTR_CMDLINE=
205 // "net.sourceforge.phpdt.ui.launcher.cmdLine"; //$NON-NLS-1$
207 * Returns the shared images for the Java UI.
209 * @return the shared images manager
211 public static ISharedImages getSharedImages() {
212 if (fgSharedImages == null)
213 fgSharedImages = new SharedImages();
215 return fgSharedImages;
219 * Creates a selection dialog that lists all packages of the given Java
220 * project. The caller is responsible for opening the dialog with
221 * <code>Window.open</code>, and subsequently extracting the selected
222 * package (of type <code>IPackageFragment</code>) via
223 * <code>SelectionDialog.getResult</code>.
226 * the parent shell of the dialog to be created
230 * flags defining the style of the dialog; the valid flags are:
231 * <code>IJavaElementSearchConstants.CONSIDER_BINARIES</code>,
232 * indicating that packages from binary package fragment roots
233 * should be included in addition to those from source package
235 * <code>IJavaElementSearchConstants.CONSIDER_REQUIRED_PROJECTS</code>,
236 * indicating that packages from required projects should be
239 * the initial pattern to filter the set of packages. For example
240 * "com" shows all packages starting with "com". The meta
241 * character '?' representing any character and '*' representing
242 * any string are supported. Clients can pass an empty string if
243 * no filtering is required.
244 * @return a new selection dialog
245 * @exception JavaModelException
246 * if the selection dialog could not be opened
250 // public static SelectionDialog createPackageDialog(Shell parent,
251 // IJavaProject project, int style, String filter) throws JavaModelException
253 // Assert.isTrue((style | IJavaElementSearchConstants.CONSIDER_BINARIES |
254 // IJavaElementSearchConstants.CONSIDER_REQUIRED_PROJECTS) ==
255 // (IJavaElementSearchConstants.CONSIDER_BINARIES |
256 // IJavaElementSearchConstants.CONSIDER_REQUIRED_PROJECTS));
258 // IPackageFragmentRoot[] roots= null;
259 // if ((style & IJavaElementSearchConstants.CONSIDER_REQUIRED_PROJECTS) !=
261 // roots= project.getAllPackageFragmentRoots();
263 // roots= project.getPackageFragmentRoots();
266 // List consideredRoots= null;
267 // if ((style & IJavaElementSearchConstants.CONSIDER_BINARIES) != 0) {
268 // consideredRoots= Arrays.asList(roots);
270 // consideredRoots= new ArrayList(roots.length);
271 // for (int i= 0; i < roots.length; i++) {
272 // IPackageFragmentRoot root= roots[i];
273 // if (root.getKind() != IPackageFragmentRoot.K_BINARY)
274 // consideredRoots.add(root);
279 // int flags= JavaElementLabelProvider.SHOW_DEFAULT;
280 // if (consideredRoots.size() > 1)
281 // flags= flags | JavaElementLabelProvider.SHOW_ROOT;
283 // List packages= new ArrayList();
284 // Iterator iter= consideredRoots.iterator();
285 // while(iter.hasNext()) {
286 // IPackageFragmentRoot root= (IPackageFragmentRoot)iter.next();
287 // packages.addAll(Arrays.asList(root.getChildren()));
289 // ElementListSelectionDialog dialog= new ElementListSelectionDialog(parent,
290 // new JavaElementLabelProvider(flags));
291 // dialog.setIgnoreCase(false);
292 // dialog.setElements(packages.toArray()); // XXX inefficient
293 // dialog.setFilter(filter);
297 * Creates a selection dialog that lists all packages of the given Java
298 * project. The caller is responsible for opening the dialog with
299 * <code>Window.open</code>, and subsequently extracting the selected
300 * package (of type <code>IPackageFragment</code>) via
301 * <code>SelectionDialog.getResult</code>.
304 * the parent shell of the dialog to be created
308 * flags defining the style of the dialog; the valid flags are:
309 * <code>IJavaElementSearchConstants.CONSIDER_BINARIES</code>,
310 * indicating that packages from binary package fragment roots
311 * should be included in addition to those from source package
313 * <code>IJavaElementSearchConstants.CONSIDER_REQUIRED_PROJECTS</code>,
314 * indicating that packages from required projects should be
316 * @return a new selection dialog
317 * @exception JavaModelException
318 * if the selection dialog could not be opened
320 // public static SelectionDialog createPackageDialog(Shell parent,
321 // IJavaProject project, int style) throws JavaModelException {
322 // return createPackageDialog(parent, project, style, ""); //$NON-NLS-1$
325 * Creates a selection dialog that lists all packages under the given
326 * package fragment root. The caller is responsible for opening the dialog
327 * with <code>Window.open</code>, and subsequently extracting the
328 * selected package (of type <code>IPackageFragment</code>) via
329 * <code>SelectionDialog.getResult</code>.
332 * the parent shell of the dialog to be created
334 * the package fragment root
336 * the initial pattern to filter the set of packages. For example
337 * "com" shows all packages starting with "com". The meta
338 * character '?' representing any character and '*' representing
339 * any string are supported. Clients can pass an empty string if
340 * no filtering is required.
341 * @return a new selection dialog
342 * @exception JavaModelException
343 * if the selection dialog could not be opened
347 // public static SelectionDialog createPackageDialog(Shell parent,
348 // IPackageFragmentRoot root, String filter) throws JavaModelException {
349 // ElementListSelectionDialog dialog= new ElementListSelectionDialog(parent,
350 // new JavaElementLabelProvider(JavaElementLabelProvider.SHOW_DEFAULT));
351 // dialog.setIgnoreCase(false);
352 // dialog.setElements(root.getChildren());
353 // dialog.setFilter(filter);
357 * Creates a selection dialog that lists all packages under the given
358 * package fragment root. The caller is responsible for opening the dialog
359 * with <code>Window.open</code>, and subsequently extracting the
360 * selected package (of type <code>IPackageFragment</code>) via
361 * <code>SelectionDialog.getResult</code>.
364 * the parent shell of the dialog to be created
366 * the package fragment root
367 * @return a new selection dialog
368 * @exception JavaModelException
369 * if the selection dialog could not be opened
371 // public static SelectionDialog createPackageDialog(Shell parent,
372 // IPackageFragmentRoot root) throws JavaModelException {
373 // return createPackageDialog(parent, root, ""); //$NON-NLS-1$
376 * Creates a selection dialog that lists all types in the given scope. The
377 * caller is responsible for opening the dialog with
378 * <code>Window.open</code>, and subsequently extracting the selected
379 * type(s) (of type <code>IType</code>) via
380 * <code>SelectionDialog.getResult</code>.
383 * the parent shell of the dialog to be created
385 * the runnable context used to show progress when the dialog is
388 * the scope that limits which types are included
390 * flags defining the style of the dialog; the only valid values
391 * are <code>IJavaElementSearchConstants.CONSIDER_CLASSES</code>,
392 * <code>CONSIDER_INTERFACES</code>, or their bitwise OR
393 * (equivalent to <code>CONSIDER_TYPES</code>)
394 * @param multipleSelection
395 * <code>true</code> if multiple selection is allowed
397 * the initial pattern to filter the set of types. For example
398 * "Abstract" shows all types starting with "abstract". The meta
399 * character '?' representing any character and '*' representing
400 * any string are supported. Clients can pass an empty string if
401 * no filtering is required.
402 * @exception JavaModelException
403 * if the selection dialog could not be opened
407 // public static SelectionDialog createTypeDialog(Shell parent,
408 // IRunnableContext context, IJavaSearchScope scope, int style, boolean
409 // multipleSelection, String filter) throws JavaModelException {
410 // int elementKinds= 0;
411 // if (style == IJavaElementSearchConstants.CONSIDER_TYPES) {
412 // elementKinds= IJavaSearchConstants.TYPE;
413 // } else if (style == IJavaElementSearchConstants.CONSIDER_INTERFACES) {
414 // elementKinds= IJavaSearchConstants.INTERFACE;
415 // } else if (style == IJavaElementSearchConstants.CONSIDER_CLASSES) {
416 // elementKinds= IJavaSearchConstants.CLASS;
418 // Assert.isTrue(false, "illegal style"); //$NON-NLS-1$
420 // if (multipleSelection) {
421 // MultiTypeSelectionDialog dialog= new MultiTypeSelectionDialog(parent,
422 // context, elementKinds, scope);
423 // dialog.setMessage(JavaUIMessages.getString("JavaUI.defaultDialogMessage"));
425 // dialog.setFilter(filter);
428 // TypeSelectionDialog dialog= new TypeSelectionDialog(parent, context,
429 // elementKinds, scope);
430 // dialog.setMessage(JavaUIMessages.getString("JavaUI.defaultDialogMessage"));
432 // dialog.setFilter(filter);
437 * Creates a selection dialog that lists all types in the given scope. The
438 * caller is responsible for opening the dialog with
439 * <code>Window.open</code>, and subsequently extracting the selected
440 * type(s) (of type <code>IType</code>) via
441 * <code>SelectionDialog.getResult</code>.
444 * the parent shell of the dialog to be created
446 * the runnable context used to show progress when the dialog is
449 * the scope that limits which types are included
451 * flags defining the style of the dialog; the only valid values
452 * are <code>IJavaElementSearchConstants.CONSIDER_CLASSES</code>,
453 * <code>CONSIDER_INTERFACES</code>, or their bitwise OR
454 * (equivalent to <code>CONSIDER_TYPES</code>)
455 * @param multipleSelection
456 * <code>true</code> if multiple selection is allowed
457 * @return a new selection dialog
458 * @exception JavaModelException
459 * if the selection dialog could not be opened
461 // public static SelectionDialog createTypeDialog(Shell parent,
462 // IRunnableContext context, IJavaSearchScope scope, int style, boolean
463 // multipleSelection) throws JavaModelException {
464 // return createTypeDialog(parent, context, scope, style, multipleSelection,
468 * Creates a selection dialog that lists all types in the given scope
469 * containing a standard <code>main</code> method. The caller is
470 * responsible for opening the dialog with <code>Window.open</code>, and
471 * subsequently extracting the selected type(s) (of type <code>IType</code>)
472 * via <code>SelectionDialog.getResult</code>.
475 * the parent shell of the dialog to be created
477 * the runnable context used to show progress when the dialog is
480 * the scope that limits which types are included
482 * flags defining the style of the dialog; the only valid values
483 * are <code>IJavaElementSearchConstants.CONSIDER_BINARIES</code>,
484 * <code>CONSIDER_EXTERNAL_JARS</code>, or their bitwise OR,
486 * @param multipleSelection
487 * <code>true</code> if multiple selection is allowed
489 * the initial pattern to filter the set of types containg a main
490 * method. For example "App" shows all types starting with "app".
491 * The meta character '?' representing any character and '*'
492 * representing any string are supported. Clients can pass an
493 * empty string if no filtering is required.
494 * @return a new selection dialog
498 // public static SelectionDialog createMainTypeDialog(Shell parent,
499 // IRunnableContext context, IJavaSearchScope scope, int style, boolean
500 // multipleSelection, String filter) {
501 // if (multipleSelection) {
502 // MultiMainTypeSelectionDialog dialog= new
503 // MultiMainTypeSelectionDialog(parent, context, scope, style);
504 // dialog.setFilter(filter);
507 // MainTypeSelectionDialog dialog= new MainTypeSelectionDialog(parent,
508 // context, scope, style);
509 // dialog.setFilter(filter);
514 * Creates a selection dialog that lists all types in the given scope
515 * containing a standard <code>main</code> method. The caller is
516 * responsible for opening the dialog with <code>Window.open</code>, and
517 * subsequently extracting the selected type(s) (of type <code>IType</code>)
518 * via <code>SelectionDialog.getResult</code>.
521 * the parent shell of the dialog to be created
523 * the runnable context used to show progress when the dialog is
526 * the scope that limits which types are included
528 * flags defining the style of the dialog; the only valid values
529 * are <code>IJavaElementSearchConstants.CONSIDER_BINARIES</code>,
530 * <code>CONSIDER_EXTERNAL_JARS</code>, or their bitwise OR,
532 * @param multipleSelection
533 * <code>true</code> if multiple selection is allowed
534 * @return a new selection dialog
536 // public static SelectionDialog createMainTypeDialog(Shell parent,
537 // IRunnableContext context, IJavaSearchScope scope, int style, boolean
538 // multipleSelection) {
539 // return createMainTypeDialog(parent, context, scope, style,
540 // multipleSelection, "");//$NON-NLS-1$
543 * Creates a selection dialog that lists all types in the given project. The
544 * caller is responsible for opening the dialog with
545 * <code>Window.open</code>, and subsequently extracting the selected
546 * type(s) (of type <code>IType</code>) via
547 * <code>SelectionDialog.getResult</code>.
550 * the parent shell of the dialog to be created
552 * the runnable context used to show progress when the dialog is
557 * flags defining the style of the dialog; the only valid values
558 * are <code>IJavaElementSearchConstants.CONSIDER_CLASSES</code>,
559 * <code>CONSIDER_INTERFACES</code>, or their bitwise OR
560 * (equivalent to <code>CONSIDER_TYPES</code>)
561 * @param multipleSelection
562 * <code>true</code> if multiple selection is allowed
563 * @return a new selection dialog
564 * @exception JavaModelException
565 * if the selection dialog could not be opened
567 // public static SelectionDialog createTypeDialog(Shell parent,
568 // IRunnableContext context, IProject project, int style, boolean
569 // multipleSelection) throws JavaModelException {
570 // IJavaSearchScope scope= SearchEngine.createJavaSearchScope(new
571 // IJavaProject[] { JavaCore.create(project) });
572 // return createTypeDialog(parent, context, scope, style,
573 // multipleSelection);
576 * Opens a Java editor on the given Java element. The element can be a
577 * compilation unit or class file. If there already is an open Java editor
578 * for the given element, it is returned.
581 * the input element; either a compilation unit (<code>ICompilationUnit</code>)
582 * or a class file (</code>IClassFile</code>)
583 * @return the editor, or </code>null</code> if wrong element type or
585 * @exception PartInitException
586 * if the editor could not be initialized
587 * @exception JavaModelException
588 * if this element does not exist or if an exception occurs
589 * while accessing its underlying resource
591 public static IEditorPart openInEditor(IJavaElement element)
592 throws JavaModelException, PartInitException {
593 return EditorUtility.openInEditor(element);
597 * Reveals the source range of the given source reference element in the
598 * given editor. No checking is done if the editor displays a compilation
599 * unit or class file that contains the given source reference. The editor
600 * simply reveals the source range denoted by the given source reference.
603 * the editor displaying the compilation unit or class file
605 * the source reference element defining the source range to be
608 * @deprecated use <code>revealInEditor(IEditorPart, IJavaElement)</code>
611 // public static void revealInEditor(IEditorPart part, ISourceReference
613 // if (element instanceof IJavaElement)
614 // revealInEditor(part, (IJavaElement) element);
617 * Reveals the given java element in the given editor. If the element is not
618 * an instance of <code>ISourceReference</code> this method result in a
619 * NOP. If it is a source reference no checking is done if the editor
620 * displays a compilation unit or class file that contains the source
621 * reference element. The editor simply reveals the source range denoted by
625 * the editor displaying a compilation unit or class file
627 * the element to be revealed
631 // public static void revealInEditor(IEditorPart part, IJavaElement element)
633 // EditorUtility.revealInEditor(part, element);
636 * Returns the working copy manager for the Java UI plug-in.
638 * @return the working copy manager for the Java UI plug-in
640 public static IWorkingCopyManager getWorkingCopyManager() {
641 return WebUI.getDefault().getWorkingCopyManager();
645 * Answers the shared working copies currently registered for the Java
646 * plug-in. Note that the returned array can include working copies that are
647 * not on the class path of a Java project.
649 * @return the list of shared working copies
651 * @see net.sourceforge.phpdt.core.JavaCore#getSharedWorkingCopies(net.sourceforge.phpdt.core.IBufferFactory)
654 public static IWorkingCopy[] getSharedWorkingCopies() {
655 return JavaCore.getSharedWorkingCopies(getBufferFactory());
659 * Answers the shared working copies that are on the class path of a Java
660 * project currently registered for the Java plug-in.
663 * @return the list of shared working copies
665 * @see #getSharedWorkingCopies()
668 // public static IWorkingCopy[] getSharedWorkingCopiesOnClasspath() {
669 // IWorkingCopy[] wcs= getSharedWorkingCopies();
670 // List result= new ArrayList(wcs.length);
671 // for (int i = 0; i < wcs.length; i++) {
672 // IWorkingCopy wc= wcs[i];
673 // if (wc instanceof IJavaElement) {
674 // IJavaElement je= (IJavaElement)wc;
675 // if (je.getJavaProject().isOnClasspath(je)) {
680 // return (IWorkingCopy[])result.toArray(new IWorkingCopy[result.size()]);
683 * Returns the BufferFactory for the Java UI plug-in.
685 * @return the BufferFactory for the Java UI plug-in
687 * @see net.sourceforge.phpdt.core.IBufferFactory
689 * @deprecated {@link IBufferFactory} has been replaced by
690 * {@link net.sourceforge.phpdt.core.WorkingCopyOwner}. The
691 * Java UI plug-in uses the <i>primary working copy owner</i>
692 * that can be accessed with <code>null</code> in API's that
695 public static IBufferFactory getBufferFactory() {
696 return PHPeclipsePlugin.getDefault().getBufferFactory();
700 * Returns the DocumentProvider used for Java compilation units.
702 * @return the DocumentProvider for Java compilation units.
704 * @see IDocumentProvider
707 public static IDocumentProvider getDocumentProvider() {
708 return WebUI.getDefault()
709 .getCompilationUnitDocumentProvider();
713 * Sets the Javadoc location for an archive with the given path.
716 * the path of the library; this can be an workspace path or an
717 * external path in case of an external library.
719 * The Javadoc location to set. This location should contain
720 * index.html and a file 'package-list'. <code>null</code>
721 * clears the current documentation location.
725 // public static void setLibraryJavadocLocation(IPath archivePath, URL url)
727 // JavaDocLocations.setLibraryJavadocLocation(archivePath, url);
730 * Returns the Javadoc location for an archive or <code>null</code> if no
731 * location is available.
734 * the path of the library. This can be an workspace path or an
735 * external path in case of an external library.
739 // public static URL getLibraryJavadocLocation(IPath archivePath) {
740 // return JavaDocLocations.getLibraryJavadocLocation(archivePath);
743 * Sets the Javadoc location for a Java project. This location is used for
744 * all types located in the project's source folders.
749 * The Javadoc location to set. This location should contain
750 * index.html and a file 'package-list'. <code>null</code>
751 * clears the current documentation location.
755 // public static void setProjectJavadocLocation(IJavaProject project, URL
757 // JavaDocLocations.setProjectJavadocLocation(project, url);
760 * Returns the Javadoc location for a Java project or <code>null</code> if
761 * no location is available. This location is used for all types located in
762 * the project's source folders.
769 // public static URL getProjectJavadocLocation(IJavaProject project) {
770 // return JavaDocLocations.getProjectJavadocLocation(project);
773 * Returns the Javadoc base URL for an element. The base location contains
774 * the index file. This location doesn't have to exist. Returns
775 * <code>null</code> if no javadoc location has been attached to the
776 * element's library or project. Example of a returned URL is <i>http://www.
777 * junit. org/junit/javadoc</i>.
780 * element for which the doc URL is requested.
784 // public static URL getJavadocBaseLocation(IJavaElement element) throws
785 // JavaModelException {
786 // return JavaDocLocations.getJavadocBaseLocation(element);
789 * Returns the Javadoc URL for an element. Example of a returned URL is
790 * <i>http://www.junit.org/junit/javadoc/junit/extensions/TestSetup.html</i>.
791 * This returned location doesn't have to exist. Returns <code>null</code>
792 * if no javadoc location has been attached to the element's library or
796 * element for which the doc URL is requested.
797 * @param includeAnchor
798 * If set, the URL contains an anchor for member references:
799 * <i>http://www.junit.org/junit/javadoc/junit/extensions/TestSetup.html#run(junit.framework.TestResult)</i>.
800 * Note that this involves type resolving and is a more expensive
801 * call than without anchor.
805 // public static URL getJavadocLocation(IJavaElement element, boolean
806 // includeAnchor) throws JavaModelException {
807 // return JavaDocLocations.getJavadocLocation(element, includeAnchor);