EMMA Coverage Report (generated Mon Sep 29 15:05:28 EDT 2008)
[all classes][org.eclipse.ui.views.properties]

COVERAGE SUMMARY FOR SOURCE FILE [PropertySheetPage.java]

nameclass, %method, %block, %line, %
PropertySheetPage.java100% (7/7)68%  (26/38)67%  (499/742)62%  (122.7/199)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class PropertySheetPage$2100% (1/1)33%  (1/3)7%   (6/82)7%   (2/28)
getFirstContext (Object, HelpEvent): Object 0%   (0/1)0%   (0/21)0%   (0/7)
helpRequested (HelpEvent): void 0%   (0/1)0%   (0/55)0%   (0/19)
PropertySheetPage$2 (PropertySheetPage): void 100% (1/1)100% (6/6)100% (2/2)
     
class PropertySheetPage$3100% (1/1)33%  (1/3)23%  (6/26)25%  (2/8)
cellEditorActivated (CellEditor): void 0%   (0/1)0%   (0/10)0%   (0/3)
cellEditorDeactivated (CellEditor): void 0%   (0/1)0%   (0/10)0%   (0/3)
PropertySheetPage$3 (PropertySheetPage): void 100% (1/1)100% (6/6)100% (2/2)
     
class PropertySheetPage$5100% (1/1)50%  (1/2)29%  (7/24)40%  (2/5)
run (): void 0%   (0/1)0%   (0/17)0%   (0/3)
PropertySheetPage$5 (PropertySheetPage, String): void 100% (1/1)100% (7/7)100% (2/2)
     
class PropertySheetPage$4100% (1/1)33%  (1/3)50%  (6/12)40%  (2/5)
dragFinished (DragSourceEvent): void 0%   (0/1)0%   (0/1)0%   (0/1)
dragSetData (DragSourceEvent): void 0%   (0/1)0%   (0/5)0%   (0/2)
PropertySheetPage$4 (PropertySheetPage): void 100% (1/1)100% (6/6)100% (2/2)
     
class PropertySheetPage100% (1/1)74%  (14/19)77%  (426/550)74%  (109.7/148)
performDragSetData (DragSourceEvent): void 0%   (0/1)0%   (0/36)0%   (0/12)
refresh (): void 0%   (0/1)0%   (0/11)0%   (0/4)
setPropertySourceProvider (IPropertySourceProvider): void 0%   (0/1)0%   (0/19)0%   (0/6)
setRootEntry (IPropertySheetEntry): void 0%   (0/1)0%   (0/12)0%   (0/4)
setSorter (PropertySheetSorter): void 0%   (0/1)0%   (0/20)0%   (0/6)
handleEntrySelection (ISelection): void 100% (1/1)46%  (11/24)57%  (4/7)
getAdapter (Class): Object 100% (1/1)74%  (17/23)89%  (2.7/3)
getControl (): Control 100% (1/1)78%  (7/9)67%  (2/3)
createControl (Composite): void 100% (1/1)95%  (83/87)95%  (19/20)
selectionChanged (IWorkbenchPart, ISelection): void 100% (1/1)98%  (39/40)91%  (10/11)
PropertySheetPage (): void 100% (1/1)100% (10/10)100% (3/3)
dispose (): void 100% (1/1)100% (31/31)100% (10/10)
getCellEditorActivationListener (): ICellEditorActivationListener 100% (1/1)100% (12/12)100% (3/3)
getSaveablePart (): ISaveablePart 100% (1/1)100% (10/10)100% (3/3)
initDragAndDrop (): void 100% (1/1)100% (29/29)100% (8/8)
makeActions (): void 100% (1/1)100% (127/127)100% (31/31)
makeContributions (IMenuManager, IToolBarManager, IStatusLineManager): void 100% (1/1)100% (29/29)100% (8/8)
setActionBars (IActionBars): void 100% (1/1)100% (15/15)100% (4/4)
setFocus (): void 100% (1/1)100% (6/6)100% (2/2)
     
class PropertySheetPage$1100% (1/1)100% (2/2)100% (12/12)100% (4/4)
PropertySheetPage$1 (PropertySheetPage): void 100% (1/1)100% (6/6)100% (2/2)
selectionChanged (SelectionChangedEvent): void 100% (1/1)100% (6/6)100% (2/2)
     
