use of org.eclipse.che.ide.api.debug.DebugConfigurationType in project che by eclipse.
the class EditDebugConfigurationsViewImpl method renderCategoryHeader.
private SpanElement renderCategoryHeader(final String categoryTitle) {
SpanElement categoryHeaderElement = Document.get().createSpanElement();
categoryHeaderElement.setClassName(editConfigurationsResources.getCss().categoryHeader());
SpanElement iconElement = Document.get().createSpanElement();
categoryHeaderElement.appendChild(iconElement);
SpanElement textElement = Document.get().createSpanElement();
categoryHeaderElement.appendChild(textElement);
DebugConfigurationType currentDebugConfigurationType = getTypeById(categoryTitle);
textElement.setInnerText(currentDebugConfigurationType != null ? currentDebugConfigurationType.getDisplayName() : categoryTitle);
SpanElement buttonElement = Document.get().createSpanElement();
buttonElement.appendChild(editConfigurationsResources.addConfigurationButton().getSvg().getElement());
categoryHeaderElement.appendChild(buttonElement);
Event.sinkEvents(buttonElement, Event.ONCLICK);
Event.setEventListener(buttonElement, new EventListener() {
@Override
public void onBrowserEvent(Event event) {
if (Event.ONCLICK == event.getTypeInt()) {
event.stopPropagation();
namePanel.setVisible(true);
selectedType = getTypeById(categoryTitle);
delegate.onAddClicked();
resetFilter();
}
}
});
Icon icon = iconRegistry.getIconIfExist(categoryTitle + ".debug.configuration.type.icon");
if (icon != null) {
final SVGImage iconSVG = icon.getSVGImage();
if (iconSVG != null) {
iconElement.appendChild(iconSVG.getElement());
return categoryHeaderElement;
}
}
return categoryHeaderElement;
}
use of org.eclipse.che.ide.api.debug.DebugConfigurationType in project che by eclipse.
the class DebugConfigurationsManagerImpl method createConfiguration.
@Override
public DebugConfiguration createConfiguration(String typeId, String name, String host, int port, Map<String, String> connectionProperties) {
final DebugConfigurationType configurationType = configurationTypeRegistry.getConfigurationTypeById(typeId);
final DebugConfiguration configuration = new DebugConfiguration(configurationType, generateUniqueConfigurationName(configurationType, name), host, port, connectionProperties);
configurations.add(configuration);
saveConfigurations();
fireConfigurationAdded(configuration);
return configuration;
}
use of org.eclipse.che.ide.api.debug.DebugConfigurationType in project che by eclipse.
the class EditDebugConfigurationsViewImpl method renderCategoriesList.
private void renderCategoriesList(Map<DebugConfigurationType, List<DebugConfiguration>> categories) {
if (categories == null) {
return;
}
final List<Category<?>> categoriesList = new ArrayList<>();
for (DebugConfigurationType type : categories.keySet()) {
List<DebugConfiguration> configurations = new ArrayList<>();
if (filterTextValue.isEmpty()) {
configurations = categories.get(type);
} else {
// filtering List
for (final DebugConfiguration configuration : categories.get(type)) {
if (configuration.getName().contains(filterTextValue)) {
configurations.add(configuration);
}
}
}
Category<DebugConfiguration> category = new Category<>(type.getId(), categoryRenderer, configurations, categoryEventDelegate);
categoriesList.add(category);
}
list.clear();
list.render(categoriesList, true);
if (selectedConfiguration != null) {
list.selectElement(selectedConfiguration);
if (filterTextValue.isEmpty()) {
selectText(configurationName.getElement());
}
} else {
contentPanel.clear();
contentPanel.add(hintLabel);
namePanel.setVisible(false);
}
}
use of org.eclipse.che.ide.api.debug.DebugConfigurationType in project che by eclipse.
the class EditDebugConfigurationsPresenter method fetchConfigurations.
/** Fetch configurations and update view. */
private void fetchConfigurations() {
final String originName = editedConfigurationOriginName;
reset();
view.setCancelButtonState(false);
view.setSaveButtonState(false);
view.setDebugButtonState(view.getSelectedConfiguration() != null);
final List<DebugConfiguration> configurationsList = debugConfigurationsManager.getConfigurations();
final Map<DebugConfigurationType, List<DebugConfiguration>> categories = new HashMap<>();
for (DebugConfigurationType type : debugConfigurationTypeRegistry.getTypes()) {
final List<DebugConfiguration> settingsCategory = new ArrayList<>();
for (DebugConfiguration configuration : configurationsList) {
if (type.getId().equals(configuration.getType().getId())) {
settingsCategory.add(configuration);
if (configuration.getName().equals(originName)) {
view.setSelectedConfiguration(configuration);
}
}
}
Collections.sort(settingsCategory, new Comparator<DebugConfiguration>() {
@Override
public int compare(DebugConfiguration o1, DebugConfiguration o2) {
return o1.getName().compareTo(o2.getName());
}
});
categories.put(type, settingsCategory);
}
view.setData(categories);
view.setFilterState(!configurationsList.isEmpty());
view.focusCloseButton();
}
Aggregations