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

Collapse All | Expand All

(-)ui/org/eclipse/jdt/internal/ui/typehierarchy/TypeHierarchyLifeCycle.java (-16 / +144 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2008 IBM Corporation and others.
2
 * Copyright (c) 2000, 2009 IBM Corporation 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 14-25 Link Here
14
import java.util.ArrayList;
14
import java.util.ArrayList;
15
import java.util.List;
15
import java.util.List;
16
16
17
import org.eclipse.swt.widgets.Display;
18
17
import org.eclipse.core.runtime.IProgressMonitor;
19
import org.eclipse.core.runtime.IProgressMonitor;
20
import org.eclipse.core.runtime.IStatus;
18
import org.eclipse.core.runtime.OperationCanceledException;
21
import org.eclipse.core.runtime.OperationCanceledException;
22
import org.eclipse.core.runtime.Status;
23
import org.eclipse.core.runtime.jobs.Job;
19
24
20
import org.eclipse.jface.operation.IRunnableContext;
25
import org.eclipse.jface.operation.IRunnableContext;
21
import org.eclipse.jface.operation.IRunnableWithProgress;
26
import org.eclipse.jface.operation.IRunnableWithProgress;
22
27
28
import org.eclipse.ui.progress.IWorkbenchSiteProgressService;
29
23
import org.eclipse.jdt.core.ElementChangedEvent;
30
import org.eclipse.jdt.core.ElementChangedEvent;
24
import org.eclipse.jdt.core.IClassFile;
31
import org.eclipse.jdt.core.IClassFile;
25
import org.eclipse.jdt.core.ICompilationUnit;
32
import org.eclipse.jdt.core.ICompilationUnit;
Lines 37-42 Link Here
37
import org.eclipse.jdt.core.JavaModelException;
44
import org.eclipse.jdt.core.JavaModelException;
38
45
39
import org.eclipse.jdt.internal.corext.util.JavaModelUtil;
46
import org.eclipse.jdt.internal.corext.util.JavaModelUtil;
47
import org.eclipse.jdt.internal.corext.util.Messages;
48
49
import org.eclipse.jdt.ui.JavaElementLabels;
40
50
41
import org.eclipse.jdt.internal.ui.JavaPlugin;
51
import org.eclipse.jdt.internal.ui.JavaPlugin;
42
52
Lines 52-59 Link Here
52
62
53
	private List fChangeListeners;
63
	private List fChangeListeners;
54
64
55
	public TypeHierarchyLifeCycle() {
65
	/**
66
	 * The type hierarchy view part.
67
	 *
68
	 * @since 3.6
69
	 */
70
	private TypeHierarchyViewPart fTypeHierarchyViewPart;
71
72
	/**
73
	 * The job that runs in the background to refresh the type hierarchy.
74
	 *
75
	 * @since 3.6
76
	 */
77
	private Job fRefreshHierarchyJob;
78
79
	/**
80
	 * Indicates whether the refresh job was canceled implicitly.
81
	 * 
82
	 * @since 3.6
83
	 */
84
	private boolean fIsCancelImplicit= false;
85
86
	/**
87
	 * Creates the type hierarchy life cycle.
88
	 *
89
	 * @param part the type hierarchy view part
90
	 * @since 3.6
91
	 */
92
	public TypeHierarchyLifeCycle(TypeHierarchyViewPart part) {
56
		this(false);
93
		this(false);
94
		fTypeHierarchyViewPart= part;
95
		fRefreshHierarchyJob= null;
57
	}
96
	}
58
97
59
	public TypeHierarchyLifeCycle(boolean isSuperTypesOnly) {
98
	public TypeHierarchyLifeCycle(boolean isSuperTypesOnly) {
Lines 98-104 Link Here
98
		}
137
		}
99
	}
138
	}
