Search in sources :

Example 6 with DebugConfiguration

use of org.eclipse.che.ide.api.debug.DebugConfiguration in project che by eclipse.

the class EditDebugConfigurationsPresenter method updateConfiguration.

private void updateConfiguration(DebugConfiguration selectedConfiguration) {
    if (editedConfigurationOriginName.trim().equals(selectedConfiguration.getName())) {
        debugConfigurationsManager.removeConfiguration(selectedConfiguration);
        debugConfigurationsManager.createConfiguration(selectedConfiguration.getType().getId(), selectedConfiguration.getName(), selectedConfiguration.getHost(), selectedConfiguration.getPort(), selectedConfiguration.getConnectionProperties());
    } else {
        onNameChanged();
        debugConfigurationsManager.removeConfiguration(editedConfiguration);
        DebugConfiguration conf = debugConfigurationsManager.createConfiguration(selectedConfiguration.getType().getId(), selectedConfiguration.getName(), selectedConfiguration.getHost(), selectedConfiguration.getPort(), selectedConfiguration.getConnectionProperties());
        if (selectedConfiguration.equals(view.getSelectedConfiguration())) {
            //update selected configuration name
            view.getSelectedConfiguration().setName(conf.getName());
        }
    }
}
Also used : DebugConfiguration(org.eclipse.che.ide.api.debug.DebugConfiguration)

Example 7 with DebugConfiguration

use of org.eclipse.che.ide.api.debug.DebugConfiguration in project che by eclipse.

the class DebugActionTest method actionShouldBePerformed.

@Test
public void actionShouldBePerformed() {
    DebugConfiguration debugConfiguration = mock(DebugConfiguration.class);
    when(debugConfiguration.getType()).thenReturn(mock(DebugConfigurationType.class));
    when(debugConfiguration.getHost()).thenReturn("localhost");
    when(debugConfiguration.getPort()).thenReturn(8000);
    Map<String, String> connectionProperties = new HashMap<>();
    connectionProperties.put("prop1", "val1");
    connectionProperties.put("prop2", "val2");
    when(debugConfiguration.getConnectionProperties()).thenReturn(connectionProperties);
    Optional configurationOptional = mock(Optional.class);
    when(configurationOptional.isPresent()).thenReturn(Boolean.TRUE);
    when(configurationOptional.get()).thenReturn(debugConfiguration);
    when(debugConfigurationsManager.getCurrentDebugConfiguration()).thenReturn(configurationOptional);
    action.actionPerformed(null);
    verify(debugConfigurationsManager).apply(debugConfiguration);
}
Also used : DebugConfiguration(org.eclipse.che.ide.api.debug.DebugConfiguration) Optional(com.google.common.base.Optional) HashMap(java.util.HashMap) DebugConfigurationType(org.eclipse.che.ide.api.debug.DebugConfigurationType) Test(org.junit.Test)

Example 8 with DebugConfiguration

use of org.eclipse.che.ide.api.debug.DebugConfiguration in project che by eclipse.

the class DebugConfigurationActionTest method shouldBeVisibleOnUpdate.

@Test
public void shouldBeVisibleOnUpdate() {
    String confName = "test_conf";
    when(debugConfiguration.getName()).thenReturn(confName);
    DebugConfiguration configuration = mock(DebugConfiguration.class);
    Optional<DebugConfiguration> configurationOptional = mock(Optional.class);
    when(configurationOptional.isPresent()).thenReturn(Boolean.TRUE);
    when(configurationOptional.get()).thenReturn(configuration);
    when(debugConfigurationsManager.getCurrentDebugConfiguration()).thenReturn(configurationOptional);
    ActionEvent event = mock(ActionEvent.class);
    Presentation presentation = mock(Presentation.class);
    when(event.getPresentation()).thenReturn(presentation);
    action.updateInPerspective(event);
    verify(presentation).setEnabledAndVisible(true);
}
Also used : DebugConfiguration(org.eclipse.che.ide.api.debug.DebugConfiguration) ActionEvent(org.eclipse.che.ide.api.action.ActionEvent) Presentation(org.eclipse.che.ide.api.action.Presentation) Test(org.junit.Test)

Example 9 with DebugConfiguration

use of org.eclipse.che.ide.api.debug.DebugConfiguration in project che by eclipse.

the class EditDebugConfigurationsPresenter method onCloseClicked.

@Override
public void onCloseClicked() {
    final DebugConfiguration selectedConfiguration = view.getSelectedConfiguration();
    onNameChanged();
    if (selectedConfiguration != null && isViewModified()) {
        onConfigurationSelected(selectedConfiguration);
    }
    view.close();
}
Also used : DebugConfiguration(org.eclipse.che.ide.api.debug.DebugConfiguration)

Example 10 with DebugConfiguration

use of org.eclipse.che.ide.api.debug.DebugConfiguration in project che by eclipse.

the class EditDebugConfigurationsViewImpl method selectNextItem.

@Override
public void selectNextItem() {
    final DebugConfiguration nextItem;
    final List<DebugConfiguration> configurations = categories.get(selectedConfiguration.getType());
    int selectPosition = configurations.indexOf(selectedConfiguration);
    if (configurations.size() < 2 || selectPosition == -1) {
        nextItem = null;
    } else {
        if (selectPosition > 0) {
            selectPosition--;
        } else {
            selectPosition++;
        }
        nextItem = configurations.get(selectPosition);
    }
    list.selectElement(nextItem);
    selectedConfiguration = nextItem;
}
Also used : DebugConfiguration(org.eclipse.che.ide.api.debug.DebugConfiguration)

Aggregations

DebugConfiguration (org.eclipse.che.ide.api.debug.DebugConfiguration)15 DebugConfigurationType (org.eclipse.che.ide.api.debug.DebugConfigurationType)4 ArrayList (java.util.ArrayList)3 HashMap (java.util.HashMap)2 Test (org.junit.Test)2 Optional (com.google.common.base.Optional)1 HashSet (java.util.HashSet)1 List (java.util.List)1 ActionEvent (org.eclipse.che.ide.api.action.ActionEvent)1 Presentation (org.eclipse.che.ide.api.action.Presentation)1 DirtyStateListener (org.eclipse.che.ide.api.debug.DebugConfigurationPage.DirtyStateListener)1 Category (org.eclipse.che.ide.ui.list.Category)1 DebugConfigurationDto (org.eclipse.che.plugin.debugger.ide.configuration.dto.DebugConfigurationDto)1