View | Details | Raw Unified | Return to bug 341685 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/mat/ui/MemoryAnalyserPlugin.java (-2 / +76 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2008, 2010 SAP AG and others.
2
 * Copyright (c) 2008, 2011 SAP AG and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 11-16 Link Here
11
 *******************************************************************************/
11
 *******************************************************************************/
12
package org.eclipse.mat.ui;
12
package org.eclipse.mat.ui;
13
13
14
import java.io.File;
14
import java.net.URI;
15
import java.net.URI;
15
import java.net.URISyntaxException;
16
import java.net.URISyntaxException;
16
import java.net.URL;
17
import java.net.URL;
Lines 116-121 Link Here
116
    private ErrorLogHandler errorLogHandler;
117
    private ErrorLogHandler errorLogHandler;
117
    private boolean useParentHandlers;
118
    private boolean useParentHandlers;
118
119
120
    // Mappings to permit textual descriptions of Images to be recovered from Images.
121
    // TODO - clean out these maps when the plugin is disabled
122
    private Map<Image, String> imageTextMap = new HashMap<Image, String>(20);
123
    private Map<ImageDescriptor, String> descriptorTextMap = new HashMap<ImageDescriptor, String>(20);
124
119
    public MemoryAnalyserPlugin()
125
    public MemoryAnalyserPlugin()
120
    {
126
    {
121
    }
127
    }
Lines 146-151 Link Here
146
        for (Image image : imageCache.values())
152
        for (Image image : imageCache.values())
147
            image.dispose();
153
            image.dispose();
148
        imageCache.clear();
154
        imageCache.clear();
155
        // Clear mappings from Image/Descriptor to descriptive text.
156
        imageTextMap.clear();
157
        descriptorTextMap.clear();
149
158
150
        logger.removeHandler(errorLogHandler);
159
        logger.removeHandler(errorLogHandler);
151
        logger.setUseParentHandlers(useParentHandlers);
160
        logger.setUseParentHandlers(useParentHandlers);
Lines 166-172 Link Here
166
175
167
    public static ImageDescriptor getImageDescriptor(String path)
176
    public static ImageDescriptor getImageDescriptor(String path)
168
    {
177
    {
169
        return AbstractUIPlugin.imageDescriptorFromPlugin(PLUGIN_ID, path);
178
        // Use singleton instance so that ImageDescriptor can be mapped to text.
179
        return MemoryAnalyserPlugin.getDefault().getPluginImageDescriptor(path);
170
    }
180
    }
171
181
172
    public static Image getImage(String name)
182
    public static Image getImage(String name)
Lines 174-179 Link Here
174
        return MemoryAnalyserPlugin.getDefault().getImage(getImageDescriptor(name));
184
        return MemoryAnalyserPlugin.getDefault().getImage(getImageDescriptor(name));
175
    }
185
    }
176
186
187
    private ImageDescriptor getPluginImageDescriptor(String path)
188
    {
189
        ImageDescriptor descriptor = AbstractUIPlugin.imageDescriptorFromPlugin(PLUGIN_ID, path);
190
        if (descriptor != null)
191
        { // Add map entry for new descriptor to appropriate text.
192
            // This should not result in a memory leak, assuming that two
193
            // equivalent ImageDescriptors match under equals().
194
            // This is already assumed in the usage of imageCache.
195
            descriptorTextMap.put(descriptor, getIconString(path));
196
        }
197
        return descriptor;
198
    }
199
177
    public Image getImage(ImageDescriptor descriptor)
200
    public Image getImage(ImageDescriptor descriptor)
178
    {
201
    {
179
        Image image = imageCache.get(descriptor);
202
        Image image = imageCache.get(descriptor);
Lines 181-186 Link Here
181
        {
204
        {
182
            image = descriptor.createImage();
205
            image = descriptor.createImage();
183
            imageCache.put(descriptor, image);
206
            imageCache.put(descriptor, image);
207
            // Map new Image to descriptive text.
208
            // Should not cause memory leak as this must be a new descriptor.
209
            imageTextMap.put(image, descriptorTextMap.get(descriptor));
184
        }
210
        }
185
        return image;
211
        return image;
186
    }
212
    }
