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

Collapse All | Expand All

(-)src/org/eclipse/cdt/mylyn/internal/ui/CDTStructureBridge.java (-85 / +3 lines)
Lines 25-35 Link Here
25
import org.eclipse.core.resources.IResource;
25
import org.eclipse.core.resources.IResource;
26
import org.eclipse.core.runtime.CoreException;
26
import org.eclipse.core.runtime.CoreException;
27
import org.eclipse.core.runtime.IAdaptable;
27
import org.eclipse.core.runtime.IAdaptable;
28
import org.eclipse.mylyn.commons.core.StatusHandler;
28
import org.eclipse.mylyn.context.core.AbstractContextStructureBridge;
29
import org.eclipse.mylyn.context.core.AbstractContextStructureBridge;
29
import org.eclipse.mylyn.context.core.ContextCorePlugin;
30
import org.eclipse.mylyn.context.core.IInteractionElement;
30
import org.eclipse.mylyn.context.core.IInteractionElement;
31
import org.eclipse.mylyn.internal.context.core.ContextCorePlugin;
31
import org.eclipse.mylyn.internal.resources.ui.ResourceStructureBridge;
32
import org.eclipse.mylyn.internal.resources.ui.ResourceStructureBridge;
32
import org.eclipse.mylyn.monitor.core.StatusHandler;
33
import org.eclipse.ui.internal.WorkingSet;
33
import org.eclipse.ui.internal.WorkingSet;
34
import org.eclipse.ui.views.markers.internal.ConcreteMarker;
34
import org.eclipse.ui.views.markers.internal.ConcreteMarker;
35
35
Lines 100-107 Link Here
100
					return childHandles;
100
					return childHandles;
101
				} catch (CModelException e) {
101
				} catch (CModelException e) {
102
					// ignore these, usually indicate no-existent element
102
					// ignore these, usually indicate no-existent element
103
				} catch (Exception e) {
104
					StatusHandler.fail(e, CDTUIBridgePlugin.getResourceString("MylynCDT.childAccessFailed"), false); // $NON-NLS-1$
105
				}
103
				}
106
			}
104
			}
107
		}
105
		}
Lines 109-160 Link Here
109
	}
107
	}
110
	
108
	
111
	public static ICElement getElementForHandle(String handle) {
109
	public static ICElement getElementForHandle(String handle) {
112
//		System.out.println("[handle is " + handle);
113
//		ICElement s = null;
114
//
115
//		s = CoreModel.create(handle);
116
//		if (s == null)
117
//			System.out.println("[null handle is " + handle);
118
//		else
119
//			System.out.println("[element is " + s.getElementName());
120
//
121
//		return s;
122
		return CoreModel.create(handle);
110
		return CoreModel.create(handle);
123
//		try {
124
//			String[] s = handle.split("\\|"); // $NON-NLS-1$
125
//			if (s.length < 1)
126
//				return null;
127
//			int kind = Integer.valueOf(s[0]);
128
//			switch (kind) {
129
//			case ICElement.C_PROJECT: {
130
//				return CoreModel.getDefault().getCModel().getCProject(s[1]);
131
//			}
132
//			case ICElement.C_CCONTAINER: {
133
//				ICProject cproject = CoreModel.getDefault().getCModel().getCProject(s[1]);
134
//				return cproject.findElement(new Path(s[3]));
135
//			}
136
//			case C_SOURCEROOT: {
137
//				ICProject cproject = CoreModel.getDefault().getCModel().getCProject(s[1]);
138
//				return cproject.findSourceRoot(new Path(s[3]));
139
//			}
140
//			case ICElement.C_MODEL: {
141
//				return CoreModel.getDefault().getCModel();
142
//			}
143
//			case ICElement.C_UNIT: {
144
//				IPath path = new Path(s[3]);
145
//				ICElement element = CoreModel.getDefault().create(path);
146
//				return (ITranslationUnit)element;
147
//			}
148
//			}
149
//
150
//			// Otherwise, find the element by name within the TranslationUnit
151
//			IPath path = new Path(s[3]);
152
//			ICElement element = CoreModel.getDefault().create(path);
153
//			return ((ITranslationUnit)element).getElement(s[2]);
154
//		} catch (CModelException e) {
155
//			StatusHandler.log(CDTUIBridgePlugin.getFormattedString("MylynCDT.log.noObjectForHandle", new String[]{handle}), null); // $NON-NLS-1$
156
//			return null;
157
//		}
158
	}
111
	}
