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());
}
}
}
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);
}
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);
}
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();
}
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;
}
Aggregations