blob: 85570d263150b18a85ef6c36a7aa8a9ccfe5da88 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2018 Red Hat Inc. and others.
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Lucas Bullen (Red Hat Inc.) - initial implementation
*******************************************************************************/
package org.eclipse.lsp4e.outline;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.Command;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.lsp4e.LanguageServerPlugin;
import org.eclipse.ui.handlers.HandlerUtil;
public class ShowKindHandler extends AbstractHandler {
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
Command command = event.getCommand();
boolean oldValue = HandlerUtil.toggleCommandState(command);
IEclipsePreferences preferences = InstanceScope.INSTANCE.getNode(LanguageServerPlugin.PLUGIN_ID);
preferences.putBoolean(CNFOutlinePage.SHOW_KIND_PREFERENCE, !oldValue);
return null;
}
}