use of org.eclipse.che.ide.api.constraints.Constraints in project che by eclipse.
the class SplitVerticallyAction method actionPerformed.
/** {@inheritDoc} */
@Override
public void actionPerformed(ActionEvent event) {
final String tabId = getEditorTab(event).getId();
final VirtualFile file = getEditorFile(event);
final Constraints constraints = new Constraints(VERTICALLY, tabId);
editorAgent.openEditor(file, constraints);
}
use of org.eclipse.che.ide.api.constraints.Constraints in project che by eclipse.
the class DefaultActionGroupTest method addOneBefore.
@Test
public void addOneBefore() {
// given
mockRegisterActions();
defaultActionGroup.add(firstAction);
defaultActionGroup.add(secondAction);
defaultActionGroup.add(thirdAction, new Constraints(BEFORE, "secondAction"));
defaultActionGroup.add(fourthAction);
defaultActionGroup.add(fifthAction);
defaultActionGroup.add(sixthAction);
// when
Action[] result = defaultActionGroup.getChildren(mock(ActionEvent.class));
//then
assertThat(Arrays.asList(result)).hasSize(6).containsExactly(firstAction, thirdAction, secondAction, fourthAction, fifthAction, sixthAction);
}
use of org.eclipse.che.ide.api.constraints.Constraints in project che by eclipse.
the class DefaultActionGroupTest method addOneAfterNotAdded.
@Test
public void addOneAfterNotAdded() {
// given
mockRegisterActions();
defaultActionGroup.add(firstAction);
defaultActionGroup.add(secondAction, new Constraints(AFTER, "fifthAction"));
defaultActionGroup.add(thirdAction);
defaultActionGroup.add(fourthAction);
defaultActionGroup.add(fifthAction);
defaultActionGroup.add(sixthAction);
// when
Action[] result = defaultActionGroup.getChildren(mock(ActionEvent.class));
// then
assertThat(Arrays.asList(result)).hasSize(6).containsExactly(firstAction, thirdAction, fourthAction, fifthAction, secondAction, sixthAction);
}
use of org.eclipse.che.ide.api.constraints.Constraints in project che by eclipse.
the class DefaultActionGroupTest method addComplexBefore.
@Test
public void addComplexBefore() {
// given
mockRegisterActions();
defaultActionGroup.add(firstAction);
defaultActionGroup.add(secondAction, new Constraints(BEFORE, "fourthAction"));
defaultActionGroup.add(thirdAction);
defaultActionGroup.add(fourthAction, new Constraints(BEFORE, "sixthAction"));
defaultActionGroup.add(fifthAction);
defaultActionGroup.add(sixthAction);
// when
Action[] result = defaultActionGroup.getChildren(mock(ActionEvent.class));
// then
assertThat(Arrays.asList(result)).hasSize(6).containsExactly(firstAction, thirdAction, fifthAction, secondAction, fourthAction, sixthAction);
}
use of org.eclipse.che.ide.api.constraints.Constraints in project che by eclipse.
the class CommandProducerActionManager method start.
@Inject(optional = true)
private void start(Set<CommandProducer> commandProducers) {
this.commandProducers.addAll(commandProducers);
commandActionsPopUpGroup = new DefaultActionGroup("Commands", true, actionManager);
actionManager.registerAction("commandActionsPopUpGroup", commandActionsPopUpGroup);
commandActionsPopUpGroup.getTemplatePresentation().setSVGResource(resources.compile());
commandActionsPopUpGroup.getTemplatePresentation().setDescription("Execute command");
DefaultActionGroup mainContextMenu = (DefaultActionGroup) actionManager.getAction(GROUP_MAIN_CONTEXT_MENU);
mainContextMenu.add(commandActionsPopUpGroup);
DefaultActionGroup editorTabContextMenu = (DefaultActionGroup) actionManager.getAction(GROUP_EDITOR_TAB_CONTEXT_MENU);
editorTabContextMenu.add(commandActionsPopUpGroup);
// add 'Commands' pop-up group to the main toolbar
DefaultActionGroup commandActionsToolbarGroup = new CommandActionsToolbarGroup(actionManager);
commandActionsToolbarGroup.add(commandActionsPopUpGroup);
DefaultActionGroup mainToolbarGroup = (DefaultActionGroup) actionManager.getAction(GROUP_MAIN_TOOLBAR);
mainToolbarGroup.add(commandActionsToolbarGroup, new Constraints(AFTER, "changeResourceGroup"));
}
Aggregations