blob: 81a019905dfcd814424c43c64c6003450520ee85 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2020 RBEI and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v. 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Deepthi Murugaiyan - Initial contribution and API
*******************************************************************************/
package org.eclipse.blockchain.ui.handlers;
import org.eclipse.blockchain.ui.preference.SolidityCompilerPreference;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.jface.preference.PreferenceDialog;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.dialogs.PreferencesUtil;
/**
* Solidity compiler preference shortcut
*/
public class SolidityCompilerPreferenceHandler extends AbstractHandler {
/**
* {@inheritDoc}
*/
@Override
public Object execute(final ExecutionEvent event)
throws ExecutionException {
Display.getDefault().asyncExec(() -> {
IWorkbench workbench = PlatformUI.getWorkbench();
SolidityCompilerPreference page = new SolidityCompilerPreference();
page.init(workbench);
PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(
workbench.getActiveWorkbenchWindow().getShell(),
"org.eclipse.blockchain.ui.solidity.compiler.preference",
null, null);
dialog.open();
});
return null;
}
}