159
112
160
113
Lines 170-208 Link Here
170
	// The element name (optional) allows us to find an element within the
123
	// The element name (optional) allows us to find an element within the
171
	// TranslationUnit.
124
	// TranslationUnit.
172
	public static String getHandleForElement(ICElement element) {
125
	public static String getHandleForElement(ICElement element) {
173
//		System.out.println("element is " + element.getClass().getName());
174
//		System.out.println("handle is " + element.getHandleIdentifier());
175
		return element.getHandleIdentifier();
126
		return element.getHandleIdentifier();
176
//		IPath path = element.getUnderlyingResource().getRawLocation();
177
//		int elementType = element.getElementType();
178
//		switch (elementType) {
179
//		case ICElement.C_PROJECT:
180
//			return ICElement.C_PROJECT + "|" + element.getCProject().getElementName() + "||"; // $NON-NLS-1$ // $NON-NLS-2$
181
//		case ICElement.C_UNIT:
182
//			// FIXME: don't need project (external files won't have project
183
//			return ICElement.C_UNIT + "|" + element.getCProject().getElementName() + "||" + path.toPortableString();  // $NON-NLS-1$ // $NON-NLS-2$
184
//		case ICElement.C_MODEL:
185
//			return ICElement.C_MODEL + "|"; // $NON-NLS-1$
186
//		case ICElement.C_CCONTAINER: {
187
//			if (element instanceof ISourceRoot) {
188
//				// Special case of CContainer.  A SourceRoot doesn't have a path set.
189
//				ISourceRoot root = (ISourceRoot)element;
190
//				path = element.getPath();
191
//				return Integer.toString(C_SOURCEROOT) + "|" + element.getCProject().getElementName() + "||" + path.toPortableString(); // $NON-NLS-1$ // $NON-NLS-2$
192
//			}
193
//			return ICElement.C_CCONTAINER + "|" + element.getCProject().getElementName() + "||" + path.toPortableString(); // $NON-NLS-1$ // $NON-NLS-2$
194
//		}
195
//		case ICElement.C_BINARY:
196
//		case ICElement.C_ARCHIVE:
197
//		case ICElement.C_VCONTAINER:
198
//		case ICElement.C_UNKNOWN_DECLARATION:
199
//			// FIXME: For now, don't handle these
200
//			return null;
201
//		default:
202
//			// We default all other elements as children of the TranslationUnit
203
//			return Integer.toString(0) + "|" + element.getCProject().getElementName() + "|" + element.getElementName() // $NON-NLS-1$ // $NON-NLS-2$ 
204
//			+ "|" + path.toPortableString(); // $NON-NLS-1$
205
//		}
206
	}
127
	}
207
	
128
	
