Search in sources :

Example 1 with DebugConfigurationType

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;
}
Also used : SpanElement(com.google.gwt.dom.client.SpanElement) KeyUpEvent(com.google.gwt.event.dom.client.KeyUpEvent) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) Event(com.google.gwt.user.client.Event) BlurEvent(com.google.gwt.event.dom.client.BlurEvent) KeyDownEvent(com.google.gwt.event.dom.client.KeyDownEvent) KeyboardEvent(elemental.events.KeyboardEvent) EventListener(com.google.gwt.user.client.EventListener) Icon(org.eclipse.che.ide.api.icon.Icon) DebugConfigurationType(org.eclipse.che.ide.api.debug.DebugConfigurationType) SVGImage(org.vectomatic.dom.svg.ui.SVGImage)

Example 2 with DebugConfigurationType

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;
}
Also used : DebugConfiguration(org.eclipse.che.ide.api.debug.DebugConfiguration) DebugConfigurationType(org.eclipse.che.ide.api.debug.DebugConfigurationType)

Example 3 with DebugConfigurationType

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);
    }
}
Also used : DebugConfiguration(org.eclipse.che.ide.api.debug.DebugConfiguration) Category(org.eclipse.che.ide.ui.list.Category) ArrayList(java.util.ArrayList) DebugConfigurationType(org.eclipse.che.ide.api.debug.DebugConfigurationType)

Example 4 with DebugConfigurationType

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();
}
Also used : DebugConfiguration(org.eclipse.che.ide.api.debug.DebugConfiguration) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) DebugConfigurationType(org.eclipse.che.ide.api.debug.DebugConfigurationType)

Aggregations

DebugConfigurationType (org.eclipse.che.ide.api.debug.DebugConfigurationType)4 DebugConfiguration (org.eclipse.che.ide.api.debug.DebugConfiguration)3 ArrayList (java.util.ArrayList)2 SpanElement (com.google.gwt.dom.client.SpanElement)1 BlurEvent (com.google.gwt.event.dom.client.BlurEvent)1 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)1 KeyDownEvent (com.google.gwt.event.dom.client.KeyDownEvent)1 KeyUpEvent (com.google.gwt.event.dom.client.KeyUpEvent)1 Event (com.google.gwt.user.client.Event)1 EventListener (com.google.gwt.user.client.EventListener)1 KeyboardEvent (elemental.events.KeyboardEvent)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Icon (org.eclipse.che.ide.api.icon.Icon)1 Category (org.eclipse.che.ide.ui.list.Category)1 SVGImage (org.vectomatic.dom.svg.ui.SVGImage)1