/******************************************************************************* * Copyright (c) 2010 Intel Corporation. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Intel - initial API and implementation *******************************************************************************/ package org.yocto.sdk.remotetools.actions; import org.eclipse.core.commands.AbstractHandler; import org.eclipse.core.commands.ExecutionEvent; import org.eclipse.core.commands.ExecutionException; import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.PlatformUI; import org.eclipse.ui.handlers.HandlerUtil; import org.eclipse.ui.progress.IProgressService; public class OprofileHandler extends AbstractHandler { public Object execute(ExecutionEvent event) throws ExecutionException { if(OprofileModel.checkAvail()!=true) { return null; } IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event); SimpleSettingDialog setting=new SimpleSettingDialog( window.getShell(), "Oprofile", IBaseConstants.CONNECTION_NAME_OPROFILE ); if(setting.open()==BaseSettingDialog.OK) { IProgressService progressService = PlatformUI.getWorkbench().getProgressService(); OprofileModel op=new OprofileModel(setting.getHost(),window); try { progressService.busyCursorWhile(op); }catch (InterruptedException e) { //user cancelled }catch (Exception e) { e.printStackTrace(); MessageDialog.openError(window.getShell(), "Oprofile", (e.getCause() != null) ? e.getCause().getMessage() : e.getMessage()); } } return null; } }