Search in sources :

Example 1 with ConfigureLabels

use of org.eclipse.linuxtools.internal.docker.ui.wizards.ConfigureLabels in project linuxtools by eclipse.

the class ConfigureLabelsCommandHandler method execute.

@SuppressWarnings("unused")
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    final ConfigureLabels wizard = new ConfigureLabels();
    final boolean configureLabels = CommandUtils.openWizard(wizard, HandlerUtil.getActiveShell(event));
    if (configureLabels) {
        Map<String, String> labels = wizard.getConfigureLabels();
        StringBuffer buffer = new StringBuffer();
        for (Entry<String, String> entry : labels.entrySet()) {
            buffer.append(entry.getKey());
            // $NON-NLS-1$
            buffer.append('=');
            buffer.append(entry.getValue());
            buffer.append('\u00a0');
        }
        IEclipsePreferences preferences = InstanceScope.INSTANCE.getNode(Activator.PLUGIN_ID);
        preferences.put(CONTAINER_FILTER_LABELS, buffer.toString());
        IDockerConnection connection = CommandUtils.getCurrentConnection(null);
        // force refresh
        connection.getContainers(true);
    }
    return null;
}
Also used : IEclipsePreferences(org.eclipse.core.runtime.preferences.IEclipsePreferences) ConfigureLabels(org.eclipse.linuxtools.internal.docker.ui.wizards.ConfigureLabels) IDockerConnection(org.eclipse.linuxtools.docker.core.IDockerConnection)

Aggregations

IEclipsePreferences (org.eclipse.core.runtime.preferences.IEclipsePreferences)1 IDockerConnection (org.eclipse.linuxtools.docker.core.IDockerConnection)1 ConfigureLabels (org.eclipse.linuxtools.internal.docker.ui.wizards.ConfigureLabels)1