本文整理汇总了Java中org.eclipse.core.runtime.FileLocator.find方法的典型用法代码示例。如果您正苦于以下问题:Java FileLocator.find方法的具体用法?Java FileLocator.find怎么用?Java FileLocator.find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.core.runtime.FileLocator
的用法示例。
在下文中一共展示了FileLocator.find方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createImageDescriptor
import org.eclipse.core.runtime.FileLocator; //导入方法依赖的package包/类
public static ImageDescriptor createImageDescriptor(String path, String pluginId) {
if (path == null) {
/* fall back if path null , so avoid NPE in eclipse framework */
return ImageDescriptor.getMissingImageDescriptor();
}
if (pluginId == null) {
/* fall back if pluginId null , so avoid NPE in eclipse framework */
return ImageDescriptor.getMissingImageDescriptor();
}
Bundle bundle = Platform.getBundle(pluginId);
if (bundle == null) {
/*
* fall back if bundle not available, so avoid NPE in eclipse
* framework
*/
return ImageDescriptor.getMissingImageDescriptor();
}
URL url = FileLocator.find(bundle, new Path(path), null);
ImageDescriptor imageDesc = ImageDescriptor.createFromURL(url);
return imageDesc;
}
示例2: init
import org.eclipse.core.runtime.FileLocator; //导入方法依赖的package包/类
/**
* <p>
* Creates the sole wizard page contributed by this base implementation; the
* standard Eclipse WizardNewProjectCreationPage.
* </p>
*
* @see WizardNewProjectCreationPage#WizardNewProjectCreationPage(String)
*/
public void init(IWorkbench workbench, IStructuredSelection selection) {
// Set default image for all wizard pages
IPath path = new Path(eu.hyvar.feature.mapping.resource.hymapping.ui.HymappingUIResourceBundle.NEW_PROJECT_WIZARD_PAGE_ICON);
Bundle bundle = eu.hyvar.feature.mapping.resource.hymapping.ui.HymappingUIPlugin.getDefault().getBundle();
URL url = FileLocator.find(bundle, path, null);
ImageDescriptor descriptor = ImageDescriptor.createFromURL(url);
setDefaultPageImageDescriptor(descriptor);
wizardNewProjectCreationPage = new WizardNewProjectCreationPage(pageName);
wizardNewProjectCreationPage.setTitle(pageTitle);
wizardNewProjectCreationPage.setDescription(pageDescription);
wizardNewProjectCreationPage.setInitialProjectName(pageProjectName);
this.addPage(wizardNewProjectCreationPage);
setWindowTitle(eu.hyvar.feature.mapping.resource.hymapping.ui.HymappingUIResourceBundle.NEW_PROJECT_WIZARD_WINDOW_TITLE);
}
示例3: init
import org.eclipse.core.runtime.FileLocator; //导入方法依赖的package包/类
/**
* <p>
* Creates the sole wizard page contributed by this base implementation; the
* standard Eclipse WizardNewProjectCreationPage.
* </p>
*
* @see WizardNewProjectCreationPage#WizardNewProjectCreationPage(String)
*/
public void init(IWorkbench workbench, IStructuredSelection selection) {
// Set default image for all wizard pages
IPath path = new Path(eu.hyvar.mspl.manifest.resource.hymanifest.ui.HymanifestUIResourceBundle.NEW_PROJECT_WIZARD_PAGE_ICON);
Bundle bundle = eu.hyvar.mspl.manifest.resource.hymanifest.ui.HymanifestUIPlugin.getDefault().getBundle();
URL url = FileLocator.find(bundle, path, null);
ImageDescriptor descriptor = ImageDescriptor.createFromURL(url);
setDefaultPageImageDescriptor(descriptor);
wizardNewProjectCreationPage = new WizardNewProjectCreationPage(pageName);
wizardNewProjectCreationPage.setTitle(pageTitle);
wizardNewProjectCreationPage.setDescription(pageDescription);
wizardNewProjectCreationPage.setInitialProjectName(pageProjectName);
this.addPage(wizardNewProjectCreationPage);
setWindowTitle(eu.hyvar.mspl.manifest.resource.hymanifest.ui.HymanifestUIResourceBundle.NEW_PROJECT_WIZARD_WINDOW_TITLE);
}
示例4: getOpenPerspectiveImage
import org.eclipse.core.runtime.FileLocator; //导入方法依赖的package包/类
/**
* Returns the open perspective image TODO: Evaluate whether this needs to
* ported into an Eclipse4 friendly version.
*
* @return the image
*/
Image getOpenPerspectiveImage() {
if (openPerspectiveImage == null || openPerspectiveImage.isDisposed()) {
Bundle bundle = FrameworkUtil.getBundle(this.getClass());
URL url = FileLocator.find(bundle, new Path(
"icons/full/eview16/new_persp.gif"), null);
ImageDescriptor imageDescr = ImageDescriptor.createFromURL(url);
return imageDescr.createImage();
// ImageDescriptor desc =
// WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_ETOOL_NEW_PAGE);
// openPerspectiveImage = desc.createImage();
}
// return openPerspectiveImage;
// TODO fill image
return null;
}
示例5: getJSLintScript
import org.eclipse.core.runtime.FileLocator; //导入方法依赖的package包/类
/**
* Lazily grab the JSLint script.
*
* @return
*/
private synchronized JSLint getJSLintScript()
{
if (JS_LINT_SCRIPT == null)
{
URL url = FileLocator.find(JSCorePlugin.getDefault().getBundle(), Path.fromPortableString(JSLINT_FILENAME),
null);
if (url != null)
{
try
{
String source = StreamUtil.readContent(url.openStream());
if (source != null)
{
JS_LINT_SCRIPT = getJSLintScript(source);
}
}
catch (IOException e)
{
IdeLog.logError(JSCorePlugin.getDefault(), Messages.JSLintValidator_ERR_FailToGetJSLint, e);
}
}
}
return JS_LINT_SCRIPT;
}
示例6: getImage
import org.eclipse.core.runtime.FileLocator; //导入方法依赖的package包/类
@Override
public Image getImage(Object element) {
if (element instanceof IProject) {
return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_PROJECT);
}
if (element instanceof IResource) {
return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_FILE);
}
if (element instanceof Route) {
Bundle bundle = FrameworkUtil.getBundle(RouteTreeLabelProvider.class);
URL url = FileLocator.find(bundle, new Path("icons/obj16/Route.gif"), null);
ImageDescriptor imageDcr = ImageDescriptor.createFromURL(url);
return imageDcr.createImage();
}
return null;
}
示例7: configureLogbackInBundle
import org.eclipse.core.runtime.FileLocator; //导入方法依赖的package包/类
private void configureLogbackInBundle(Bundle bundle) throws JoranException, IOException {
LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();
JoranConfigurator jc = new JoranConfigurator();
jc.setContext(context);
context.reset();
URL logbackConfigFileUrl = FileLocator.find(bundle, new Path("logback.xml"), null);
jc.doConfigure(logbackConfigFileUrl.openStream());
}
示例8: getImage
import org.eclipse.core.runtime.FileLocator; //导入方法依赖的package包/类
private Image getImage() {
String path = "icons/ksp.gif";
Bundle bundle = Platform.getBundle(Activator.PLUGIN_ID);
URL url = FileLocator.find(bundle, new Path(path), null);
ImageDescriptor imageDesc = ImageDescriptor.createFromURL(url);
return imageDesc.createImage();
}
示例9: declareRegistryImage
import org.eclipse.core.runtime.FileLocator; //导入方法依赖的package包/类
private final static void declareRegistryImage(String key, String path) {
ImageDescriptor desc = ImageDescriptor.getMissingImageDescriptor();
Bundle bundle = Platform.getBundle(EditorConfigPlugin.PLUGIN_ID);
URL url = null;
if (bundle != null) {
url = FileLocator.find(bundle, new Path(path), null);
if (url != null) {
desc = ImageDescriptor.createFromURL(url);
}
}
imageRegistry.put(key, desc);
}
示例10: getFallbackCompilerPath
import org.eclipse.core.runtime.FileLocator; //导入方法依赖的package包/类
protected String getFallbackCompilerPath() {
Bundle bundle = Platform.getBundle(SolidityCompilerActivator.PLUGIN_ID);
URL url = FileLocator.find(bundle, getPath(), null);
try {
URL fileURL = FileLocator.toFileURL(url);
return fileURL.getFile();
} catch (IOException e) {
throw new IllegalStateException(e);
}
}
示例11: registerImage
import org.eclipse.core.runtime.FileLocator; //导入方法依赖的package包/类
private Image registerImage(String key) {
try {
IPath path = new Path("images/" + key); //$NON-NLS-1$
URL url = FileLocator.find(this.getBundle(), path, null);
if (url != null) {
ImageDescriptor desc = ImageDescriptor.createFromURL(url);
getImageRegistry().put(key, desc);
return getImageRegistry().get(key);
}
} catch (Exception e) {
// ignored
}
return null;
}
示例12: launch
import org.eclipse.core.runtime.FileLocator; //导入方法依赖的package包/类
private void launch(IResource file, int line, IType type, String agentArgs, IMethod mainMethod)
throws CoreException {
ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();
ILaunchConfigurationType confType = manager.getLaunchConfigurationType(IJavaLaunchConfigurationConstants.ID_JAVA_APPLICATION);
ILaunchConfigurationWorkingCopy wc = confType.newInstance(null, file.getName() + " (PandionJ)");
wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, file.getProject().getName());
wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME, type.getFullyQualifiedName());
wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_STOP_IN_MAIN, false);
// if(breakPoint != null)
// breakPoint.delete();
// if(line != -1)
// breakPoint = JDIDebugModel.createLineBreakpoint(file, firstType.getFullyQualifiedName(), line, -1, -1, 0, true, null);
try {
Bundle bundle = Platform.getBundle(LaunchCommand.class.getPackage().getName());
URL find = FileLocator.find(bundle, new Path("lib/agent.jar"), null);
URL resolve = FileLocator.resolve(find);
if(!mainMethod.exists()) {
String path = resolve.getPath();
if(Platform.getOS().compareTo(Platform.OS_WIN32) == 0)
path = path.substring(1);
String args = "-javaagent:\"" + path + "=" + agentArgs + "\" -Djava.awt.headless=true";
wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS, args);
}
} catch (IOException e1) {
e1.printStackTrace();
}
ILaunchConfiguration config = wc.doSave();
Activator.launch(config);
}
示例13: getImage
import org.eclipse.core.runtime.FileLocator; //导入方法依赖的package包/类
/**
* Get image contained in the 'images' folder of the plugin
*/
static Image getImage(String name) {
Bundle bundle = Platform.getBundle(PandionJConstants.PLUGIN_ID);
URL imagePath = FileLocator.find(bundle, new Path(PandionJConstants.IMAGE_FOLDER + "/" + name), null);
ImageDescriptor imageDesc = ImageDescriptor.createFromURL(imagePath);
return imageDesc.createImage();
}
示例14: getImageDescriptor
import org.eclipse.core.runtime.FileLocator; //导入方法依赖的package包/类
public ImageDescriptor getImageDescriptor(
String relativePath) {
//TODO E4 - the only place that requires org.eclipse.core.runtime
URL url = FileLocator.find(Platform
.getBundle(IProgressConstants.PLUGIN_ID), new Path(
ICONS_LOCATION + relativePath), null);
return ImageDescriptor.createFromURL(url);
}
示例15: ShowFilterConfigurationDialog
import org.eclipse.core.runtime.FileLocator; //导入方法依赖的package包/类
public ShowFilterConfigurationDialog(ReportListView listView) {
super(listView, "Show Filter Configurators", IAction.AS_PUSH_BUTTON);
setToolTipText("Show Filter Configurators");
Bundle bundle = Platform.getBundle(Activator.PLUGIN_ID);
final URL fullPathString = FileLocator.find(bundle, new Path("icons/filter.png"), null);
setImageDescriptor(ImageDescriptor.createFromURL(fullPathString));
}