Lines 20-37
Link Here
|
20 |
import java.util.ListIterator; |
20 |
import java.util.ListIterator; |
21 |
import java.util.Map; |
21 |
import java.util.Map; |
22 |
|
22 |
|
23 |
import org.eclipse.osgi.util.NLS; |
|
|
24 |
|
25 |
import org.eclipse.swt.custom.BusyIndicator; |
26 |
import org.eclipse.swt.program.Program; |
27 |
import org.eclipse.swt.widgets.Composite; |
28 |
import org.eclipse.swt.widgets.Display; |
29 |
import org.eclipse.swt.widgets.Shell; |
30 |
|
31 |
import org.eclipse.core.commands.AbstractHandler; |
23 |
import org.eclipse.core.commands.AbstractHandler; |
32 |
import org.eclipse.core.commands.ExecutionEvent; |
24 |
import org.eclipse.core.commands.ExecutionEvent; |
33 |
import org.eclipse.core.commands.IHandler; |
25 |
import org.eclipse.core.commands.IHandler; |
34 |
|
|
|
35 |
import org.eclipse.core.runtime.Assert; |
26 |
import org.eclipse.core.runtime.Assert; |
36 |
import org.eclipse.core.runtime.CoreException; |
27 |
import org.eclipse.core.runtime.CoreException; |
37 |
import org.eclipse.core.runtime.IConfigurationElement; |
28 |
import org.eclipse.core.runtime.IConfigurationElement; |
Lines 45-51
Link Here
|
45 |
import org.eclipse.core.runtime.SubProgressMonitor; |
36 |
import org.eclipse.core.runtime.SubProgressMonitor; |
46 |
import org.eclipse.core.runtime.dynamichelpers.IExtensionChangeHandler; |
37 |
import org.eclipse.core.runtime.dynamichelpers.IExtensionChangeHandler; |
47 |
import org.eclipse.core.runtime.dynamichelpers.IExtensionTracker; |
38 |
import org.eclipse.core.runtime.dynamichelpers.IExtensionTracker; |
48 |
|
|
|
49 |
import org.eclipse.jface.dialogs.IDialogConstants; |
39 |
import org.eclipse.jface.dialogs.IDialogConstants; |
50 |
import org.eclipse.jface.dialogs.MessageDialog; |
40 |
import org.eclipse.jface.dialogs.MessageDialog; |
51 |
import org.eclipse.jface.internal.provisional.action.ICoolBarManager2; |
41 |
import org.eclipse.jface.internal.provisional.action.ICoolBarManager2; |
Lines 60-66
Link Here
|
60 |
import org.eclipse.jface.util.SafeRunnable; |
50 |
import org.eclipse.jface.util.SafeRunnable; |
61 |
import org.eclipse.jface.viewers.ArrayContentProvider; |
51 |
import org.eclipse.jface.viewers.ArrayContentProvider; |
62 |
import org.eclipse.jface.window.IShellProvider; |
52 |
import org.eclipse.jface.window.IShellProvider; |
63 |
|
53 |
import org.eclipse.osgi.util.NLS; |
|
|
54 |
import org.eclipse.swt.custom.BusyIndicator; |
55 |
import org.eclipse.swt.program.Program; |
56 |
import org.eclipse.swt.widgets.Composite; |
57 |
import org.eclipse.swt.widgets.Display; |
58 |
import org.eclipse.swt.widgets.Shell; |
64 |
import org.eclipse.ui.ActiveShellExpression; |
59 |
import org.eclipse.ui.ActiveShellExpression; |
65 |
import org.eclipse.ui.IEditorActionBarContributor; |
60 |
import org.eclipse.ui.IEditorActionBarContributor; |
66 |
import org.eclipse.ui.IEditorDescriptor; |
61 |
import org.eclipse.ui.IEditorDescriptor; |
Lines 100-105
Link Here
|
100 |
import org.eclipse.ui.internal.part.NullEditorInput; |
95 |
import org.eclipse.ui.internal.part.NullEditorInput; |
101 |
import org.eclipse.ui.internal.registry.EditorDescriptor; |
96 |
import org.eclipse.ui.internal.registry.EditorDescriptor; |
102 |
import org.eclipse.ui.internal.registry.EditorRegistry; |
97 |
import org.eclipse.ui.internal.registry.EditorRegistry; |
|
|
98 |
import org.eclipse.ui.internal.spliteditor.SplitMultiEditorInput; |
103 |
import org.eclipse.ui.internal.tweaklets.TabBehaviour; |
99 |
import org.eclipse.ui.internal.tweaklets.TabBehaviour; |
104 |
import org.eclipse.ui.internal.tweaklets.Tweaklets; |
100 |
import org.eclipse.ui.internal.tweaklets.Tweaklets; |
105 |
import org.eclipse.ui.internal.util.Util; |
101 |
import org.eclipse.ui.internal.util.Util; |
Lines 638-643
Link Here
|
638 |
WorkbenchMessages.EditorManager_unknownEditorIDMessage, |
634 |
WorkbenchMessages.EditorManager_unknownEditorIDMessage, |
639 |
editorId)); |
635 |
editorId)); |
640 |
} |
636 |
} |
|
|
637 |
|
638 |
// Replace with split editor... |
639 |
if (desc.isSplitEditor()) { |
640 |
if (!(input instanceof MultiEditorInput)) { |
641 |
input = new SplitMultiEditorInput(input, editorId); |
642 |
desc = (EditorDescriptor) reg.findEditor("org.eclipse.ui.editors.SplitMultiEditor"); //$NON-NLS-1$ |
643 |
Assert.isNotNull(desc); |
644 |
} |
645 |
} |
641 |
|
646 |
|
642 |
IEditorReference result = openEditorFromDescriptor(desc, input, editorState); |
647 |
IEditorReference result = openEditorFromDescriptor(desc, input, editorState); |
643 |
return result; |
648 |
return result; |
Lines 742-778
Link Here
|
742 |
* the AbstractMultiEditor input |
747 |
* the AbstractMultiEditor input |
743 |
* @return the array of inner references to store in the AbstractMultiEditor reference |
748 |
* @return the array of inner references to store in the AbstractMultiEditor reference |
744 |
*/ |
749 |
*/ |
745 |
IEditorReference[] openMultiEditor(final IEditorReference ref, |
750 |
void openMultiEditor(final EditorReference ref, |
746 |
final AbstractMultiEditor part, final MultiEditorInput input) |
751 |
final AbstractMultiEditor part, final MultiEditorInput input) |
747 |
throws PartInitException { |
752 |
throws PartInitException { |
748 |
|
753 |
|
749 |
String[] editorArray = input.getEditors(); |
754 |
// Retrieve all inner references, creating them on demand if necessary |
750 |
IEditorInput[] inputArray = input.getInput(); |
755 |
ArrayList innerRefList = ref.internalGetMultiEditorChildren(); |
751 |
|
|
|
752 |
// find all descriptors |
753 |
EditorDescriptor[] descArray = new EditorDescriptor[editorArray.length]; |
754 |
IEditorReference refArray[] = new IEditorReference[editorArray.length]; |
755 |
IEditorPart partArray[] = new IEditorPart[editorArray.length]; |
756 |
|
756 |
|
757 |
IEditorRegistry reg = getEditorRegistry(); |
757 |
// Create all inner editors |
758 |
for (int i = 0; i < editorArray.length; i++) { |
758 |
IEditorPart partArray[] = new IEditorPart[innerRefList.size()]; |
759 |
EditorDescriptor innerDesc = (EditorDescriptor) reg |
759 |
for (int i = 0; i < innerRefList.size(); i++) { |
760 |
.findEditor(editorArray[i]); |
760 |
InnerEditor innerRef = (InnerEditor) innerRefList.get(i); |
761 |
if (innerDesc == null) { |
761 |
innerRef.setOuterEditorPart(part); |
762 |
throw new PartInitException(NLS.bind( |
|
|
763 |
WorkbenchMessages.EditorManager_unknownEditorIDMessage, |
764 |
editorArray[i])); |
765 |
} |
766 |
descArray[i] = innerDesc; |
767 |
InnerEditor innerRef = new InnerEditor(ref, part, inputArray[i], |
768 |
descArray[i]); |
769 |
refArray[i] = innerRef; |
770 |
partArray[i] = innerRef.getEditor(true); |
762 |
partArray[i] = innerRef.getEditor(true); |
771 |
} |
763 |
} |
|
|
764 |
|
765 |
// Register the new inner editors with their parent multi editor. |
772 |
part.setChildren(partArray); |
766 |
part.setChildren(partArray); |
773 |
return refArray; |
767 |
} |
|
|
768 |
|
769 |
IEditorReference addMultiEditorChild(final IEditorReference ref, |
770 |
final AbstractMultiEditor part, String innerEditor, |
771 |
IEditorInput innerEditorInput) throws PartInitException { |
772 |
|
773 |
InnerEditor innerRef = createMultiEditorChild(ref, innerEditor, innerEditorInput); |
774 |
innerRef.setOuterEditorPart(part); |
775 |
return innerRef; |
774 |
} |
776 |
} |
775 |
|
777 |
|
|
|
778 |
InnerEditor createMultiEditorChild(final IEditorReference ref, |
779 |
String innerEditor, IEditorInput innerEditorInput) throws PartInitException { |
780 |
IEditorRegistry reg = getEditorRegistry(); |
781 |
EditorDescriptor innerDesc = (EditorDescriptor) reg.findEditor(innerEditor); |
782 |
if (innerDesc == null) { |
783 |
throw new PartInitException(NLS.bind( |
784 |
WorkbenchMessages.EditorManager_unknownEditorIDMessage, |
785 |
innerEditor)); |
786 |
} |
787 |
InnerEditor innerRef = new InnerEditor(ref, innerEditorInput, innerDesc); |
788 |
// Instead of mimicking the behavior of the openMultiEditor method |
789 |
// precisely, we call getEditor(true) to create the editor part later |
790 |
// from the EditorReference, and return it to the MultiEditor instance |
791 |
// from there. |
792 |
//IEditorPart innerPart = innerRef.getEditor(true); |
793 |
//part.childAdded(innerPart); |
794 |
return innerRef; |
795 |
} |
796 |
|
776 |
/* |
797 |
/* |
777 |
* Opens an editor part. |
798 |
* Opens an editor part. |
778 |
*/ |
799 |
*/ |
Lines 1427-1438
Link Here
|
1427 |
|
1448 |
|
1428 |
private AbstractMultiEditor outerEditorPart; |
1449 |
private AbstractMultiEditor outerEditorPart; |
1429 |
|
1450 |
|
|
|
1451 |
private MultiEditorInnerPane innerPane; |
1452 |
|
1430 |
public InnerEditor(IEditorReference outerEditor, |
1453 |
public InnerEditor(IEditorReference outerEditor, |
1431 |
AbstractMultiEditor outerEditorPart, IEditorInput input, |
1454 |
IEditorInput input, EditorDescriptor desc) { |
1432 |
EditorDescriptor desc) { |
|
|
1433 |
super(EditorManager.this, input, desc); |
1455 |
super(EditorManager.this, input, desc); |
1434 |
this.outerEditor = outerEditor; |
1456 |
this.outerEditor = outerEditor; |
|
|
1457 |
} |
1458 |
|
1459 |
public void setOuterEditorPart(AbstractMultiEditor outerEditorPart) { |
1435 |
this.outerEditorPart = outerEditorPart; |
1460 |
this.outerEditorPart = outerEditorPart; |
|
|
1461 |
if (innerPane != null) { |
1462 |
innerPane.setMultiEditorCompatibilityMode( |
1463 |
outerEditorPart instanceof MultiEditor); |
1464 |
} |
1436 |
} |
1465 |
} |
1437 |
|
1466 |
|
1438 |
protected void doDisposePart() { |
1467 |
protected void doDisposePart() { |
Lines 1442-1454
Link Here
|
1442 |
|
1471 |
|
1443 |
protected PartPane createPane() { |
1472 |
protected PartPane createPane() { |
1444 |
// MultiEditor backwards compatibility |
1473 |
// MultiEditor backwards compatibility |
1445 |
return new MultiEditorInnerPane( |
1474 |
innerPane = new MultiEditorInnerPane( |
1446 |
(EditorPane) ((EditorReference) outerEditor).getPane(), |
1475 |
(EditorPane) ((EditorReference) outerEditor).getPane(), |
1447 |
this, page, editorPresentation.getActiveWorkbook(), |
1476 |
this, page, editorPresentation.getActiveWorkbook(), |
1448 |
outerEditorPart instanceof MultiEditor); |
1477 |
outerEditorPart instanceof MultiEditor); |
|
|
1478 |
return innerPane; |
1449 |
} |
1479 |
} |
1450 |
|
1480 |
|
1451 |
protected Composite getPaneControlContainer() { |
1481 |
protected Composite getPaneControlContainer() { |
|
|
1482 |
Assert.isNotNull(outerEditorPart); |
1452 |
// MultiEditor backwards compatibility |
1483 |
// MultiEditor backwards compatibility |
1453 |
if (outerEditorPart instanceof MultiEditor) { |
1484 |
if (outerEditorPart instanceof MultiEditor) { |
1454 |
return super.getPaneControlContainer(); |
1485 |
return super.getPaneControlContainer(); |
Lines 1567-1573
Link Here
|
1567 |
editorMem.putString(IWorkbenchConstants.TAG_WORKBOOK, |
1598 |
editorMem.putString(IWorkbenchConstants.TAG_WORKBOOK, |
1568 |
editorPane.getWorkbook().getID()); |
1599 |
editorPane.getWorkbook().getID()); |
1569 |
|
1600 |
|
1570 |
if (editor == page.getActivePart()) { |
1601 |
IWorkbenchPartReference activePartReference = page.getActivePartReference(); |
|
|
1602 |
boolean innerEditorActive = activePartReference instanceof InnerEditor; |
1603 |
if ((!innerEditorActive && editor == page.getActivePart()) || |
1604 |
(innerEditorActive && editor == ((InnerEditor) activePartReference).outerEditorPart)) { |
1571 |
editorMem.putString(IWorkbenchConstants.TAG_ACTIVE_PART, |
1605 |
editorMem.putString(IWorkbenchConstants.TAG_ACTIVE_PART, |
1572 |
"true"); //$NON-NLS-1$ |
1606 |
"true"); //$NON-NLS-1$ |
1573 |
} |
1607 |
} |