Lines 200-205 Link Here
200
        {
226
        {
201
            descriptor = ImageDescriptor.createFromURL(path);
227
            descriptor = ImageDescriptor.createFromURL(path);
202
            imagePathCache.put(pathKey, descriptor);
228
            imagePathCache.put(pathKey, descriptor);
229
            // Map new descriptor to descriptive text for the Image.
230
            // Should not cause a memory leak as this is a new descriptor,
231
            // and equivalent descriptors should overwrite existing entries.
232
            descriptorTextMap.put(descriptor, getIconString(path));
203
        }
233
        }
204
234
205
        return descriptor;
235
        return descriptor;
Lines 222-227 Link Here
222
        return imageDescriptor == null ? null : getImage(imageDescriptor);
252
        return imageDescriptor == null ? null : getImage(imageDescriptor);
223
    }
253
    }
224
254
255
    /**
256
     * @param url
257
     *            URL of image file for which a description is required.
258
     * @return String with meaningful description of image given by input url.
259
     */
260
    private String getIconString(URL url)
261
    {
262
        return getIconString(url.getPath()); // Delegate lookup based on path
263
                                             // element of URL.
264
    }
265
266
    /**
267
     * @param path
268
     *            String representing the path to an image file for which a
269
     *            description is needed.
270
     * @return String with meaningful description of image located at input
271
     *         path.
272
     */
273
    private String getIconString(String path)
274
    {
275
        // TODO - implement mapping from icon file pathnames to suitable NLS
276
        // readable descriptions.
277
        // See OpenIconAssistAction.java for a starting point.
278
        // Temporary non-NLS implementation follows: base file name with _
279
        // replaced with ' '.
280
        return new File(path).getName().split("\\.")[0].replace('_', ' '); // Should
281
                                                                           // not
282
                                                                           // throw
283
                                                                           // Exception.
284
    }
285
286
    /**
287
     * @param image
288
     *            The Image for which descriptive text is to be retrieved.
289
     * @return Descriptive text for the Image object, retrieved from
290
     *         imageTextMap.
291
     */
292
    public String getImageText(Image image)
293
    {
294
        String text = imageTextMap.get(image); // May be null
295
        return (text == null) ? "Unknown Image" : text; // Return default string
296
                                                        // if image not in map.
297
    }
298
225
    public IExtensionTracker getExtensionTracker()
299
    public IExtensionTracker getExtensionTracker()
