blob: 7eb2020e9bc7ecc41ba642a532029947005121b7 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2008, 2010 BestSolution.at and others.
* 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:
* Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation
* Boris Bokowski, IBM Corporation - initial API and implementation
******************************************************************************/
package org.eclipse.e4.ui.internal.workbench.swt;
import java.net.MalformedURLException;
import java.net.URL;
import org.eclipse.e4.ui.workbench.swt.util.ISWTResourceUtilities;
import org.eclipse.emf.common.util.URI;
import org.eclipse.jface.resource.ImageDescriptor;
public class ResourceUtility implements ISWTResourceUtilities {
public ResourceUtility() {
super();
}
public ImageDescriptor imageDescriptorFromURI(URI iconPath) {
try {
return ImageDescriptor.createFromURL(new URL(iconPath.toString()));
} catch (MalformedURLException e) {
System.err.println("iconURI \"" + iconPath.toString()
+ "\" is invalid, no image will be shown");
return null;
}
}
}