208
	/**
129
	/**
Lines 328-337 Link Here
328
			}
249
			}
329
		} catch (CModelException ex) {
250
		} catch (CModelException ex) {
330
			if (ex.doesNotExist())
251
			if (ex.doesNotExist())
331
				StatusHandler.fail(ex, ex.getLocalizedMessage(), false);
252
				StatusHandler.fail(ex.getStatus());
332
			return null;
333
		} catch (Throwable t) {
334
			StatusHandler.fail(t, CDTUIBridgePlugin.getFormattedString("MylynCDT.cantFindElement", new String[]{marker.toString()}), false); // $NON-NLS-1$
335
			return null;
253
			return null;
336
		}
254
		}
337
	}
255
	}
(-)src/org/eclipse/cdt/mylyn/internal/ui/CDTUiBridge.java (-6 / +13 lines)
Lines 22-33 Link Here
22
import org.eclipse.cdt.internal.ui.editor.CContentOutlinePage;
22
import org.eclipse.cdt.internal.ui.editor.CContentOutlinePage;
23
import org.eclipse.cdt.internal.ui.editor.CEditor;
23
import org.eclipse.cdt.internal.ui.editor.CEditor;
24
import org.eclipse.cdt.internal.ui.util.EditorUtility;
24
import org.eclipse.cdt.internal.ui.util.EditorUtility;
25
import org.eclipse.core.runtime.IStatus;
26
import org.eclipse.core.runtime.Status;
25
import org.eclipse.jface.text.TextSelection;
27
import org.eclipse.jface.text.TextSelection;
26
import org.eclipse.jface.viewers.TreeViewer;
28
import org.eclipse.jface.viewers.TreeViewer;
27
import org.eclipse.mylyn.context.core.ContextCorePlugin;
29
import org.eclipse.mylyn.commons.core.StatusHandler;
28
import org.eclipse.mylyn.context.core.IInteractionElement;
30
import org.eclipse.mylyn.context.core.IInteractionElement;
29
import org.eclipse.mylyn.context.ui.AbstractContextUiBridge;
31
import org.eclipse.mylyn.context.ui.AbstractContextUiBridge;
30
import org.eclipse.mylyn.monitor.core.StatusHandler;
32
import org.eclipse.mylyn.internal.context.core.ContextCorePlugin;
31
import org.eclipse.ui.IEditorInput;
33
import org.eclipse.ui.IEditorInput;
32
import org.eclipse.ui.IEditorPart;
34
import org.eclipse.ui.IEditorPart;
33
import org.eclipse.ui.IEditorReference;
35
import org.eclipse.ui.IEditorReference;
Lines 49-55 Link Here
49
			cOutlineField = AbstractCModelOutlinePage.class.getDeclaredField("fTreeViewer");
51
			cOutlineField = AbstractCModelOutlinePage.class.getDeclaredField("fTreeViewer");
50
			cOutlineField.setAccessible(true);
52
			cOutlineField.setAccessible(true);
51
		} catch (Exception e) {
53
		} catch (Exception e) {
52
			StatusHandler.fail(e, CDTUIBridgePlugin.getResourceString("MylynCDT.outlineViewerFailure"), true); // $NON-NLS-1$
54
			StatusHandler.fail(new Status(IStatus.ERROR, CDTUIBridgePlugin.PLUGIN_ID, 
55
					CDTUIBridgePlugin.getResourceString("MylynCDT.outlineViewerFailure"), e)); // $NON-NLS-1$
53
		}
56
		}
54
	}
57
	}
55
58
Lines 61-67 Link Here
61
				return;
64
				return;
62
			IEditorPart part = EditorUtility.openInEditor(cElement);
65
			IEditorPart part = EditorUtility.openInEditor(cElement);
63
		} catch (Throwable t) {
66
		} catch (Throwable t) {
64
			StatusHandler.fail(t, CDTUIBridgePlugin.getFormattedString("MylynCDT.openEditorFailure", new String[]{node.toString()}), true); // $NON-NLS-1$
67
			StatusHandler.fail(new Status(IStatus.ERROR, CDTUIBridgePlugin.PLUGIN_ID, 
68
					CDTUIBridgePlugin.getFormattedString("MylynCDT.openEditorFailure", // $NON-NLS-1$ 
69
					new String[]{node.getHandleIdentifier()}), t));
65
		}
70
		}
66
	}
71
	}
67
72
Lines 87-93 Link Here
87
				}
92
				}
88
			}
93
			}
89
		} catch (Throwable t) {
94
		} catch (Throwable t) {
90
			StatusHandler.fail(t, CDTUIBridgePlugin.getResourceString("MylynCDT.autoCloseEditorFailure"), false); // $NON-NLS-1$
95
			StatusHandler.fail(new Status(IStatus.ERROR, CDTUIBridgePlugin.PLUGIN_ID, 
96
					CDTUIBridgePlugin.getResourceString("MylynCDT.autoCloseEditorFailure"), t)); // $NON-NLS-1$ 
91
		}
97
		}
92
	}
98
	}
93
99
Lines 121-127 Link Here
121
				try {
127
				try {
122
					viewers.add((TreeViewer) cOutlineField.get(page));
128
					viewers.add((TreeViewer) cOutlineField.get(page));
123
				} catch (Exception e) {
129
				} catch (Exception e) {
124
					StatusHandler.log(e, CDTUIBridgePlugin.getResourceString("MylynCDT.log.getOutlineViewerFailure")); // $NON-NLS-1$
130
					StatusHandler.log(new Status(IStatus.ERROR, CDTUIBridgePlugin.PLUGIN_ID, 
131
							CDTUIBridgePlugin.getResourceString("MylynCDT.log.getOutlineViewerFailure"), e)); // $NON-NLS-1$ 
125
				}
132
				}
126
			}
133
			}
127
		}
134
		}
(-)src/org/eclipse/cdt/mylyn/internal/ui/CDTUiUtil.java (-2 / +5 lines)
Lines 24-32 Link Here
24
import org.eclipse.core.resources.IFile;
24
import org.eclipse.core.resources.IFile;
25
import org.eclipse.core.resources.IMarker;
25
import org.eclipse.core.resources.IMarker;
26
import org.eclipse.core.resources.IResource;
26
import org.eclipse.core.resources.IResource;
27
import org.eclipse.core.runtime.IStatus;
28
import org.eclipse.core.runtime.Status;
27
import org.eclipse.jface.preference.IPreferenceStore;
29
import org.eclipse.jface.preference.IPreferenceStore;
28
import org.eclipse.jface.resource.ImageDescriptor;
30
import org.eclipse.jface.resource.ImageDescriptor;
29
import org.eclipse.mylyn.monitor.core.StatusHandler;
31
import org.eclipse.mylyn.commons.core.StatusHandler;
30
import org.eclipse.swt.graphics.Point;
32
import org.eclipse.swt.graphics.Point;
31
import org.eclipse.ui.views.markers.internal.ConcreteMarker;
33
import org.eclipse.ui.views.markers.internal.ConcreteMarker;
32
34
Lines 112-118 Link Here
112
						CDTUIBridgePlugin.getResourceString("MylynCDT.findCElementFailure")); //$NON-NLS-1$
114
						CDTUIBridgePlugin.getResourceString("MylynCDT.findCElementFailure")); //$NON-NLS-1$
113
			return null;
115
			return null;
114
		} catch (Throwable t) {
116
		} catch (Throwable t) {
115
			StatusHandler.fail(t, CDTUIBridgePlugin.getFormattedString("MylynCDT.findElementFailure", new String[]{marker.toString()}), false); // $NON-NLS-1$
117
			StatusHandler.fail(new Status(IStatus.ERROR, CDTUIBridgePlugin.PLUGIN_ID, 
118
					CDTUIBridgePlugin.getFormattedString("MylynCDT.findElementFailure", new String[]{marker.toString()}), t)); // $NON-NLS-1$
116
			return null;
119
			return null;
117
		}
120
		}
118
	}
121
	}
(-)src/org/eclipse/cdt/mylyn/internal/ui/InterestInducingProblemListener.java (-3 / +6 lines)
Lines 13-23 Link Here
13
import org.eclipse.cdt.ui.CUIPlugin;
13
import org.eclipse.cdt.ui.CUIPlugin;
14
import org.eclipse.core.resources.IFile;
14
import org.eclipse.core.resources.IFile;
15
import org.eclipse.core.resources.IResource;
15
import org.eclipse.core.resources.IResource;
16
import org.eclipse.core.runtime.IStatus;
17
import org.eclipse.core.runtime.Status;
16
import org.eclipse.jface.util.IPropertyChangeListener;
18
import org.eclipse.jface.util.IPropertyChangeListener;
17
import org.eclipse.jface.util.PropertyChangeEvent;
19
import org.eclipse.jface.util.PropertyChangeEvent;
18
import org.eclipse.mylyn.context.core.ContextCorePlugin;
20
import org.eclipse.mylyn.commons.core.StatusHandler;
19
import org.eclipse.mylyn.context.core.IInteractionElement;
21
import org.eclipse.mylyn.context.core.IInteractionElement;
20
import org.eclipse.mylyn.monitor.core.StatusHandler;
22
import org.eclipse.mylyn.internal.context.core.ContextCorePlugin;
21
23
22
/**
24
/**
23
 * @author Mik Kersten
25
 * @author Mik Kersten
Lines 54-60 Link Here
54
				}
56
				}
55
			}
57
			}
56
		} catch (Exception e) {
58
		} catch (Exception e) {
57
			StatusHandler.log(e, CDTUIBridgePlugin.getResourceString("MylynCDT.updateMarkerFailure")); // $NON-NLS-1$
59
			StatusHandler.log(new Status(IStatus.ERROR, CDTUIBridgePlugin.PLUGIN_ID, 
60
					CDTUIBridgePlugin.getResourceString("MylynCDT.updateMarkerFailure"), e)); // $NON-NLS-1$
58
		}
61
		}
59
	}
62
	}
60
63
(-)src/org/eclipse/cdt/mylyn/internal/ui/InterestUpdateDeltaListener.java (-5 / +8 lines)
Lines 13-21 Link Here
13
import org.eclipse.cdt.core.model.ICElementDelta;
13
import org.eclipse.cdt.core.model.ICElementDelta;
14
import org.eclipse.cdt.core.model.IElementChangedListener;
14
import org.eclipse.cdt.core.model.IElementChangedListener;
15
import org.eclipse.cdt.core.model.ITranslationUnit;
15
import org.eclipse.cdt.core.model.ITranslationUnit;
16
import org.eclipse.mylyn.context.core.ContextCorePlugin;
16
import org.eclipse.core.runtime.IStatus;
17
import org.eclipse.core.runtime.Status;
18
import org.eclipse.mylyn.commons.core.StatusHandler;
17
import org.eclipse.mylyn.context.core.IInteractionElement;
19
import org.eclipse.mylyn.context.core.IInteractionElement;
18
import org.eclipse.mylyn.monitor.core.StatusHandler;
20
import org.eclipse.mylyn.internal.context.core.ContextCorePlugin;
19
import org.eclipse.ui.IWorkbench;
21
import org.eclipse.ui.IWorkbench;
20
import org.eclipse.ui.PlatformUI;
22
import org.eclipse.ui.PlatformUI;
21
23
Lines 76-82 Link Here
76
				}
78
				}
77
			}
79
			}
78
		} catch (Throwable t) {
80
		} catch (Throwable t) {
79
			StatusHandler.fail(t, CDTUIBridgePlugin.getResourceString("MylynCDT.deltaUpdateFailure"), false); // $NON-NLS-1$
81
			StatusHandler.fail(new Status(IStatus.ERROR, CDTUIBridgePlugin.PLUGIN_ID,
82
					CDTUIBridgePlugin.getResourceString("MylynCDT.deltaUpdateFailure"), t)); // $NON-NLS-1$
80
		}
83
		}
81
	}
84
	}
82
85
Lines 97-109 Link Here
97
100
98
	private void delete(final IInteractionElement element) {
101
	private void delete(final IInteractionElement element) {
99
		if (!asyncExecMode) {
102
		if (!asyncExecMode) {
100
			ContextCorePlugin.getContextManager().delete(element);
103
			ContextCorePlugin.getContextManager().deleteElement(element);
101
		} else {
104
		} else {
102
			IWorkbench workbench = PlatformUI.getWorkbench();
105
			IWorkbench workbench = PlatformUI.getWorkbench();
103
			if (workbench != null) {
106
			if (workbench != null) {
104
				workbench.getDisplay().asyncExec(new Runnable() {
107
				workbench.getDisplay().asyncExec(new Runnable() {
105
					public void run() {
108
					public void run() {
106
						ContextCorePlugin.getContextManager().delete(element);
109
						ContextCorePlugin.getContextManager().deleteElement(element);
107
					}
110
					}
108
				});
111
				});
109
			}
112
			}

Return to bug 162558