100
139
140
	/**
141
	 * Refreshes the type hierarchy for the java element if it exists.
142
	 *
143
	 * @param element the java element for which the type hierarchy is computed
144
	 * @param context the runnable context
145
	 * @throws InterruptedException thrown from the <code>OperationCanceledException</code> when the monitor is canceled
146
	 * @throws InvocationTargetException thrown from the <code>JavaModelException</code> if the java element does not exist or if an exception occurs while accessing its corresponding resource
147
	 */
101
	public void ensureRefreshedTypeHierarchy(final IJavaElement element, IRunnableContext context) throws InvocationTargetException, InterruptedException {
148
	public void ensureRefreshedTypeHierarchy(final IJavaElement element, IRunnableContext context) throws InvocationTargetException, InterruptedException {
149
		synchronized (this) {
150
			if (fRefreshHierarchyJob != null) {
151
				fRefreshHierarchyJob.cancel();
152
				fIsCancelImplicit= true;
153
				try {
154
					fRefreshHierarchyJob.join();
155
				} catch (InterruptedException e) {
156
					// ignore
157
				} finally {
158
					fRefreshHierarchyJob= null;
159
					fIsCancelImplicit= false;
160
				}
161
			}
162
		}
102
		if (element == null || !element.exists()) {
163
		if (element == null || !element.exists()) {
103
			freeHierarchy();
164
			freeHierarchy();
104
			return;
165
			return;
Lines 106-126 Link Here
106
		boolean hierachyCreationNeeded= (fHierarchy == null || !element.equals(fInputElement));
167
		boolean hierachyCreationNeeded= (fHierarchy == null || !element.equals(fInputElement));
107
168
108
		if (hierachyCreationNeeded || fHierarchyRefreshNeeded) {
169
		if (hierachyCreationNeeded || fHierarchyRefreshNeeded) {
109
170
			if (fTypeHierarchyViewPart == null) {
110
			IRunnableWithProgress op= new IRunnableWithProgress() {
171
				IRunnableWithProgress op= new IRunnableWithProgress() {
111
				public void run(IProgressMonitor pm) throws InvocationTargetException, InterruptedException {
172
					public void run(IProgressMonitor pm) throws InvocationTargetException, InterruptedException {
112
					try {
173
						try {
113
						doHierarchyRefresh(element, pm);
174
							doHierarchyRefresh(element, pm);
114
					} catch (JavaModelException e) {
175
						} catch (JavaModelException e) {
115
						throw new InvocationTargetException(e);
176
							throw new InvocationTargetException(e);
116
					} catch (OperationCanceledException e) {
177
						} catch (OperationCanceledException e) {
117
						throw new InterruptedException();
178
							throw new InterruptedException();
179
						}
180
					}
181
				};
182
				fHierarchyRefreshNeeded= true;
183
				context.run(true, true, op);
184
				fHierarchyRefreshNeeded= false;
185
			} else {				
186
				final String label= Messages.format(TypeHierarchyMessages.TypeHierarchyLifeCycle_computeInput, JavaElementLabels.getElementLabel(element, JavaElementLabels.ALL_DEFAULT));
187
				fRefreshHierarchyJob= new Job(label) {					
188
					/*
189
					 * @see org.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.IProgressMonitor)
190
					 */
191
					public IStatus run(IProgressMonitor pm) {
192
						pm.beginTask(label, LONG);
193
						try {
194
							doHierarchyRefreshBackground(element, pm);
195
						} catch (OperationCanceledException e) {
196
							fTypeHierarchyViewPart.setCanceledViewer(fIsCancelImplicit);
197
							return Status.CANCEL_STATUS;
198
						} catch (JavaModelException e) {
199
							return e.getStatus();
200
						} finally {
201
							fHierarchyRefreshNeeded= true;
202
							pm.done();
203
						}
204
						return Status.OK_STATUS;
118
					}
205
					}
206
				};
207
				fRefreshHierarchyJob.setUser(true);
208
				IWorkbenchSiteProgressService progressService= (IWorkbenchSiteProgressService)fTypeHierarchyViewPart.getSite()
209
														.getAdapter(IWorkbenchSiteProgressService.class);
210
				progressService.schedule(fRefreshHierarchyJob, 0);
211
212
			}
213
		}
214
	}
215
216
	/**
217
	 * Returns <code>true</code> if the refresh job is running, <code>false</code> otherwise.
218
	 * 
219
	 * @return <code>true</code> if the refresh job is running, <code>false</code> otherwise
220
	 * 
221
	 * @since 3.6
222
	 */
223
	public boolean isRefreshJob() {
224
		return fRefreshHierarchyJob != null;
225
	}
226
227
	/**
228
	 * Refreshes the hierarchy in the background and updates the hierarchy viewer asynchronously in
229
	 * the UI thread.
230
	 * 
231
	 * @param element the java element on which the hierarchy is computed
232
	 * @param pm the progress monitor
233
	 * @throws JavaModelException if the java element does not exist or if an exception occurs while
234
	 *             accessing its corresponding resource.
235
	 * 
236
	 * @since 3.6
237
	 */
238
	protected void doHierarchyRefreshBackground(final IJavaElement element, final IProgressMonitor pm) throws JavaModelException {
239
		doHierarchyRefresh(element, pm);
240
		if (!pm.isCanceled()) {
241
			Display.getDefault().asyncExec(new Runnable() {
242
				/*
243
				 * @see java.lang.Runnable#run()
244
				 */
245
				public void run() {
246
					fTypeHierarchyViewPart.setViewersInput();
247
					fTypeHierarchyViewPart.updateViewers();
119
				}
248
				}
120
			};
249
			});
121
			fHierarchyRefreshNeeded= true;
122
			context.run(true, true, op);
123
			fHierarchyRefreshNeeded= false;
124
		}
250
		}
125
	}
251
	}
126
252
Lines 160-166 Link Here
160
	}
286
	}
