Lines 559-565
Link Here
|
559 |
Platform.run(new SafeRunnable(WorkbenchMessages.WorkbenchPage_ErrorActivatingView) { |
559 |
Platform.run(new SafeRunnable(WorkbenchMessages.WorkbenchPage_ErrorActivatingView) { |
560 |
public void run() { |
560 |
public void run() { |
561 |
if (part != null) { |
561 |
if (part != null) { |
562 |
//part.setFocus(); |
562 |
part.setFocus(); |
563 |
PartPane pane = getPane(part); |
563 |
PartPane pane = getPane(part); |
564 |
pane.setFocus(); |
564 |
pane.setFocus(); |
565 |
PartSite site = (PartSite) part.getSite(); |
565 |
PartSite site = (PartSite) part.getSite(); |
Lines 1101-1114
Link Here
|
1101 |
* @param ref the editor to make active, or <code>null</code> for no active editor |
1101 |
* @param ref the editor to make active, or <code>null</code> for no active editor |
1102 |
*/ |
1102 |
*/ |
1103 |
private void makeActiveEditor(IEditorReference ref) { |
1103 |
private void makeActiveEditor(IEditorReference ref) { |
1104 |
if (ref == getActiveEditor()) { |
1104 |
if (ref == getActiveEditorReference() && !isMultiReference(ref)) { |
1105 |
return; |
1105 |
return; |
1106 |
} |
1106 |
} |
1107 |
|
1107 |
|
1108 |
IEditorPart part = (ref == null) ? null : ref.getEditor(true); |
1108 |
IEditorPart part = (IEditorPart)getPart(ref, true); |
1109 |
|
1109 |
|
1110 |
if (part != null) { |
1110 |
if (part != null) { |
1111 |
editorMgr.setVisibleEditor(ref, false); |
1111 |
editorMgr.setVisibleEditor(ref, true); |
1112 |
navigationHistory.markEditor(part); |
1112 |
navigationHistory.markEditor(part); |
1113 |
} |
1113 |
} |
1114 |
|
1114 |
|
Lines 1473-1478
Link Here
|
1473 |
if (isZoomed()) |
1473 |
if (isZoomed()) |
1474 |
zoomOut(); |
1474 |
zoomOut(); |
1475 |
|
1475 |
|
|
|
1476 |
makeActiveEditor(null); |
1476 |
makeActive(null); |
1477 |
makeActive(null); |
1477 |
|
1478 |
|
1478 |
// Close and dispose the editors. |
1479 |
// Close and dispose the editors. |
Lines 2171-2176
Link Here
|
2171 |
* This method is called when the page is deactivated. |
2172 |
* This method is called when the page is deactivated. |
2172 |
*/ |
2173 |
*/ |
2173 |
protected void onDeactivate() { |
2174 |
protected void onDeactivate() { |
|
|
2175 |
makeActiveEditor(null); |
2174 |
makeActive(null); |
2176 |
makeActive(null); |
2175 |
if (getActivePerspective() != null) |
2177 |
if (getActivePerspective() != null) |
2176 |
getActivePerspective().onDeactivate(); |
2178 |
getActivePerspective().onDeactivate(); |
Lines 2467-2472
Link Here
|
2467 |
if (!certifyPart(part)) |
2469 |
if (!certifyPart(part)) |
2468 |
return; |
2470 |
return; |
2469 |
|
2471 |
|
|
|
2472 |
if (part!=null && part instanceof MultiEditor) { |
2473 |
part = ((MultiEditor)part).getActiveEditor(); |
2474 |
} |
2475 |
|
2470 |
// Real work. |
2476 |
// Real work. |
2471 |
setActivePart(part); |
2477 |
setActivePart(part); |
2472 |
} |
2478 |
} |
Lines 2814-2820
Link Here
|
2814 |
} |
2820 |
} |
2815 |
|
2821 |
|
2816 |
if (partBeingActivated != null) { |
2822 |
if (partBeingActivated != null) { |
2817 |
if (partBeingActivated.getPart(false) != newPart) { |
2823 |
if (getPart(partBeingActivated, false) != newPart) { |
2818 |
WorkbenchPlugin.log(new RuntimeException(NLS.bind( |
2824 |
WorkbenchPlugin.log(new RuntimeException(NLS.bind( |
2819 |
"WARNING: Prevented recursive attempt to activate part {0} while still in the middle of activating part {1}", //$NON-NLS-1$ |
2825 |
"WARNING: Prevented recursive attempt to activate part {0} while still in the middle of activating part {1}", //$NON-NLS-1$ |
2820 |
getId(newPart), getId(partBeingActivated)))); |
2826 |
getId(newPart), getId(partBeingActivated)))); |
Lines 2848-2855
Link Here
|
2848 |
if (newPart != null) { |
2854 |
if (newPart != null) { |
2849 |
activationList.setActive(newPart); |
2855 |
activationList.setActive(newPart); |
2850 |
if (newPart instanceof IEditorPart) { |
2856 |
if (newPart instanceof IEditorPart) { |
2851 |
IEditorReference ref = (IEditorReference) getReference(newPart); |
2857 |
makeActiveEditor((IEditorReference)partref); |
2852 |
makeActiveEditor(ref); |
|
|
2853 |
} |
2858 |
} |
2854 |
} |
2859 |
} |
2855 |
activatePart(newPart); |
2860 |
activatePart(newPart); |
Lines 3471-3497
Link Here
|
3471 |
*/ |
3476 |
*/ |
3472 |
void setActive(IWorkbenchPart part) { |
3477 |
void setActive(IWorkbenchPart part) { |
3473 |
if (parts.size() <= 0) |
3478 |
if (parts.size() <= 0) |
3474 |
return; |
3479 |
return; |
3475 |
PartPane pane = ((PartSite) part.getSite()).getPane(); |
3480 |
IWorkbenchPartReference ref = getReference(part); |
3476 |
if (pane instanceof MultiEditorInnerPane) { |
3481 |
if (ref != null) { |
3477 |
MultiEditorInnerPane innerPane = (MultiEditorInnerPane) pane; |
3482 |
if (ref == parts.get(parts.size() - 1)) |
3478 |
setActive(innerPane.getParentPane().getPartReference().getPart( |
3483 |
return; |
3479 |
true)); |
3484 |
parts.remove(ref); |
3480 |
} else { |
3485 |
parts.add(ref); |
3481 |
IWorkbenchPartReference ref = getReference(part); |
3486 |
} |
3482 |
if (ref != null) { |
|
|
3483 |
if (ref == parts.get(parts.size() - 1)) |
3484 |
return; |
3485 |
parts.remove(ref); |
3486 |
parts.add(ref); |
3487 |
} |
3488 |
} |
3489 |
} |
3487 |
} |
3490 |
|
3488 |
|
3491 |
/* |
3489 |
/* |
3492 |
* Ensures that the given part appears AFTER any other part in the same |
3490 |
* Ensures that the given part appears AFTER any other part in the same |
3493 |
* container. |
3491 |
* container. |
3494 |
*/ |
3492 |
*/ |
3495 |
void bringToTop(IWorkbenchPartReference ref) { |
3493 |
void bringToTop(IWorkbenchPartReference ref) { |
3496 |
ILayoutContainer targetContainer = getContainer(ref); |
3494 |
ILayoutContainer targetContainer = getContainer(ref); |
3497 |
|
3495 |
|
Lines 4286-4289
Link Here
|
4286 |
|
4284 |
|
4287 |
return isPartVisible(part); |
4285 |
return isPartVisible(part); |
4288 |
} |
4286 |
} |
|
|
4287 |
|
4288 |
/** |
4289 |
* Return the part for this reference. A convenience method |
4290 |
* that handles <code>null</code> cases. |
4291 |
* |
4292 |
* Try and deal with the MultiEditor ... which has implications for |
4293 |
* which "part" the partListeners should be notified about. |
4294 |
* |
4295 |
* @param ref The reference that might contain a MultiEditor. This |
4296 |
* can be <code>null</code>. |
4297 |
* @param restore <code>true</code> to restore the part |
4298 |
* @return the workbench part, the inner part if it's a MultiEditor, |
4299 |
* or <code>null</code> if the reference was <code>null</code> or |
4300 |
* restore was <code>false</code> and the part hadn't been activated yet. |
4301 |
*/ |
4302 |
protected IWorkbenchPart getPart(IWorkbenchPartReference ref, |
4303 |
boolean restore) { |
4304 |
if (ref==null) { |
4305 |
return null; |
4306 |
} |
4307 |
IWorkbenchPart part = ref.getPart(restore); |
4308 |
if (part != null && part instanceof MultiEditor) { |
4309 |
part = ((MultiEditor) part).getActiveEditor(); |
4310 |
} |
4311 |
return part; |
4312 |
} |
4313 |
|
4314 |
/** |
4315 |
* Check a reference to see if it's a ref to a MultiEditor. |
4316 |
* @param ref the reference to check. It can be <code>null</code>. |
4317 |
* @return true if the reference is to a MultiEditor. |
4318 |
*/ |
4319 |
protected boolean isMultiReference(IWorkbenchPartReference ref) { |
4320 |
return ref instanceof EditorReference |
4321 |
&& ((EditorReference) ref).isMultiReference(); |
4322 |
} |
4289 |
} |
4323 |
} |