/******************************************************************************* | |
* 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.wizard.EthereumProjectWizard; | |
import org.eclipse.core.commands.AbstractHandler; | |
import org.eclipse.core.commands.ExecutionEvent; | |
import org.eclipse.core.commands.ExecutionException; | |
import org.eclipse.jface.wizard.WizardDialog; | |
import org.eclipse.swt.widgets.Display; | |
import org.eclipse.ui.IWorkbench; | |
import org.eclipse.ui.PlatformUI; | |
/** | |
* Import Project shortcut | |
*/ | |
public class ImportProjectHandler extends AbstractHandler { | |
/** | |
* {@inheritDoc} | |
*/ | |
@Override | |
public Object execute(final ExecutionEvent event) | |
throws ExecutionException { | |
Display.getDefault().asyncExec(() -> { | |
IWorkbench workbench = PlatformUI.getWorkbench(); | |
EthereumProjectWizard impotWizard = new EthereumProjectWizard(); | |
impotWizard.init(workbench, null); | |
WizardDialog dialog = new WizardDialog( | |
workbench.getActiveWorkbenchWindow().getShell(), | |
impotWizard); | |
dialog.open(); | |
}); | |
return ""; | |
} | |
} |