161
287
162
288
163
	public synchronized void doHierarchyRefresh(IJavaElement element, IProgressMonitor pm) throws JavaModelException {
289
	public void doHierarchyRefresh(IJavaElement element, IProgressMonitor pm) throws JavaModelException {
164
		boolean hierachyCreationNeeded= (fHierarchy == null || !element.equals(fInputElement));
290
		boolean hierachyCreationNeeded= (fHierarchy == null || !element.equals(fInputElement));
165
		// to ensure the order of the two listeners always remove / add listeners on operations
291
		// to ensure the order of the two listeners always remove / add listeners on operations
166
		// on type hierarchies
292
		// on type hierarchies
Lines 176-181 Link Here
176
			fInputElement= element;
302
			fInputElement= element;
177
		} else {
303
		} else {
178
			fHierarchy.refresh(pm);
304
			fHierarchy.refresh(pm);
305
			if (pm != null && pm.isCanceled())
306
				throw new OperationCanceledException();
179
		}
307
		}
180
		fHierarchy.addTypeHierarchyChangedListener(this);
308
		fHierarchy.addTypeHierarchyChangedListener(this);
181
		JavaCore.addElementChangedListener(this);
309
		JavaCore.addElementChangedListener(this);
(-)ui/org/eclipse/jdt/internal/ui/typehierarchy/TypeHierarchyMessages.java (+1 lines)
Lines 72-77 Link Here
72
	public static String TypeHierarchyViewPart_ws_tooltip;
72
	public static String TypeHierarchyViewPart_ws_tooltip;
73
	public static String TypeHierarchyViewPart_restoreinput;
73
	public static String TypeHierarchyViewPart_restoreinput;
74
	public static String TypeHierarchyViewPart_layout_submenu;
74
	public static String TypeHierarchyViewPart_layout_submenu;
75
	public static String TypeHierarchyLifeCycle_computeInput;
75
	public static String ToggleViewAction_subtypes_label;
76
	public static String ToggleViewAction_subtypes_label;
76
	public static String ToggleViewAction_subtypes_tooltip;
77
	public static String ToggleViewAction_subtypes_tooltip;