class PropertySheetPage$PartListener100% (1/1)100% (6/6)100% (36/36)100% (10/10)
PropertySheetPage$PartListener (PropertySheetPage): void 100% (1/1)100% (6/6)100% (1/1)
partActivated (IWorkbenchPart): void 100% (1/1)100% (1/1)100% (1/1)
partBroughtToTop (IWorkbenchPart): void 100% (1/1)100% (1/1)100% (1/1)
partClosed (IWorkbenchPart): void 100% (1/1)100% (26/26)100% (5/5)
partDeactivated (IWorkbenchPart): void 100% (1/1)100% (1/1)100% (1/1)
partOpened (IWorkbenchPart): void 100% (1/1)100% (1/1)100% (1/1)

1/*******************************************************************************
2 * Copyright (c) 2000, 2008 IBM Corporation and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 *     IBM Corporation - initial API and implementation
10 *     Gunnar Wagenknecht - fix for bug 21756 [PropertiesView] property view sorting
11 *******************************************************************************/
12 
13package org.eclipse.ui.views.properties;
14 
15import org.eclipse.help.IContext;
16 
17import org.eclipse.swt.dnd.Clipboard;
18import org.eclipse.swt.dnd.DND;
19import org.eclipse.swt.dnd.DragSource;
20import org.eclipse.swt.dnd.DragSourceAdapter;
21import org.eclipse.swt.dnd.DragSourceEvent;
22import org.eclipse.swt.dnd.DragSourceListener;
23import org.eclipse.swt.dnd.TextTransfer;
24import org.eclipse.swt.dnd.Transfer;
25import org.eclipse.swt.events.HelpEvent;
26import org.eclipse.swt.events.HelpListener;
27import org.eclipse.swt.widgets.Composite;
28import org.eclipse.swt.widgets.Control;
29import org.eclipse.swt.widgets.Menu;
30import org.eclipse.swt.widgets.Shell;
31import org.eclipse.swt.widgets.Tree;
32 
33import org.eclipse.core.runtime.IAdaptable;
34 
35import org.eclipse.jface.action.Action;
36import org.eclipse.jface.action.IMenuManager;
37import org.eclipse.jface.action.IStatusLineManager;
38import org.eclipse.jface.action.IToolBarManager;
39import org.eclipse.jface.action.MenuManager;
40import org.eclipse.jface.action.Separator;
41import org.eclipse.jface.internal.ConfigureColumnsDialog;
42import org.eclipse.jface.viewers.CellEditor;
43import org.eclipse.jface.viewers.ISelection;
44import org.eclipse.jface.viewers.ISelectionChangedListener;
45import org.eclipse.jface.viewers.IStructuredSelection;
46import org.eclipse.jface.viewers.SelectionChangedEvent;
47import org.eclipse.jface.window.SameShellProvider;
48 
49import org.eclipse.ui.IActionBars;
50import org.eclipse.ui.IPartListener;
51import org.eclipse.ui.ISaveablePart;
52import org.eclipse.ui.ISharedImages;
53import org.eclipse.ui.IWorkbenchPart;
54import org.eclipse.ui.PlatformUI;
55import org.eclipse.ui.help.IContextComputer;
56import org.eclipse.ui.help.IWorkbenchHelpSystem;
57import org.eclipse.ui.internal.views.ViewsPlugin;
58import org.eclipse.ui.internal.views.properties.PropertiesMessages;
59import org.eclipse.ui.part.CellEditorActionHandler;
60import org.eclipse.ui.part.Page;
61 
62/**
63 * The standard implementation of property sheet page which presents
64 * a table of property names and values obtained from the current selection
65 * in the active workbench part.
66 * <p>
67 * This page obtains the information about what properties to display from
68 * the current selection (which it tracks).
69 * </p>
70 * <p>
71 * The model for this page is a hierarchy of <code>IPropertySheetEntry</code>.
72 * The page may be configured with a custom model by setting the root entry.
73 * <p>
74 * If no root entry is set then a default model is created which uses the
75 * <code>IPropertySource</code> interface to obtain the properties of
76 * the current selection. This requires that the selected objects provide an
77 * <code>IPropertySource</code> adapter (or implement
78 * <code>IPropertySource</code> directly). This restiction can be overcome
79 * by providing this page with an <code>IPropertySourceProvider</code>. If
80 * supplied, this provider will be used by the default model to obtain a
81 * property source for the current selection
82 * </p>
83 * <p>
84 * This class may be instantiated; it is not intended to be subclassed.
85 * </p>
86 *
87 * @see IPropertySource
88 * @noextend This class is not intended to be subclassed by clients.
89 */
90public class PropertySheetPage extends Page implements IPropertySheetPage, IAdaptable {
91    /**
92     * Help context id
93     * (value <code>"org.eclipse.ui.property_sheet_page_help_context"</code>).
94     */
95    public static final String HELP_CONTEXT_PROPERTY_SHEET_PAGE = "org.eclipse.ui.property_sheet_page_help_context"; //$NON-NLS-1$
96 
97    private PropertySheetViewer viewer;
98    
99    private PropertySheetSorter sorter;
100 
101    private IPropertySheetEntry rootEntry;
102 
103    private IPropertySourceProvider provider;
104 
105    private DefaultsAction defaultsAction;
106 
107    private FilterAction filterAction;
108 
109    private CategoriesAction categoriesAction;
110 
111    private CopyPropertyAction copyAction;
112 
113    private ICellEditorActivationListener cellEditorActivationListener;
114 
115    private CellEditorActionHandler cellEditorActionHandler;
116 
117    private Clipboard clipboard;
118 
119        private IWorkbenchPart sourcePart;
120 
121        /**
122         * Part listener which cleans up this page when the source part is closed.
123         * This is hooked only when there is a source part.
124         * 
125         * @since 3.2
126         */
127        private class PartListener implements IPartListener {
128                public void partActivated(IWorkbenchPart part) {
129                }
130 
131                public void partBroughtToTop(IWorkbenchPart part) {
132                }
133 
134                public void partClosed(IWorkbenchPart part) {
135                        if (sourcePart == part) {
136                                sourcePart = null;
137                                if (viewer != null && !viewer.getControl().isDisposed()) {
138                                        viewer.setInput(new Object[0]);
139                                }
140                        }
141                }
142 
143                public void partDeactivated(IWorkbenchPart part) {
144                }
145 
146                public void partOpened(IWorkbenchPart part) {
147                }
148        }
149        
150        private PartListener partListener = new PartListener();
151 
152        private Action columnsAction;
153        
154    /**
155     * Creates a new property sheet page.
156     */
157    public PropertySheetPage() {
158        super();
159    }
160 
161    /* (non-Javadoc)
162     * Method declared on <code>IPage</code>.
163     */
164    public void createControl(Composite parent) {
165        // create a new viewer
166        viewer = new PropertySheetViewer(parent);
167        viewer.setSorter(sorter);
168        
169        // set the model for the viewer
170        if (rootEntry == null) {
171            // create a new root
172            PropertySheetEntry root = new PropertySheetEntry();
173            if (provider != null) {
174                                // set the property source provider
175                root.setPropertySourceProvider(provider);
176                        }
177            rootEntry = root;
178        }
179        viewer.setRootEntry(rootEntry);
180        viewer.addActivationListener(getCellEditorActivationListener());
181        // add a listener to track when the entry selection changes
182        viewer.addSelectionChangedListener(new ISelectionChangedListener() {
183            public void selectionChanged(SelectionChangedEvent event) {
184                handleEntrySelection(event.getSelection());
185            }
186        });
187        initDragAndDrop();
188        makeActions();
189 
190        // Create the popup menu for the page.
191        MenuManager menuMgr = new MenuManager("#PopupMenu"); //$NON-NLS-1$
192        menuMgr.add(copyAction);
193        menuMgr.add(new Separator());
194        menuMgr.add(defaultsAction);
195        Menu menu = menuMgr.createContextMenu(viewer.getControl());
196        viewer.getControl().setMenu(menu);
197 
198        // Set help on the viewer
199        viewer.getControl().addHelpListener(new HelpListener() {
200            /*
201             * @see HelpListener#helpRequested(HelpEvent)
202             */
203            public void helpRequested(HelpEvent e) {
204                // Get the context for the selected item
205                IStructuredSelection selection = (IStructuredSelection) viewer
206                        .getSelection();
207                if (!selection.isEmpty()) {
208                    IPropertySheetEntry entry = (IPropertySheetEntry) selection
209                            .getFirstElement();
210                    Object helpContextId = entry.getHelpContextIds();
211                    if (helpContextId != null) {
212                            IWorkbenchHelpSystem helpSystem = PlatformUI.getWorkbench().getHelpSystem();
213                            
214                        // Since 2.0 the only valid type for helpContextIds
215                        // is a String (a single id).
216                        if (helpContextId instanceof String) {
217                            helpSystem.displayHelp((String) helpContextId);
218                            return;
219                        }
220 
221                        // For backward compatibility we have to handle
222                        // and array of contexts (Strings and/or IContexts)
223                        // or a context computer.
224                        Object context= getFirstContext(helpContextId, e);
225                        if (context instanceof IContext) {
226                                                        helpSystem.displayHelp((IContext) context);
227                                                } else if (context instanceof String) {
228                                                        helpSystem.displayHelp((String) context);
229                                                }
230                        return;
231                    }
232                }
233 
234                // No help for the selection so show page help
235                PlatformUI.getWorkbench().getHelpSystem().displayHelp(HELP_CONTEXT_PROPERTY_SHEET_PAGE);
236            }
237 
238                        /**
239                         * Returns the first help context.
240                         * 
241                         * @param helpContext the help context which is either an array of contexts (strings
242                         *            and/or {@linkplain IContext}s) or an {@link IContextComputer}
243                         * 
244                         * @param e the help event
245                         * @return the first context which is either a <code>String</code>, {@link IContext} or
246                         *         <code>null</code> if none
247                         * @deprecated As of 2.0, nested contexts are no longer supported by the help support
248                         *             system
249                         */
250                        private Object getFirstContext(Object helpContext, HelpEvent e) {
251                                Object[] contexts;
252                                if (helpContext instanceof IContextComputer) {
253                                    // get local contexts
254                                        contexts= ((IContextComputer)helpContext)
255                                            .getLocalContexts(e);
256                                } else {
257                                        contexts= (Object[])helpContext;
258                                }
259 
260                                if (contexts.length > 0)
261                                        return contexts[0];
262                                return null;
263                        }
264        });
265    }
266 
267    /**
268     * The <code>PropertySheetPage</code> implementation of this <code>IPage</code> method
269     * disposes of this page's entries.
270     */
271    public void dispose() {
272        super.dispose();
273        if (sourcePart != null) {
274                sourcePart.getSite().getPage().removePartListener(partListener);
275        }
276        if (rootEntry != null) {
277            rootEntry.dispose();
278            rootEntry = null;
279        }
280        if (clipboard != null) {
281            clipboard.dispose();
282            clipboard = null;
283        }
284    }
285 
286    /**
287     * The <code>PropertySheetPage</code> implementation of this <code>IAdaptable</code> method
288     * handles the <code>ISaveablePart</code> adapter by delegating to the source part.
289     * 
290     * @since 3.2
291     */
292    public Object getAdapter(Class adapter) {
293                if (ISaveablePart.class.equals(adapter)) {
294                        return getSaveablePart();
295                }
296            return null;
297    }
298    
299        /**
300         * Returns an <code>ISaveablePart</code> that delegates to the source part
301         * for the current page if it implements <code>ISaveablePart</code>, or
302         * <code>null</code> otherwise.
303         * 
304         * @return an <code>ISaveablePart</code> or <code>null</code>
305         * @since 3.2
306         */
307        protected ISaveablePart getSaveablePart() {
308                if (sourcePart instanceof ISaveablePart) {
309                        return (ISaveablePart) sourcePart;
310                }
311                return null;
312        }
313    
314    /**
315     * Returns the cell editor activation listener for this page
316     * @return ICellEditorActivationListener the cell editor activation listener for this page
317     */
318    private ICellEditorActivationListener getCellEditorActivationListener() {
319        if (cellEditorActivationListener == null) {
320            cellEditorActivationListener = new ICellEditorActivationListener() {
321                public void cellEditorActivated(CellEditor cellEditor) {
322                    if (cellEditorActionHandler != null) {
323                                                cellEditorActionHandler.addCellEditor(cellEditor);
324                                        }
325                }
326 
327                public void cellEditorDeactivated(CellEditor cellEditor) {
328                    if (cellEditorActionHandler != null) {
329                                                cellEditorActionHandler.removeCellEditor(cellEditor);
330                                        }
331                }
332            };
333        }
334        return cellEditorActivationListener;
335    }
336 
337    /* (non-Javadoc)
338     * Method declared on IPage (and Page).
339     */
340    public Control getControl() {
341        if (viewer == null) {
342                        return null;
343                }
344        return viewer.getControl();
345    }
346 
347    /**
348     * Handles a selection change in the entry table.
349     *
350     * @param selection the new selection
351     */
352    public void handleEntrySelection(ISelection selection) {
353        if (defaultsAction != null) {
354            if (selection.isEmpty()) {
355                defaultsAction.setEnabled(false);
356                return;
357            }
358            // see if item is editable
359            boolean editable = viewer.getActiveCellEditor() != null;
360            defaultsAction.setEnabled(editable);
361        }
362    }
363 
364    /**
365     * Adds drag and drop support.
366     */
367    protected void initDragAndDrop() {
368        int operations = DND.DROP_COPY;
369        Transfer[] transferTypes = new Transfer[] { TextTransfer.getInstance() };
370        DragSourceListener listener = new DragSourceAdapter() {
371            public void dragSetData(DragSourceEvent event) {
372                performDragSetData(event);
373            }
374 
375            public void dragFinished(DragSourceEvent event) {
376                //Nothing to do here
377            }
378        };
379        DragSource dragSource = new DragSource(
380                viewer.getControl(), operations);
381        dragSource.setTransfer(transferTypes);
382        dragSource.addDragListener(listener);
383    }
384 
385    /**
386     * The user is attempting to drag.  Add the appropriate
387     * data to the event.
388     * @param event The event sent from the drag and drop support.
389     */
390    void performDragSetData(DragSourceEvent event) {
391        // Get the selected property
392        IStructuredSelection selection = (IStructuredSelection) viewer
393                .getSelection();
394        if (selection.isEmpty()) {
395                        return;
396                }
397        // Assume single selection
398        IPropertySheetEntry entry = (IPropertySheetEntry) selection
399                .getFirstElement();
400 
401        // Place text as the data
402        StringBuffer buffer = new StringBuffer();
403        buffer.append(entry.getDisplayName());
404        buffer.append("\t"); //$NON-NLS-1$
405        buffer.append(entry.getValueAsString());
406 
407        event.data = buffer.toString();
408    }
409 
410    /**
411     * Make action objects.
412     */
413    private void makeActions() {
414        ISharedImages sharedImages = PlatformUI.getWorkbench()
415                .getSharedImages();
416 
417        // Restore Default Value
418        defaultsAction = new DefaultsAction(viewer, "defaults"); //$NON-NLS-1$
419        defaultsAction.setText(PropertiesMessages.Defaults_text);
420        defaultsAction.setToolTipText(PropertiesMessages.Defaults_toolTip);
421        defaultsAction
422                .setImageDescriptor(ViewsPlugin.getViewImageDescriptor("elcl16/defaults_ps.gif")); //$NON-NLS-1$
423        defaultsAction
424                .setDisabledImageDescriptor(ViewsPlugin.getViewImageDescriptor("dlcl16/defaults_ps.gif")); //$NON-NLS-1$
425        defaultsAction.setEnabled(false);
426 
427        // Show Advanced Properties
428        filterAction = new FilterAction(viewer, "filter"); //$NON-NLS-1$
429        filterAction.setText(PropertiesMessages.Filter_text);
430        filterAction.setToolTipText(PropertiesMessages.Filter_toolTip);
431        filterAction
432                .setImageDescriptor(ViewsPlugin.getViewImageDescriptor("elcl16/filter_ps.gif")); //$NON-NLS-1$
433        filterAction.setChecked(false);
434 
435        // Show Categories
436        categoriesAction = new CategoriesAction(viewer, "categories"); //$NON-NLS-1$
437        categoriesAction.setText(PropertiesMessages.Categories_text);
438        categoriesAction.setToolTipText(PropertiesMessages.Categories_toolTip);
439        categoriesAction
440                .setImageDescriptor(ViewsPlugin.getViewImageDescriptor("elcl16/tree_mode.gif")); //$NON-NLS-1$
441        categoriesAction.setChecked(true);
442 
443        // Columns...
444        columnsAction = new Action(PropertiesMessages.Columns_text){
445                public void run() {
446                        Tree tree = (Tree) viewer.getControl();
447                        new ConfigureColumnsDialog(new SameShellProvider(tree), tree).open();
448                }
449                };
450        columnsAction.setToolTipText(PropertiesMessages.Columns_toolTip);
451        
452        // Copy
453        Shell shell = viewer.getControl().getShell();
454        clipboard = new Clipboard(shell.getDisplay());
455        copyAction = new CopyPropertyAction(viewer, "copy", clipboard); //$NON-NLS-1$
456        copyAction.setText(PropertiesMessages.CopyProperty_text);
457        copyAction.setImageDescriptor(sharedImages
458                .getImageDescriptor(ISharedImages.IMG_TOOL_COPY));
459    }
460 
461    /* (non-Javadoc)
462     * Method declared on IPage (and Page).
463     */
464    public void makeContributions(IMenuManager menuManager,
465            IToolBarManager toolBarManager, IStatusLineManager statusLineManager) {
466 
467        // add actions to the tool bar
468        toolBarManager.add(categoriesAction);
469        toolBarManager.add(filterAction);
470        toolBarManager.add(defaultsAction);
471 
472        // add actions to the menu
473        menuManager.add(categoriesAction);
474        menuManager.add(filterAction);
475        menuManager.add(columnsAction);
476 
477        // set status line manager into the viewer
478        viewer.setStatusLineManager(statusLineManager);
479    }
480 
481    /**
482     * Updates the model for the viewer.
483     * <p>
484     * Note that this means ensuring that the model reflects the state
485     * of the current viewer input.
486     * </p>
487     */
488    public void refresh() {
489        if (viewer == null) {
490                        return;
491                }
492        // calling setInput on the viewer will cause the model to refresh
493        viewer.setInput(viewer.getInput());
494    }
495 
496    /* (non-Javadoc)
497     * Method declared on ISelectionListener.
498     */
499    public void selectionChanged(IWorkbenchPart part, ISelection selection) {
500        if (viewer == null) {
501                        return;
502                }
503 
504        if (sourcePart != null) {
505                sourcePart.getSite().getPage().removePartListener(partListener);
506                sourcePart = null;
507        }
508        
509        // change the viewer input since the workbench selection has changed.
510        if (selection instanceof IStructuredSelection) {
511                sourcePart = part;
512            viewer.setInput(((IStructuredSelection) selection).toArray());
513        }
514 
515        if (sourcePart != null) {
516                sourcePart.getSite().getPage().addPartListener(partListener);
517        }
518    }
519 
520    /**
521     * The <code>PropertySheetPage</code> implementation of this <code>IPage</code> method
522     * calls <code>makeContributions</code> for backwards compatibility with
523     * previous versions of <code>IPage</code>.
524     * <p>
525     * Subclasses may reimplement.
526     * </p>
527     */
528    public void setActionBars(IActionBars actionBars) {
529        super.setActionBars(actionBars);
530        cellEditorActionHandler = new CellEditorActionHandler(actionBars);
531        cellEditorActionHandler.setCopyAction(copyAction);
532    }
533 
534    /**
535     * Sets focus to a part in the page.
536     */
537    public void setFocus() {
538        viewer.getControl().setFocus();
539    }
540 
541    /**
542     * Sets the given property source provider as
543     * the property source provider.
544     * <p>
545     * Calling this method is only valid if you are using
546     * this page's default root entry.
547     * </p>
548     * @param newProvider the property source provider
549     */
550    public void setPropertySourceProvider(IPropertySourceProvider newProvider) {
551        provider = newProvider;
552        if (rootEntry instanceof PropertySheetEntry) {
553            ((PropertySheetEntry) rootEntry)
554                    .setPropertySourceProvider(provider);
555            // the following will trigger an update
556            viewer.setRootEntry(rootEntry);
557        }
558    }
559 
560    /**
561     * Sets the given entry as the model for the page.
562     *
563     * @param entry the root entry
564     */
565    public void setRootEntry(IPropertySheetEntry entry) {
566        rootEntry = entry;
567        if (viewer != null) {
568                        // the following will trigger an update
569            viewer.setRootEntry(rootEntry);
570                }
571    }
572 
573    /**
574         * Sets the sorter used for sorting categories and entries in the viewer
575         * of this page.
576         * <p>
577         * The default sorter sorts categories and entries alphabetically.
578         * </p>
579         * @param sorter the sorter to set (<code>null</code> will reset to the
580         * default sorter)
581     * @since 3.1
582         */
583        protected void setSorter(PropertySheetSorter sorter) {
584                this.sorter = sorter;
585        if (viewer != null) {
586                viewer.setSorter(sorter);
587                
588                // the following will trigger an update
589                if(null != viewer.getRootEntry()) {
590                                viewer.setRootEntry(rootEntry);
591                        }
592        }
593        }
594 
595}

[all classes][org.eclipse.ui.views.properties]
EMMA 2.0.5312 EclEmma Fix 1 (C) Vladimir Roubtsov