| /******************************************************************************* |
| * Copyright (c) 2017 Rogue Wave Software 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: |
| * Michal Niewrzal (Rogue Wave Software 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 ToggleLinkingHandler 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.LINK_WITH_EDITOR_PREFERENCE, !oldValue); |
| return null; |
| } |
| |
| } |