226
    {
300
    {
227
        return tracker;
301
        return tracker;
(-)src/org/eclipse/mat/ui/compare/CompareBasketView.java (+2 lines)
Lines 43-48 Link Here
43
import org.eclipse.mat.ui.MemoryAnalyserPlugin;
43
import org.eclipse.mat.ui.MemoryAnalyserPlugin;
44
import org.eclipse.mat.ui.Messages;
44
import org.eclipse.mat.ui.Messages;
45
import org.eclipse.mat.ui.QueryExecution;
45
import org.eclipse.mat.ui.QueryExecution;
46
import org.eclipse.mat.ui.accessibility.AccessibleCompositeAdapter;
46
import org.eclipse.mat.ui.actions.QueryDropDownMenuAction;
47
import org.eclipse.mat.ui.actions.QueryDropDownMenuAction;
47
import org.eclipse.mat.ui.editor.AbstractEditorPane;
48
import org.eclipse.mat.ui.editor.AbstractEditorPane;
48
import org.eclipse.mat.ui.editor.MultiPaneEditor;
49
import org.eclipse.mat.ui.editor.MultiPaneEditor;
Lines 97-102 Link Here
97
	{
98
	{
98
		tableViewer = new TableViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION);
99
		tableViewer = new TableViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION);
99
		this.table = tableViewer.getTable();
100
		this.table = tableViewer.getTable();
101
        AccessibleCompositeAdapter.access(table);
100
102
101
		TableViewerColumn column = new TableViewerColumn(tableViewer, SWT.LEFT);
103
		TableViewerColumn column = new TableViewerColumn(tableViewer, SWT.LEFT);
102
		TableColumn tableColumn = column.getColumn();
104
		TableColumn tableColumn = column.getColumn();
(-)src/org/eclipse/mat/ui/internal/browser/QueryBrowserPopup.java (+2 lines)
Lines 38-43 Link Here
38
import org.eclipse.mat.ui.MemoryAnalyserPlugin;
38
import org.eclipse.mat.ui.MemoryAnalyserPlugin;
39
import org.eclipse.mat.ui.Messages;
39
import org.eclipse.mat.ui.Messages;
40
import org.eclipse.mat.ui.QueryExecution;
40
import org.eclipse.mat.ui.QueryExecution;
41
import org.eclipse.mat.ui.accessibility.AccessibleCompositeAdapter;
41
import org.eclipse.mat.ui.editor.MultiPaneEditor;
42
import org.eclipse.mat.ui.editor.MultiPaneEditor;
42
import org.eclipse.mat.ui.util.ErrorHelper;
43
import org.eclipse.mat.ui.util.ErrorHelper;
43
import org.eclipse.mat.ui.util.IPolicy;
44
import org.eclipse.mat.ui.util.IPolicy;
Lines 222-227 Link Here
222
        textLayout.setFont(table.getFont());
223
        textLayout.setFont(table.getFont());
223
        textLayout.setText(Messages.QueryBrowserPopup_Categories);
224
        textLayout.setText(Messages.QueryBrowserPopup_Categories);
224
        textLayout.setFont(boldFont);
225
        textLayout.setFont(boldFont);
226
        AccessibleCompositeAdapter.access(table);
225
227
226
        tableColumnLayout.setColumnData(new TableColumn(table, SWT.NONE), new ColumnWeightData(100, 100));
228
        tableColumnLayout.setColumnData(new TableColumn(table, SWT.NONE), new ColumnWeightData(100, 100));
227
        table.getShell().addControlListener(new ControlAdapter()
229
        table.getShell().addControlListener(new ControlAdapter()
(-)src/org/eclipse/mat/ui/internal/query/arguments/ArgumentsTable.java (+2 lines)
Lines 41-46 Link Here
41
import org.eclipse.mat.snapshot.model.IObject;
41
import org.eclipse.mat.snapshot.model.IObject;
42
import org.eclipse.mat.snapshot.query.IHeapObjectArgument;
42
import org.eclipse.mat.snapshot.query.IHeapObjectArgument;
43
import org.eclipse.mat.ui.Messages;
43
import org.eclipse.mat.ui.Messages;
44
import org.eclipse.mat.ui.accessibility.AccessibleCompositeAdapter;
44
import org.eclipse.mat.ui.internal.query.arguments.LinkEditor.Mode;
45
import org.eclipse.mat.ui.internal.query.arguments.LinkEditor.Mode;
45
import org.eclipse.mat.ui.internal.query.arguments.TextEditor.DecoratorType;
46
import org.eclipse.mat.ui.internal.query.arguments.TextEditor.DecoratorType;
46
import org.eclipse.mat.util.MessageUtil;
47
import org.eclipse.mat.util.MessageUtil;
Lines 110-115 Link Here
110
        table.setFont(parentFont);
111
        table.setFont(parentFont);
111
        table.setLinesVisible(true);
112
        table.setLinesVisible(true);
112
        table.setHeaderVisible(true);
113
        table.setHeaderVisible(true);
114
        AccessibleCompositeAdapter.access(table);
113
115
114
        TableColumn column = new TableColumn(table, SWT.NONE);
116
        TableColumn column = new TableColumn(table, SWT.NONE);
115
        column.setText(ARGUMENT);
117
        column.setText(ARGUMENT);
(-)src/org/eclipse/mat/ui/internal/acquire/ProviderConfigurationDialog.java (+2 lines)
Lines 28-33 Link Here
28
import org.eclipse.mat.query.registry.ArgumentFactory;
28
import org.eclipse.mat.query.registry.ArgumentFactory;
29
import org.eclipse.mat.snapshot.acquire.IHeapDumpProvider;
29
import org.eclipse.mat.snapshot.acquire.IHeapDumpProvider;
30
import org.eclipse.mat.ui.Messages;
30
import org.eclipse.mat.ui.Messages;
31
import org.eclipse.mat.ui.accessibility.AccessibleCompositeAdapter;
31
import org.eclipse.mat.ui.internal.browser.QueryContextHelp;
32
import org.eclipse.mat.ui.internal.browser.QueryContextHelp;
32
import org.eclipse.mat.util.IProgressListener;
33
import org.eclipse.mat.util.IProgressListener;
33
import org.eclipse.mat.util.MessageUtil;
34
import org.eclipse.mat.util.MessageUtil;
Lines 259-264 Link Here
259
		
260
		
260
		availableProvidersTable.setHeaderVisible(true);
261
		availableProvidersTable.setHeaderVisible(true);
261
		availableProvidersTable.setLinesVisible(true);
262
		availableProvidersTable.setLinesVisible(true);
263
        AccessibleCompositeAdapter.access(availableProvidersTable);
262
		
264
		
263
		Collection<HeapDumpProviderDescriptor> providers = HeapDumpProviderRegistry.instance().getHeapDumpProviders();
265
		Collection<HeapDumpProviderDescriptor> providers = HeapDumpProviderRegistry.instance().getHeapDumpProviders();
264
		for (HeapDumpProviderDescriptor heapDumpProviderDescriptor : providers)
266
		for (HeapDumpProviderDescriptor heapDumpProviderDescriptor : providers)
(-)src/org/eclipse/mat/ui/internal/viewer/RefinedTableViewer.java (+2 lines)
Lines 18-23 Link Here
18
import org.eclipse.mat.query.refined.RefinedTable;
18
import org.eclipse.mat.query.refined.RefinedTable;
19
import org.eclipse.mat.query.refined.TotalsRow;
19
import org.eclipse.mat.query.refined.TotalsRow;
20
import org.eclipse.mat.query.registry.QueryResult;
20
import org.eclipse.mat.query.registry.QueryResult;
21
import org.eclipse.mat.ui.accessibility.AccessibleCompositeAdapter;
21
import org.eclipse.mat.ui.editor.AbstractEditorPane;
22
import org.eclipse.mat.ui.editor.AbstractEditorPane;
22
import org.eclipse.mat.ui.editor.MultiPaneEditor;
23
import org.eclipse.mat.ui.editor.MultiPaneEditor;
23
import org.eclipse.swt.SWT;
24
import org.eclipse.swt.SWT;
Lines 176-181 Link Here
176
            table = new Table(parent, SWT.VIRTUAL | SWT.FULL_SELECTION | SWT.MULTI);
177
            table = new Table(parent, SWT.VIRTUAL | SWT.FULL_SELECTION | SWT.MULTI);
177
            table.setHeaderVisible(true);
178
            table.setHeaderVisible(true);
178
            table.setLinesVisible(true);
179
            table.setLinesVisible(true);
180
            AccessibleCompositeAdapter.access(table);
179
181
180
            table.addListener(SWT.SetData, new Listener()
182
            table.addListener(SWT.SetData, new Listener()
181
            {
183
            {
(-)src/org/eclipse/mat/ui/internal/viewer/RefinedTreeViewer.java (+2 lines)
Lines 26-31 Link Here
26
import org.eclipse.mat.query.refined.TotalsRow;
26
import org.eclipse.mat.query.refined.TotalsRow;
27
import org.eclipse.mat.query.registry.QueryResult;
27
import org.eclipse.mat.query.registry.QueryResult;
28
import org.eclipse.mat.ui.Messages;
28
import org.eclipse.mat.ui.Messages;
29
import org.eclipse.mat.ui.accessibility.AccessibleCompositeAdapter;
29
import org.eclipse.mat.ui.editor.AbstractEditorPane;
30
import org.eclipse.mat.ui.editor.AbstractEditorPane;
30
import org.eclipse.mat.ui.editor.AbstractPaneJob;
31
import org.eclipse.mat.ui.editor.AbstractPaneJob;
31
import org.eclipse.mat.ui.editor.MultiPaneEditor;
32
import org.eclipse.mat.ui.editor.MultiPaneEditor;
Lines 549-554 Link Here
549
            tree = new Tree(parent, SWT.FULL_SELECTION | SWT.MULTI);
550
            tree = new Tree(parent, SWT.FULL_SELECTION | SWT.MULTI);
550
            tree.setHeaderVisible(true);
551
            tree.setHeaderVisible(true);
551
            tree.setLinesVisible(true);
552
            tree.setLinesVisible(true);
553
            AccessibleCompositeAdapter.access(tree);
552
554
553
            return tree;
555
            return tree;
554
        }
556
        }
(-)src/org/eclipse/mat/ui/internal/views/NavigatorViewPage.java (+2 lines)
Lines 38-43 Link Here
38
import org.eclipse.mat.ui.Messages;
38
import org.eclipse.mat.ui.Messages;
39
import org.eclipse.mat.ui.QueryExecution;
39
import org.eclipse.mat.ui.QueryExecution;
40
import org.eclipse.mat.ui.MemoryAnalyserPlugin.ISharedImages;
40
import org.eclipse.mat.ui.MemoryAnalyserPlugin.ISharedImages;
41
import org.eclipse.mat.ui.accessibility.AccessibleCompositeAdapter;
41
import org.eclipse.mat.ui.compare.CompareBasketView;
42
import org.eclipse.mat.ui.compare.CompareBasketView;
42
import org.eclipse.mat.ui.editor.AbstractEditorPane;
43
import org.eclipse.mat.ui.editor.AbstractEditorPane;
43
import org.eclipse.mat.ui.editor.CompositeHeapEditorPane;
44
import org.eclipse.mat.ui.editor.CompositeHeapEditorPane;
Lines 154-159 Link Here
154
    {
155
    {
155
        treeViewer = new TreeViewer(parent);
156
        treeViewer = new TreeViewer(parent);
156
        createContextMenu(treeViewer.getTree());
157
        createContextMenu(treeViewer.getTree());
158
        AccessibleCompositeAdapter.access(treeViewer.getTree());
157
159
158
        treeViewer.setContentProvider(new NavigatorContentProvider());
160
        treeViewer.setContentProvider(new NavigatorContentProvider());
159
        treeViewer.setLabelProvider(new NavigatorLabelProvider());
161
        treeViewer.setLabelProvider(new NavigatorLabelProvider());
(-)src/org/eclipse/mat/ui/internal/views/SnapshotHistoryView.java (+2 lines)
Lines 31-36 Link Here
31
import org.eclipse.mat.ui.SnapshotHistoryService;
31
import org.eclipse.mat.ui.SnapshotHistoryService;
32
import org.eclipse.mat.ui.MemoryAnalyserPlugin.ISharedImages;
32
import org.eclipse.mat.ui.MemoryAnalyserPlugin.ISharedImages;
33
import org.eclipse.mat.ui.SnapshotHistoryService.Entry;
33
import org.eclipse.mat.ui.SnapshotHistoryService.Entry;
34
import org.eclipse.mat.ui.accessibility.AccessibleCompositeAdapter;
34
import org.eclipse.mat.ui.editor.PathEditorInput;
35
import org.eclipse.mat.ui.editor.PathEditorInput;
35
import org.eclipse.mat.ui.snapshot.views.SnapshotOutlinePage;
36
import org.eclipse.mat.ui.snapshot.views.SnapshotOutlinePage;
36
import org.eclipse.mat.ui.util.ErrorHelper;
37
import org.eclipse.mat.ui.util.ErrorHelper;
Lines 196-201 Link Here
196
        tableColumn.setText(Messages.SnapshotHistoryView_RecentlyUsedFiles);
197
        tableColumn.setText(Messages.SnapshotHistoryView_RecentlyUsedFiles);
197
        tableColumn.setWidth(400);
198
        tableColumn.setWidth(400);
198
        table.setHeaderVisible(true);
199
        table.setHeaderVisible(true);
200
        AccessibleCompositeAdapter.access(table);
199
201
200
        table.addMouseListener(new MouseAdapter()
202
        table.addMouseListener(new MouseAdapter()
201
        {
203
        {
(-)src/org/eclipse/mat/ui/accessibility/AccessibleCompositeAdapter.java (+213 lines)
Line 0 Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011 IBM Corporation.
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 implementation
10
 *******************************************************************************/
11
12
package org.eclipse.mat.ui.accessibility;
13
14
import org.eclipse.mat.ui.MemoryAnalyserPlugin;
15
import org.eclipse.swt.accessibility.ACC;
16
import org.eclipse.swt.accessibility.AccessibleAdapter;
17
import org.eclipse.swt.accessibility.AccessibleControlAdapter;
18
import org.eclipse.swt.accessibility.AccessibleControlEvent;
19
import org.eclipse.swt.accessibility.AccessibleEvent;
20
import org.eclipse.swt.graphics.Image;
21
import org.eclipse.swt.widgets.Composite;
22
import org.eclipse.swt.widgets.Item;
23
import org.eclipse.swt.widgets.Table;
24
import org.eclipse.swt.widgets.TableItem;
25
import org.eclipse.swt.widgets.Tree;
26
import org.eclipse.swt.widgets.TreeItem;
27
28
/**
29
 * AccessibleCompositeAdapter Accessibility utility class provides a single
30
 * encapsulated implementation of accessibility enhancements for Table & Tree
31
 * Controls within MAT. The implementation is essentially the same for both
32
 * types of view, adding an Accessible Listener to cause a specially constructed
33
 * name for each item to be passed to the accessibility client (Screen Reader).
34
 * 
35
 * @author Jonathan Lawrence
36
 */
37
public class AccessibleCompositeAdapter
38
{
39
40
    // Constants for String construction.
41
    private static final char space = ' ';
42
43
    // Public methods provide interface ensuring only Table or Tree are used.
44
    /**
45
     * @param table
46
     *            The Table to decorate with Accessible.
47
     */
48
    public static void access(Table table)
49
    {
50
        access(table, ACC.ROLE_TABLE); // Delegate to generic private method.
51
    }
52
53
    /**
54
     * @param tree
55
     *            The Tree to decorate with Accessible.
56
     */
57
    public static void access(Tree tree)
58
    {
59
        access(tree, ACC.ROLE_TREE); // Delegate to generic private method.
60
    }
61
62
    /**
63
     * @param composite
64
     *            The Composite (Table/Tree) to add Accessibility
65
     * @param role
66
     *            The ACC.ROLE constant representing the type of Composite.
67
     */
68
    private static void access(final Composite composite, final int role)
69
    {
70
        // Add addAccessibleListener to override getName.
71
        composite.getAccessible().addAccessibleListener(new AccessibleAdapter()
72
        {
73
74
            @Override
75
            public void getName(AccessibleEvent e)
76
            {
77
                if (e.childID == ACC.CHILDID_SELF)
78
                {
79
                    // TODO - provide a suitable name for the Tree/Table.
80
                }
81
                else
82
                { // Name is required for a child of the Composite.
83
84
                    // Get the item...
85
                    Item item = null;
86
                    try
87
                    {
88
                        // Defensive coding. For Tree Controls, JAWS 12
89
                        // sometimes
90
                        // calls this method with invalid childIDs.
91
                        int maxchild = getItemCount(composite, role);
92
                        if (e.childID >= 0 && e.childID < maxchild)
93
                        { // Valid range
94
                          // Get Item
95
                            item = getItem(composite, role, e.childID);
96
                        }
97
                        // Otherwise use first selected item if any.
98
                        else
99
                        {
100
                            item = getSelection(composite, role)[0];
101
                        }
102
                    }
103
                    catch (IndexOutOfBoundsException ie)
104
                    { // Do nothing
105
                      // item will be null, no name will be returned in e.
106
107
                    } // catch()
108
109
                    // Construct a row of readable text for the Table/TreeItem
110
                    if (item != null) // Valid item
111
                    {
112
                        int ncol = getColumnCount(composite, role);
113
                        int[] colorder = getColumnOrder(composite, role);
114
                        StringBuffer rowbuf = new StringBuffer();
115
                        Item column = null;
116
                        Image image = null;
117
                        for (int icol = 0; icol < ncol; icol++) // For each
118
                                                                // column
119
                        {
120
                            int jcol = colorder[icol]; // The index of the
121
                                                       // column when created.
122
                            image = getImage(item, role, jcol); // Get image if
123
                                                                // any
124
                            if (image != null) // Image exists in this column
125
                            { // Append the descriptive text for this image
126
                                rowbuf.append(MemoryAnalyserPlugin.getDefault().getImageText(image));
127
                                rowbuf.append(space);
128
                            }
129
                            column = getColumn(composite, role, jcol); // Get
130
                                                                       // relevant
131
                                                                       // Column
132
                            rowbuf.append(column.getText()); // Append column
133
                                                             // header
134
                            rowbuf.append(space);
135
                            rowbuf.append(getText(item, role, jcol)); // Append
136
                                                                      // column
137
                                                                      // content
138
                            rowbuf.append(space);
139
                        }
140
                        e.result = rowbuf.toString();
141
                    } // if()
142
                } // if()
143
            } // getName()
144
145
        });
146
147
        // Experimentation with JAWS 12 shows that the following is also
148
        // required to ensure
149
        // that JAWS will read out the name returned for the Item.
150
        composite.getAccessible().addAccessibleControlListener(new AccessibleControlAdapter()
151
        {
152
            @Override
153
            public void getRole(AccessibleControlEvent e)
154
            {
155
                if (e.childID == ACC.CHILDID_SELF)
156
                {
157
                    e.detail = role; // The ACC.ROLE constant for the Control.
158
                }
159
                else
160
                {
161
                    e.detail = ACC.ROLE_TEXT; // Return TEXT for an Item.
162
                } // if()
163
            } // getRole()
164
        });
165
166
    }
167
168
    // //////////////////////////////////////////////////////////////
169
    // Utility methods to map inquiry methods onto the Control-type
170
    // specific variants for Table or Tree, as required.
171
    // //////////////////////////////////////////////////////////////
172
173
    private static Item getColumn(Composite composite, int role, int index)
174
    {
175
        return (role == ACC.ROLE_TABLE) ? ((Table) composite).getColumn(index) : ((Tree) composite).getColumn(index);
176
    }
177
178
    private static int getColumnCount(Composite composite, int role)
179
    {
180
        return (role == ACC.ROLE_TABLE) ? ((Table) composite).getColumnCount() : ((Tree) composite).getColumnCount();
181
    }
182
183
    private static int[] getColumnOrder(Composite composite, int role)
184
    {
185
        return (role == ACC.ROLE_TABLE) ? ((Table) composite).getColumnOrder() : ((Tree) composite).getColumnOrder();
186
    }
187
188
    private static Item getItem(Composite composite, int role, int index)
189
    {
190
        return (role == ACC.ROLE_TABLE) ? ((Table) composite).getItem(index) : ((Tree) composite).getItem(index);
191
    }
192
193
    private static Item[] getSelection(Composite composite, int role)
194
    {
195
        return (role == ACC.ROLE_TABLE) ? ((Table) composite).getSelection() : ((Tree) composite).getSelection();
196
    }
197
198
    private static int getItemCount(Composite composite, int role)
199
    {
200
        return (role == ACC.ROLE_TABLE) ? ((Table) composite).getItemCount() : ((Tree) composite).getItemCount();
201
    }
202
203
    private static Image getImage(Item item, int role, int index)
204
    {
205
        return (role == ACC.ROLE_TABLE) ? ((TableItem) item).getImage(index) : ((TreeItem) item).getImage(index);
206
    }
207
208
    private static String getText(Item item, int role, int index)
209
    {
210
        return (role == ACC.ROLE_TABLE) ? ((TableItem) item).getText(index) : ((TreeItem) item).getText(index);
211
    }
212
213
}
(-)src/org/eclipse/mat/ui/snapshot/actions/OpenIconAssistAction.java (+2 lines)
Lines 37-42 Link Here
37
import org.eclipse.mat.query.registry.QueryRegistry;
37
import org.eclipse.mat.query.registry.QueryRegistry;
38
import org.eclipse.mat.ui.MemoryAnalyserPlugin;
38
import org.eclipse.mat.ui.MemoryAnalyserPlugin;
39
import org.eclipse.mat.ui.Messages;
39
import org.eclipse.mat.ui.Messages;
40
import org.eclipse.mat.ui.accessibility.AccessibleCompositeAdapter;
40
import org.eclipse.mat.ui.snapshot.ImageHelper;
41
import org.eclipse.mat.ui.snapshot.ImageHelper;
41
import org.eclipse.swt.SWT;
42
import org.eclipse.swt.SWT;
42
import org.eclipse.swt.events.ControlEvent;
43
import org.eclipse.swt.events.ControlEvent;
Lines 284-289 Link Here
284
            shell = new Shell(parent, checkStyle(style));
285
            shell = new Shell(parent, checkStyle(style));
285
            TableViewer viewer = new TableViewer(shell, SWT.WRAP | SWT.V_SCROLL | SWT.H_SCROLL);
286
            TableViewer viewer = new TableViewer(shell, SWT.WRAP | SWT.V_SCROLL | SWT.H_SCROLL);
286
            table = viewer.getTable();
287
            table = viewer.getTable();
288
            AccessibleCompositeAdapter.access(table);
287
            TableColumn tc1 = new TableColumn(table, SWT.CENTER);
289
            TableColumn tc1 = new TableColumn(table, SWT.CENTER);
288
            TableColumn tc2 = new TableColumn(table, SWT.LEFT);
290
            TableColumn tc2 = new TableColumn(table, SWT.LEFT);
289
            tc1.setWidth(25);
291
            tc1.setWidth(25);
(-)src/org/eclipse/mat/ui/snapshot/views/SnapshotOutlinePage.java (+3 lines)
Lines 28-33 Link Here
28
import org.eclipse.jface.viewers.Viewer;
28
import org.eclipse.jface.viewers.Viewer;
29
import org.eclipse.mat.snapshot.ISnapshot;
29
import org.eclipse.mat.snapshot.ISnapshot;
30
import org.eclipse.mat.snapshot.SnapshotInfo;
30
import org.eclipse.mat.snapshot.SnapshotInfo;
31
import org.eclipse.mat.ui.accessibility.AccessibleCompositeAdapter;
31
import org.eclipse.mat.ui.snapshot.editor.ISnapshotEditorInput;
32
import org.eclipse.mat.ui.snapshot.editor.ISnapshotEditorInput;
32
import org.eclipse.mat.util.MessageUtil;
33
import org.eclipse.mat.util.MessageUtil;
33
import org.eclipse.swt.SWT;
34
import org.eclipse.swt.SWT;
Lines 253-258 Link Here
253
254
254
        createColumns();
255
        createColumns();
255
256
257
        AccessibleCompositeAdapter.access(treeViewer.getTree());
258
        
256
        treeViewer.getTree().setLinesVisible(true);
259
        treeViewer.getTree().setLinesVisible(true);
257
        treeViewer.getTree().setHeaderVisible(true);
260
        treeViewer.getTree().setHeaderVisible(true);
258
261
(-)src/org/eclipse/mat/ui/snapshot/views/inspector/InspectorView.java (+4 lines)
Lines 56-61 Link Here
56
import org.eclipse.mat.snapshot.model.IPrimitiveArray;
56
import org.eclipse.mat.snapshot.model.IPrimitiveArray;
57
import org.eclipse.mat.ui.MemoryAnalyserPlugin;
57
import org.eclipse.mat.ui.MemoryAnalyserPlugin;
58
import org.eclipse.mat.ui.Messages;
58
import org.eclipse.mat.ui.Messages;
59
import org.eclipse.mat.ui.accessibility.AccessibleCompositeAdapter;
59
import org.eclipse.mat.ui.snapshot.ImageHelper;
60
import org.eclipse.mat.ui.snapshot.ImageHelper;
60
import org.eclipse.mat.ui.snapshot.editor.HeapEditor;
61
import org.eclipse.mat.ui.snapshot.editor.HeapEditor;
61
import org.eclipse.mat.ui.snapshot.editor.ISnapshotEditorInput;
62
import org.eclipse.mat.ui.snapshot.editor.ISnapshotEditorInput;
Lines 443-448 Link Here
443
        topTableViewer = new TableViewer(composite, SWT.FULL_SELECTION | SWT.MULTI);
444
        topTableViewer = new TableViewer(composite, SWT.FULL_SELECTION | SWT.MULTI);
444
445
445
        Table table = topTableViewer.getTable();
446
        Table table = topTableViewer.getTable();
447
        AccessibleCompositeAdapter.access(table);
446
        TableColumnLayout columnLayout = new TableColumnLayout();
448
        TableColumnLayout columnLayout = new TableColumnLayout();
447
        composite.setLayout(columnLayout);
449
        composite.setLayout(columnLayout);
448
450
Lines 568-573 Link Here
568
        classHierarchyTree.setLabelProvider(new HierarchyLabelProvider(-1));
570
        classHierarchyTree.setLabelProvider(new HierarchyLabelProvider(-1));
569
571
570
        Tree tree = classHierarchyTree.getTree();
572
        Tree tree = classHierarchyTree.getTree();
573
        AccessibleCompositeAdapter.access(tree);
571
        TreeColumnLayout columnLayout = new TreeColumnLayout();
574
        TreeColumnLayout columnLayout = new TreeColumnLayout();
572
        composite.setLayout(columnLayout);
575
        composite.setLayout(columnLayout);
573
576
Lines 586-591 Link Here
586
589
587
        final TableViewer viewer = new TableViewer(composite, SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.MULTI);
590
        final TableViewer viewer = new TableViewer(composite, SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.MULTI);
588
        Table table = viewer.getTable();
591
        Table table = viewer.getTable();
592
        AccessibleCompositeAdapter.access(table);
589
        viewer.setContentProvider(new FieldsContentProvider());
593
        viewer.setContentProvider(new FieldsContentProvider());
590
        viewer.setLabelProvider(new FieldsLabelProvider(this, table.getFont()));
594
        viewer.setLabelProvider(new FieldsLabelProvider(this, table.getFont()));
591
595

Return to bug 341685