Search in sources :

Example 16 with Constraints

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);
}
Also used : VirtualFile(org.eclipse.che.ide.api.resources.VirtualFile) Constraints(org.eclipse.che.ide.api.constraints.Constraints)

Example 17 with 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);
}
Also used : Constraints(org.eclipse.che.ide.api.constraints.Constraints) Test(org.junit.Test)

Example 18 with Constraints

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);
}
Also used : Constraints(org.eclipse.che.ide.api.constraints.Constraints) Test(org.junit.Test)

Example 19 with Constraints

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);
}
Also used : Constraints(org.eclipse.che.ide.api.constraints.Constraints) Test(org.junit.Test)

Example 20 with Constraints

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"));
}
Also used : Constraints(org.eclipse.che.ide.api.constraints.Constraints) DefaultActionGroup(org.eclipse.che.ide.api.action.DefaultActionGroup) Inject(com.google.inject.Inject)

Aggregations

Constraints (org.eclipse.che.ide.api.constraints.Constraints)21 Test (org.junit.Test)12 Inject (com.google.inject.Inject)3 DefaultActionGroup (org.eclipse.che.ide.api.action.DefaultActionGroup)3 ArrayList (java.util.ArrayList)2 LinkedHashMap (java.util.LinkedHashMap)2 KeyBuilder (org.eclipse.che.ide.api.keybinding.KeyBuilder)2 VirtualFile (org.eclipse.che.ide.api.resources.VirtualFile)2 Lists.newArrayList (com.google.common.collect.Lists.newArrayList)1 JsonObject (elemental.json.JsonObject)1 Map (java.util.Map)1 Promise (org.eclipse.che.api.promises.client.Promise)1 Anchor (org.eclipse.che.ide.api.constraints.Anchor)1 EditorPartStack (org.eclipse.che.ide.api.parts.EditorPartStack)1