77
	public static String ToggleViewAction_subtypes_description;
78
	public static String ToggleViewAction_subtypes_description;
(-)ui/org/eclipse/jdt/internal/ui/typehierarchy/TypeHierarchyMessages.properties (+1 lines)
Lines 62-67 Link Here
62
SortByDefiningTypeAction_label=Sort by the Defining Type
62
SortByDefiningTypeAction_label=Sort by the Defining Type
63
SortByDefiningTypeAction_tooltip=Sort Methods by the Defining Type
63
SortByDefiningTypeAction_tooltip=Sort Methods by the Defining Type
64
SortByDefiningTypeAction_description=Sort methods by the defining type
64
SortByDefiningTypeAction_description=Sort methods by the defining type
65
TypeHierarchyLifeCycle_computeInput=Computing type hierarchy of ''{0}''...
65
66
66
TypeHierarchyViewPart_error_title=Open Type Hierarchy
67
TypeHierarchyViewPart_error_title=Open Type Hierarchy
67
TypeHierarchyViewPart_createinput=Creating type hierarchy of ''{0}''...
68
TypeHierarchyViewPart_createinput=Creating type hierarchy of ''{0}''...
(-)ui/org/eclipse/jdt/internal/ui/typehierarchy/TypeHierarchyViewPart.java (-31 / +118 lines)
Lines 242-247 Link Here
242
242
243
	private OpenAction fOpenAction;
243
	private OpenAction fOpenAction;
244
244
245
	/**
246
	 * Indicates whether the restore job was canceled implicitly.
247
	 * 
248
	 * @since 3.6
249
	 */
250
	private boolean fIsCancelImplicit= false;
251
252
	/**
253
	 * Indicates whether the current viewer shown is the empty viewer.
254
	 * 
255
	 * @since 3.6
256
	 */
257
	private boolean fIsShowingEmptyViewer= true;
