/*-
* Copyright © 2009 Diamond Light Source Ltd.
*
* This file is part of GDA.
*
* GDA is free software: you can redistribute it and/or modify it under the
* terms of the GNU General Public License version 3 as published by the Free
* Software Foundation.
*
* GDA is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along
* with GDA. If not, see <http://www.gnu.org/licenses/>.
*/
package uk.ac.gda.dal;
import java.util.Hashtable;
import org.csstudio.sds.ui.runmode.RunModeService;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExecutableExtension;
import org.eclipse.core.runtime.Path;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.IWorkbenchWindowActionDelegate;
public class OpenSDSView implements IWorkbenchWindowActionDelegate, IExecutableExtension {
private String url;
@Override
public void dispose() {
// TODO Auto-generated method stub
}
@Override
public void init(IWorkbenchWindow window) {
// TODO Auto-generated method stub
}
@Override
public void run(IAction action) {
if (url == null || "".equals(url))
return;
RunModeService.getInstance().openDisplayViewInRunMode(new Path(url));
}
@Override
public void selectionChanged(IAction action, ISelection selection) {
// TODO Auto-generated method stub
}
@Override
public void setInitializationData(IConfigurationElement config, String propertyName, Object data) throws CoreException {
if (data != null && data instanceof Hashtable)
url = (String) ((Hashtable<?, ?>) data).get("url");
if (url == null || url.length() == 0)
url = config.getAttribute("url");
}
}