View | Details | Raw Unified | Return to bug 233055
Collapse All | Expand All

(-)src/org/eclipse/mylyn/ide/ui/AbstractFocusMarkerViewAction.java (-21 / +14 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2004, 2008 Tasktop Technologies and others.
2
 * Copyright (c) 2004, 2009 Tasktop Technologies 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 7-34 Link Here
7
 *
7
 *
8
 * Contributors:
8
 * Contributors:
9
 *     Tasktop Technologies - initial API and implementation
9
 *     Tasktop Technologies - initial API and implementation
10
 *     Remy Chi Jian Suen - Bug 233055 decouple from platform internals and remove reflective calls
10
 *******************************************************************************/
11
 *******************************************************************************/
11
12
12
package org.eclipse.mylyn.ide.ui;
13
package org.eclipse.mylyn.ide.ui;
13
14
14
import java.lang.reflect.Field;
15
import java.util.ArrayList;
15
import java.util.ArrayList;
16
import java.util.List;
16
import java.util.List;
17
17
18
import org.eclipse.core.runtime.IStatus;
19
import org.eclipse.core.runtime.Status;
20
import org.eclipse.jface.viewers.IBaseLabelProvider;
18
import org.eclipse.jface.viewers.IBaseLabelProvider;
19
import org.eclipse.jface.viewers.ISelectionProvider;
21
import org.eclipse.jface.viewers.StructuredViewer;
20
import org.eclipse.jface.viewers.StructuredViewer;
22
import org.eclipse.jface.viewers.TableViewer;
21
import org.eclipse.jface.viewers.TableViewer;
23
import org.eclipse.mylyn.commons.core.StatusHandler;
24
import org.eclipse.mylyn.context.ui.AbstractFocusViewAction;
22
import org.eclipse.mylyn.context.ui.AbstractFocusViewAction;
25
import org.eclipse.mylyn.context.ui.InterestFilter;
23
import org.eclipse.mylyn.context.ui.InterestFilter;
26
import org.eclipse.mylyn.internal.ide.ui.IdeUiBridgePlugin;
27
import org.eclipse.mylyn.internal.ide.ui.MarkerInterestFilter;
24
import org.eclipse.mylyn.internal.ide.ui.MarkerInterestFilter;
28
import org.eclipse.mylyn.internal.ide.ui.MarkerViewLabelProvider;
25
import org.eclipse.mylyn.internal.ide.ui.MarkerViewLabelProvider;
29
import org.eclipse.ui.IViewPart;
26
import org.eclipse.ui.IViewPart;
30
import org.eclipse.ui.internal.views.markers.ExtendedMarkersView;
27
import org.eclipse.ui.IWorkbenchPartSite;
31
import org.eclipse.ui.internal.views.markers.MarkersTreeViewer;
32
import org.eclipse.ui.views.markers.internal.TableViewLabelProvider;
28
import org.eclipse.ui.views.markers.internal.TableViewLabelProvider;
33
29
34
/**
30
/**
Lines 70-90 Link Here
70
	public List<StructuredViewer> getViewers() {
66
	public List<StructuredViewer> getViewers() {
71
		List<StructuredViewer> viewers = new ArrayList<StructuredViewer>();
67
		List<StructuredViewer> viewers = new ArrayList<StructuredViewer>();
72
		if (cachedViewer == null) {
68
		if (cachedViewer == null) {
73
			try {
69
			IViewPart viewPart = super.getPartForAction();
74
				IViewPart viewPart = super.getPartForAction();
70
			if (viewPart != null) {
75
				if (viewPart != null) {
71
				IWorkbenchPartSite site = viewPart.getSite();
76
					// NOTE: following code is Eclipse 3.4 specific
72
				// make sure the part has been initialized completely
77
					Class<?> clazz = ExtendedMarkersView.class;
73
				if (site != null) {
78
					Field field = clazz.getDeclaredField("viewer"); //$NON-NLS-1$
74
					// retrieve the selection provider
79
					field.setAccessible(true);
75
					ISelectionProvider provider = site.getSelectionProvider();
80
					cachedViewer = (MarkersTreeViewer) field.get(viewPart);
76
					// make sure it's a StructuredViewer
81
					if (cachedViewer != null && !cachedViewer.getControl().isDisposed()) {
77
					if (provider instanceof StructuredViewer) {
82
						updateMarkerViewLabelProvider(cachedViewer);
78
						cachedViewer = (StructuredViewer) provider;
83
					}
79
					}
84
				}
80
				}
85
			} catch (Exception e) {
86
				StatusHandler.log(new Status(IStatus.ERROR, IdeUiBridgePlugin.ID_PLUGIN,
87
						"Could not get problems view viewer", e)); //$NON-NLS-1$
88
			}
81
			}
89
		}
82
		}
90
		if (cachedViewer != null) {
83
		if (cachedViewer != null) {

Return to bug 233055