258
245
259
246
	public TypeHierarchyViewPart() {
260
	public TypeHierarchyViewPart() {
247
		fSelectedType= null;
261
		fSelectedType= null;
Lines 251-257 Link Here
251
		fSelectInEditor= true;
265
		fSelectInEditor= true;
252
		fRestoreStateJob= null;
266
		fRestoreStateJob= null;
253
267
254
		fHierarchyLifeCycle= new TypeHierarchyLifeCycle();
268
		fHierarchyLifeCycle= new TypeHierarchyLifeCycle(this);
255
		fTypeHierarchyLifeCycleListener= new ITypeHierarchyLifeCycleListener() {
269
		fTypeHierarchyLifeCycleListener= new ITypeHierarchyLifeCycleListener() {
256
			public void typeHierarchyChanged(TypeHierarchyLifeCycle typeHierarchy, IType[] changedTypes) {
270
			public void typeHierarchyChanged(TypeHierarchyLifeCycle typeHierarchy, IType[] changedTypes) {
257
				doTypeHierarchyChanged(typeHierarchy, changedTypes);
271
				doTypeHierarchyChanged(typeHierarchy, changedTypes);
Lines 511-516 Link Here
511
		synchronized (this) {
525
		synchronized (this) {
512
			if (fRestoreStateJob != null) {
526
			if (fRestoreStateJob != null) {
513
				fRestoreStateJob.cancel();
527
				fRestoreStateJob.cancel();
528
				fIsCancelImplicit= true;
514
				try {
529
				try {
515
					fRestoreStateJob.join();
530
					fRestoreStateJob.join();
516
				} catch (InterruptedException e) {
531
				} catch (InterruptedException e) {
Lines 529-534 Link Here
529
		if (inputElement == null) {
544
		if (inputElement == null) {
530
			clearInput();
545
			clearInput();
531
		} else {
546
		} else {
547
			if (!inputElement.equals(prevInput)) {
548
				for (int i= 0; i < fAllViewers.length; i++) {
549
					fAllViewers[i].setInput(null);
550
				}
551
			}
532
			fInputElement= inputElement;
552
			fInputElement= inputElement;
533
			fNoHierarchyShownLabel.setText(Messages.format(TypeHierarchyMessages.TypeHierarchyViewPart_createinput, JavaElementLabels.getElementLabel(inputElement, JavaElementLabels.ALL_DEFAULT)));
553
			fNoHierarchyShownLabel.setText(Messages.format(TypeHierarchyMessages.TypeHierarchyViewPart_createinput, JavaElementLabels.getElementLabel(inputElement, JavaElementLabels.ALL_DEFAULT)));
534
			try {
554
			try {
Lines 537-570 Link Here
537
			} catch (InvocationTargetException e) {
557
			} catch (InvocationTargetException e) {
538
				ExceptionHandler.handle(e, getSite().getShell(), TypeHierarchyMessages.TypeHierarchyViewPart_exception_title, TypeHierarchyMessages.TypeHierarchyViewPart_exception_message);
558
				ExceptionHandler.handle(e, getSite().getShell(), TypeHierarchyMessages.TypeHierarchyViewPart_exception_title, TypeHierarchyMessages.TypeHierarchyViewPart_exception_message);
539
				clearInput();
559
				clearInput();
540
				return;
560
				return;// panic code. This code wont be executed.
541
			} catch (InterruptedException e) {
561
			} catch (InterruptedException e) {
542
				fNoHierarchyShownLabel.setText(TypeHierarchyMessages.TypeHierarchyViewPart_empty);
562
				fNoHierarchyShownLabel.setText(TypeHierarchyMessages.TypeHierarchyViewPart_empty);
543
				return;
563
				return;// panic code. This code wont be executed.
544
			}
564
			}
545
565
546
			if (inputElement.getElementType() != IJavaElement.TYPE) {
566
			if (inputElement.getElementType() != IJavaElement.TYPE) {
547
				setHierarchyMode(HIERARCHY_MODE_CLASSIC);
567
				setHierarchyMode(HIERARCHY_MODE_CLASSIC);
548
			}
568
			}
549
			// turn off member filtering
569
			updateViewers();
550
			fSelectInEditor= false;
551
			setMemberFilter(null);
552
			internalSelectType(null, false); // clear selection
553
			fIsEnableMemberFilter= false;
554
			if (!inputElement.equals(prevInput)) {
555
				updateHierarchyViewer(true);
556
			}
557
			IType root= getSelectableType(inputElement);
558
			internalSelectType(root, true);
559
			updateMethodViewer(root);
560
			updateToolbarButtons();
561
			updateToolTipAndDescription();
562
			showMembersInHierarchy(false);
563
			fPagebook.showPage(fTypeMethodsSplitter);
564
			fSelectInEditor= true;
565
		}
570
		}
566
	}
571
	}
567
572
573
	/**
574
	 * Updates the viewers, toolbar buttons and tooltip.
575
	 * 
576
	 * @since 3.6
577
	 */
578
	public void updateViewers() {
579
		if (!fHierarchyLifeCycle.isRefreshJob()) {
580
			setViewersInput();
581
		}
582
		setViewerVisibility(true);
583
		// turn off member filtering
584
		fSelectInEditor= false;
585
		setMemberFilter(null);
586
		internalSelectType(null, false); // clear selection
587
		fIsEnableMemberFilter= false;
588
		updateHierarchyViewer(true);
589
		IType root= getSelectableType(fInputElement);
590
		internalSelectType(root, true);
591
		updateMethodViewer(root);
592
		updateToolbarButtons();
593
		updateToolTipAndDescription();
594
		showMembersInHierarchy(false);
595
		fPagebook.showPage(fTypeMethodsSplitter);		
596
		fSelectInEditor= true;		
597
	}
598
568
	private void processOutstandingEvents() {
599
	private void processOutstandingEvents() {
569
		Display display= getDisplay();
600
		Display display= getDisplay();
570
		if (display != null && !display.isDisposed())
601
		if (display != null && !display.isDisposed())
Lines 1086-1092 Link Here
1086
	/*
1117
	/*
1087
	 * Toggles between the empty viewer page and the hierarchy
1118
	 * Toggles between the empty viewer page and the hierarchy
1088
	 */
1119
	 */
1089
	private void setViewerVisibility(boolean showHierarchy) {
1120
	public void setViewerVisibility(boolean showHierarchy) {
1090
		if (showHierarchy) {
1121
		if (showHierarchy) {
1091
			fViewerbook.showPage(getCurrentViewer().getControl());
1122
			fViewerbook.showPage(getCurrentViewer().getControl());
1092
		} else {
1123
		} else {
Lines 1124-1130 Link Here
1124
	 * <code>updateHierarchyViewer<code> brings up the correct view and refreshes
1155
	 * <code>updateHierarchyViewer<code> brings up the correct view and refreshes
1125
	 * the current tree
1156
	 * the current tree
1126
	 */
1157
	 */
1127
	private void updateHierarchyViewer(final boolean doExpand) {
1158
	public void updateHierarchyViewer(final boolean doExpand) {
1128
		if (fInputElement == null) {
1159
		if (fInputElement == null) {
1129
			fNoHierarchyShownLabel.setText(TypeHierarchyMessages.TypeHierarchyViewPart_empty);
1160
			fNoHierarchyShownLabel.setText(TypeHierarchyMessages.TypeHierarchyViewPart_empty);
1130
			fPagebook.showPage(fNoHierarchyShownLabel);
1161
			fPagebook.showPage(fNoHierarchyShownLabel);
Lines 1139-1145 Link Here
1139
				if (!isChildVisible(fViewerbook, getCurrentViewer().getControl())) {
1170
				if (!isChildVisible(fViewerbook, getCurrentViewer().getControl())) {
1140
					setViewerVisibility(true);
1171
					setViewerVisibility(true);
1141
				}
1172
				}
1142
			} else {
1173
			} else if (!fIsShowingEmptyViewer) {//Show the empty hierarchy viewer till fresh computation is done.
1143
				fEmptyTypesViewer.setText(Messages.format(TypeHierarchyMessages.TypeHierarchyViewPart_nodecl, JavaElementLabels.getElementLabel(fInputElement, JavaElementLabels.ALL_DEFAULT)));
1174
				fEmptyTypesViewer.setText(Messages.format(TypeHierarchyMessages.TypeHierarchyViewPart_nodecl, JavaElementLabels.getElementLabel(fInputElement, JavaElementLabels.ALL_DEFAULT)));
1144
				setViewerVisibility(false);
1175
				setViewerVisibility(false);
1145
			}
1176
			}
Lines 1566-1571 Link Here
1566
						} catch (JavaModelException e) {
1597
						} catch (JavaModelException e) {
1567
							return e.getStatus();
1598
							return e.getStatus();
1568
						} catch (OperationCanceledException e) {
1599
						} catch (OperationCanceledException e) {
1600
							setCanceledViewer(fIsCancelImplicit);
1569
							return Status.CANCEL_STATUS;
1601
							return Status.CANCEL_STATUS;
1570
						}
1602
						}
1571
						return Status.OK_STATUS;
1603
						return Status.OK_STATUS;
Lines 1579-1595 Link Here
1579
	private void doRestoreInBackground(final IMemento memento, final IJavaElement hierarchyInput, IProgressMonitor monitor) throws JavaModelException {
1611
	private void doRestoreInBackground(final IMemento memento, final IJavaElement hierarchyInput, IProgressMonitor monitor) throws JavaModelException {
1580
		fHierarchyLifeCycle.doHierarchyRefresh(hierarchyInput, monitor);
1612
		fHierarchyLifeCycle.doHierarchyRefresh(hierarchyInput, monitor);
1581
		final boolean doRestore= !monitor.isCanceled();
1613
		final boolean doRestore= !monitor.isCanceled();
1582
		Display.getDefault().asyncExec(new Runnable() {
1614
		if (doRestore) {
1583
			public void run() {
1615
			Display.getDefault().asyncExec(new Runnable() {
1584
				// running async: check first if view still exists
1616
				public void run() {
1585
				if (fPagebook != null && !fPagebook.isDisposed()) {
1617
					// running async: check first if view still exists
1586
					if (doRestore)
1618
					if (fPagebook != null && !fPagebook.isDisposed()) {
1587
						doRestoreState(memento, hierarchyInput);
1619
						doRestoreState(memento, hierarchyInput);
1588
					else
1620
					}
1589
						fNoHierarchyShownLabel.setText(TypeHierarchyMessages.TypeHierarchyViewPart_empty);
1590
				}
1621
				}
1591
			}
1622
			});
1592
		});
1623
		}
1593
	}
1624
	}
1594
1625
1595
1626
Lines 1602-1607 Link Here
1602
		}
1633
		}
1603
1634
1604
		fWorkingSetActionGroup.restoreState(memento);
1635
		fWorkingSetActionGroup.restoreState(memento);
1636
		setShowingEmptyViewer(false);
1605
		setInputElement(input);
1637
		setInputElement(input);
1606
1638
1607
		Integer viewerIndex= memento.getInteger(TAG_VIEW);
1639
		Integer viewerIndex= memento.getInteger(TAG_VIEW);
Lines 1640-1645 Link Here
1640
	}
1672
	}
1641
1673
1642
	/**
1674
	/**
1675
	 * Sets whether the previous viewer shown was an empty viewer.
1676
	 * 
1677
	 * @param isShowingEmptyViewer <code>true</code> if the previous viewer was empty,
1678
	 *            <code>false</code> otherwise
1679
	 * 
1680
	 * @since 3.6
1681
	 */
1682
	private void setShowingEmptyViewer(boolean isShowingEmptyViewer) {
1683
		fIsShowingEmptyViewer= isShowingEmptyViewer;
1684
1685
	}
1686
1687
	/**
1643
	 * View part becomes visible.
1688
	 * View part becomes visible.
1644
	 *
1689
	 *
1645
	 * @param isVisible <code>true</code> if visible
1690
	 * @param isVisible <code>true</code> if visible
Lines 1731-1734 Link Here
1731
		fNeedRefresh= false;
1776
		fNeedRefresh= false;
1732
	}
1777
	}
1733
1778
1779
	/**
1780
	 * Sets the empty viewer if the user cancels the computation.
1781
	 * 
1782
	 * @param isCancelImplicit <code>false</code> when the user cancels the computation explicitly,
1783
	 *            <code>true</code> otherwise
1784
	 * 
1785
	 * @since 3.6
1786
	 */
1787
	public void setCanceledViewer(final boolean isCancelImplicit) {
1788
		if (!isCancelImplicit) {
1789
			Display.getDefault().asyncExec(new Runnable() {
1790
				public void run() {
1791
					clearInput();
1792
					setShowingEmptyViewer(true);
1793
				}
1794
			});
1795
		}
1796
	}
1797
1798
	/**
1799
	 * Returns the type hierarchy life cycle.
1800
	 *
1801
	 * @return the type hierarchy life cycle
1802
	 *
1803
	 * @since 3.6
1804
	 */
1805
	public TypeHierarchyLifeCycle getTypeHierarchyLifeCycle() {
1806
		return fHierarchyLifeCycle;
1807
1808
	}
1809
1810
	/**
1811
	 * Sets the input for all the hierarchy viewers with their respective viewer instances.
1812
	 * 
1813
	 * @since 3.6
1814
	 */
1815
	public void setViewersInput() {
1816
		for (int i= 0; i < fAllViewers.length; i++) {
1817
			fAllViewers[i].setInput(fAllViewers[i]);
1818
		}
1819
		setShowingEmptyViewer(false);
1820
	}	
1734
}
1821
}

Return to bug 30881