|
Lines 131-137
Link Here
|
| 131 |
import org.eclipse.ui.internal.actions.CommandAction; |
131 |
import org.eclipse.ui.internal.actions.CommandAction; |
| 132 |
import org.eclipse.ui.internal.e4.compatibility.CompatibilityEditor; |
132 |
import org.eclipse.ui.internal.e4.compatibility.CompatibilityEditor; |
| 133 |
import org.eclipse.ui.internal.e4.compatibility.E4Util; |
133 |
import org.eclipse.ui.internal.e4.compatibility.E4Util; |
| 134 |
import org.eclipse.ui.internal.e4.compatibility.ModeledPageLayout; |
|
|
| 135 |
import org.eclipse.ui.internal.e4.compatibility.SelectionService; |
134 |
import org.eclipse.ui.internal.e4.compatibility.SelectionService; |
| 136 |
import org.eclipse.ui.internal.handlers.ActionCommandMappingService; |
135 |
import org.eclipse.ui.internal.handlers.ActionCommandMappingService; |
| 137 |
import org.eclipse.ui.internal.handlers.IActionCommandMappingService; |
136 |
import org.eclipse.ui.internal.handlers.IActionCommandMappingService; |
|
Lines 487-496
Link Here
|
| 487 |
page.setPerspective(perspective); |
486 |
page.setPerspective(perspective); |
| 488 |
firePageActivated(); |
487 |
firePageActivated(); |
| 489 |
|
488 |
|
| 490 |
if (curPersp != null) { |
489 |
populateTrimContributions(); |
| 491 |
populateTrimContributions(ModeledPageLayout.getIds(curPersp, ACTION_SET_CMD_PREFIX), |
|
|
| 492 |
true); |
| 493 |
} |
| 494 |
|
490 |
|
| 495 |
Shell shell = (Shell) model.getWidget(); |
491 |
Shell shell = (Shell) model.getWidget(); |
| 496 |
MMenu mainMenu = model.getMainMenu(); |
492 |
MMenu mainMenu = model.getMainMenu(); |
|
Lines 537-562
Link Here
|
| 537 |
trimBars.remove(trimBar); |
533 |
trimBars.remove(trimBar); |
| 538 |
} |
534 |
} |
| 539 |
|
535 |
|
| 540 |
void populateTrimContributions(List<String> actionSets, boolean reload) { |
536 |
void populateTrimContributions() { |
| 541 |
removeTrimContributions(); |
537 |
if (getTopTrim() != null) { |
|
|
538 |
throw new IllegalStateException("The top trim is already set"); //$NON-NLS-1$ |
| 539 |
} |
| 540 |
MTrimBar trimBar = BasicFactoryImpl.eINSTANCE.createTrimBar(); |
| 541 |
trimBar.setElementId(MAIN_TOOLBAR_ID); |
| 542 |
|
542 |
|
| 543 |
MTrimBar trimBar = getTopTrim(); |
|
|
| 544 |
fill(trimBar, getCoolBarManager2()); |
543 |
fill(trimBar, getCoolBarManager2()); |
| 545 |
|
544 |
|
| 546 |
if (false) { |
|
|
| 547 |
// TODO don't do this yet, it should be handled by the TrimRenderer |
| 548 |
for (String actionSet : actionSets) { |
| 549 |
MToolBar toolBar = MenuFactoryImpl.eINSTANCE.createToolBar(); |
| 550 |
toolBar.setElementId(actionSet); |
| 551 |
MToolBarSeparator separator = MenuFactoryImpl.eINSTANCE.createToolBarSeparator(); |
| 552 |
separator.setElementId(actionSet); |
| 553 |
separator.setToBeRendered(false); |
| 554 |
toolBar.getChildren().add(separator); |
| 555 |
trimBar.getChildren().add(toolBar); |
| 556 |
workbenchTrimElements.add(toolBar); |
| 557 |
} |
| 558 |
} |
| 559 |
|
| 560 |
// TODO why aren't these added as trim contributions |
545 |
// TODO why aren't these added as trim contributions |
| 561 |
// that would remove everything from this method except the fill(*) |
546 |
// that would remove everything from this method except the fill(*) |
| 562 |
MToolControl spacerControl = MenuFactoryImpl.eINSTANCE.createToolControl(); |
547 |
MToolControl spacerControl = MenuFactoryImpl.eINSTANCE.createToolControl(); |
|
Lines 591-596
Link Here
|
| 591 |
workbenchTrimElements.add(searchControl); |
576 |
workbenchTrimElements.add(searchControl); |
| 592 |
workbenchTrimElements.add(glueControl); |
577 |
workbenchTrimElements.add(glueControl); |
| 593 |
workbenchTrimElements.add(switcherControl); |
578 |
workbenchTrimElements.add(switcherControl); |
|
|
579 |
|
| 580 |
// and now add it to the model, start the rendering |
| 581 |
List<MTrimBar> trimBars = model.getTrimBars(); |
| 582 |
trimBars.add(0, trimBar); |
| 594 |
} |
583 |
} |
| 595 |
|
584 |
|
| 596 |
private MTrimBar getTopTrim() { |
585 |
private MTrimBar getTopTrim() { |
|
Lines 600-609
Link Here
|
| 600 |
return bar; |
589 |
return bar; |
| 601 |
} |
590 |
} |
| 602 |
} |
591 |
} |
| 603 |
MTrimBar trimBar = BasicFactoryImpl.eINSTANCE.createTrimBar(); |
592 |
return null; |
| 604 |
trimBar.setElementId(MAIN_TOOLBAR_ID); |
|
|
| 605 |
trimBars.add(0, trimBar); |
| 606 |
return trimBar; |
| 607 |
} |
593 |
} |
| 608 |
|
594 |
|
| 609 |
private void fill(MMenu menu, IMenuManager manager) { |
595 |
private void fill(MMenu menu, IMenuManager manager) { |
|
Lines 731-736
Link Here
|
| 731 |
container.getChildren().add(toolBar); |
717 |
container.getChildren().add(toolBar); |
| 732 |
workbenchTrimElements.add(toolBar); |
718 |
workbenchTrimElements.add(toolBar); |
| 733 |
} else if (item instanceof AbstractGroupMarker) { |
719 |
} else if (item instanceof AbstractGroupMarker) { |
|
|
720 |
System.out.println("group: " + item.getId()); //$NON-NLS-1$ |
| 734 |
MToolBarSeparator separator = MenuFactoryImpl.eINSTANCE.createToolBarSeparator(); |
721 |
MToolBarSeparator separator = MenuFactoryImpl.eINSTANCE.createToolBarSeparator(); |
| 735 |
separator.setToBeRendered(item.isVisible()); |
722 |
separator.setToBeRendered(item.isVisible()); |
| 736 |
separator.setElementId(item.getId()); |
723 |
separator.setElementId(item.getId()); |