当前位置: 首页>>代码示例>>Java>>正文


Java Platform.getBundle方法代码示例

本文整理汇总了Java中org.eclipse.core.runtime.Platform.getBundle方法的典型用法代码示例。如果您正苦于以下问题:Java Platform.getBundle方法的具体用法?Java Platform.getBundle怎么用?Java Platform.getBundle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.core.runtime.Platform的用法示例。


在下文中一共展示了Platform.getBundle方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getIcon

import org.eclipse.core.runtime.Platform; //导入方法依赖的package包/类
protected Image getIcon(String fullPath) throws IOException {

		if (fullPath==null)      return defaultIcon;
		if ("".equals(fullPath)) return defaultIcon;

		try {
			if (iconMap.containsKey(fullPath)) return iconMap.get(fullPath);
			final String[] sa = fullPath.split("/");
			final Bundle bundle = Platform.getBundle(sa[0]);
			if (bundle==null) return defaultIcon;
			if (bundle!=null) {
				Image image = new Image(null, bundle.getResource(sa[1]+"/"+sa[2]).openStream());
				iconMap.put(fullPath, image);
			}
			return iconMap.get(fullPath);
		} catch (Exception ne) {
			logger.debug("Cannot get icon for "+fullPath, ne);
			return defaultIcon;
		}
	}
 
开发者ID:eclipse,项目名称:scanning,代码行数:21,代码来源:DetectorView.java

示例2: createIcons

import org.eclipse.core.runtime.Platform; //导入方法依赖的package包/类
private void createIcons() {
	icons   = new HashMap<String, Image>(7);

	final IConfigurationElement[] eles = Platform.getExtensionRegistry().getConfigurationElementsFor("org.eclipse.scanning.api.generator");
	for (IConfigurationElement e : eles) {
		final String     identity = e.getAttribute("id");

		final String icon = e.getAttribute("icon");
		if (icon !=null) {
			final String   cont  = e.getContributor().getName();
			final Bundle   bundle= Platform.getBundle(cont);
			final URL      entry = bundle.getEntry(icon);
			final ImageDescriptor des = ImageDescriptor.createFromURL(entry);
			icons.put(identity, des.createImage());
		}

	}
}
 
开发者ID:eclipse,项目名称:scanning,代码行数:19,代码来源:GeneratorDescriptor.java

示例3: createImageDescriptor

import org.eclipse.core.runtime.Platform; //导入方法依赖的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;
}
 
开发者ID:de-jcup,项目名称:eclipse-bash-editor,代码行数:23,代码来源:EclipseUtil.java

示例4: getEventValue

import org.eclipse.core.runtime.Platform; //导入方法依赖的package包/类
public String getEventValue() {
    Bundle bundle = Platform.getBundle(PLUGIN_ID.THIS);
    if (bundle == null) {
        return NOT_INSTALLED;
    }
    IEclipsePreferences prefs = InstanceScope.INSTANCE.getNode(PLUGIN_ID.THIS);
    boolean showOnStartup = prefs.getBoolean(SHOW_BOX_ON_STARTUP, true);
    if (showOnStartup) {
        return TRUE;
    }
    return FALSE;
}
 
开发者ID:pgcodekeeper,项目名称:pgcodekeeper,代码行数:13,代码来源:EclipseEnvironment.java

示例5: installBundle

import org.eclipse.core.runtime.Platform; //导入方法依赖的package包/类
/**
 * Installs the specified jar bundle and adds the Bundle instance to the local bundle vector {@link #getBundleVector()}.
 * @param bundleJarFile the bundle jar file
 */
public void installBundle(File bundleJarFile) {
	
	// --- Check the symbolic bundle name of the jar to load ----
	String sbn = this.getBundleBuilder().getBundleJarsSymbolicBundleNames().get(bundleJarFile);
	if (sbn!=null && sbn.isEmpty()==false) {
		if (Platform.getBundle(sbn)!=null) {
			System.out.println("[" + this.getClass().getSimpleName() + "] Bundle '" + sbn + "' is already installed, skip installation of jar file!");
			return;
		}
	}
	// --- INstall the local bundle -----------------------------
	this.installBundle("reference:file:" + bundleJarFile.getAbsolutePath());
}
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:18,代码来源:ProjectBundleLoader.java

示例6: getVersion

import org.eclipse.core.runtime.Platform; //导入方法依赖的package包/类
/**
 * Loads the version information to this instance.
 */
public Version getVersion() {
	if (version==null) {
		Bundle bundle = Platform.getBundle(this.plugInID);
		version = bundle.getVersion();
	}
	return version;
}
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:11,代码来源:VersionInfo.java

示例7: findBundle

import org.eclipse.core.runtime.Platform; //导入方法依赖的package包/类
/**
 * Return a bundle containing 'aspectClassName'.
 * 
 * Return null if not found.
 */
private Bundle findBundle(final IExecutionContext executionContext, String aspectClassName) {

	// Look using JavaWorkspaceScope as this is safer and will look in
	// dependencies
	IType mainIType = getITypeMainByWorkspaceScope(aspectClassName);

	Bundle bundle = null;
	String bundleName = null;
	if (mainIType != null) {
		IPackageFragmentRoot packageFragmentRoot = (IPackageFragmentRoot) mainIType.getPackageFragment()
				.getParent();

		bundleName = packageFragmentRoot.getPath().removeLastSegments(1).lastSegment().toString();
		if (bundleName != null) {

			// We try to look into an already loaded bundle
			bundle = Platform.getBundle(bundleName);
		}
	} else {
		// the main isn't visible directly from the workspace, try another
		// method
		bundle = _executionContext.getMelangeBundle();
	}

	return bundle;
}
 
开发者ID:eclipse,项目名称:gemoc-studio-modeldebugging,代码行数:32,代码来源:PlainK3ExecutionEngine.java

示例8: launch

import org.eclipse.core.runtime.Platform; //导入方法依赖的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);
}
 
开发者ID:andre-santos-pt,项目名称:pandionj,代码行数:33,代码来源:LaunchCommand.java

示例9: getImage

import org.eclipse.core.runtime.Platform; //导入方法依赖的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();
}
 
开发者ID:andre-santos-pt,项目名称:pandionj,代码行数:10,代码来源:PandionJUI.java

示例10: fillContextMenu

import org.eclipse.core.runtime.Platform; //导入方法依赖的package包/类
@SuppressWarnings("restriction")
@Override
public void fillContextMenu(IMenuManager menu) {
	super.fillContextMenu(menu);

	ActionContributionItem pasteContribution = getPasteContribution(menu.getItems());
	menu.remove(pasteContribution);
	IAction pasteAction = new Action(PASTE_ACTION_TEXT) {
		@Override
		public void run() {
			IHandlerService handlerService = (IHandlerService) PlatformUI.getWorkbench()
					.getService(IHandlerService.class);
			try {
				JobCopyParticipant.setCopiedFileList(new ArrayList<>());
				handlerService.executeCommand(PASTE_COMMAND_ID, null);
			} catch (Exception exception) {
				logger.warn("Error while pasting job files :: {}",exception.getMessage());
			}
		}
	};
	pasteAction.setAccelerator(SWT.MOD1 | 'v');
	Bundle bundle = Platform.getBundle(MENU_PLUGIN_NAME);
	URL imagePath = BundleUtility.find(bundle,ImagePathConstant.PASTE_IMAGE_PATH.getValue());
	ImageDescriptor imageDescriptor = ImageDescriptor.createFromURL(imagePath);
	pasteAction.setImageDescriptor(imageDescriptor);
	menu.insertAfter(COPY_ACTION_ID, pasteAction);
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:28,代码来源:CustomEditActionProvider.java

示例11: getApplicationBundle

import org.eclipse.core.runtime.Platform; //导入方法依赖的package包/类
/**
 * Returns the bundle that launched the application that this class runs in.
 *
 * @return the defining bundle
 */
private Bundle getApplicationBundle() {
    IProduct product = Platform.getProduct();
    if (product != null) {
        return product.getDefiningBundle();
    } else {
        return Platform.getBundle(ECLIPSE_RUNTIME_BULDEID);
    }
}
 
开发者ID:pgcodekeeper,项目名称:pgcodekeeper,代码行数:14,代码来源:EclipseEnvironment.java

示例12: getBundleLocation

import org.eclipse.core.runtime.Platform; //导入方法依赖的package包/类
/**
 * @param bundleName
 * @return file this can return null if bundle is not found
 * @throws IOException
 */
public static File getBundleLocation(final String bundleName) throws IOException {
	final Bundle bundle = Platform.getBundle(bundleName);
	if (bundle == null) {
		return null;
	}
	return FileLocator.getBundleFile(bundle);
}
 
开发者ID:eclipse,项目名称:scanning,代码行数:13,代码来源:BundleUtils.java

示例13: resolveFile

import org.eclipse.core.runtime.Platform; //导入方法依赖的package包/类
private static File resolveFile(String pluginName, String path) {
	Bundle bundle = Platform.getBundle(pluginName);
	URL fileURL = bundle.getEntry(path);
	try {
		URL resolvedFileURL = FileLocator.toFileURL(fileURL);
		URI resolvedURI = new URI(resolvedFileURL.getProtocol(), resolvedFileURL.getPath(), null);
		return new File(resolvedURI);
	} catch (URISyntaxException | IOException e) {
		Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.getMessage(), e));
	}
	return null;
}
 
开发者ID:occiware,项目名称:OCCI-Studio,代码行数:13,代码来源:ExamplesRegistry.java

示例14: getBeanClass

import org.eclipse.core.runtime.Platform; //导入方法依赖的package包/类
private Class<StatusBean> getBeanClass() {
	String beanBundleName = getSecondaryIdAttribute("beanBundleName");
	String beanClassName  = getSecondaryIdAttribute("beanClassName");
	try {

		Bundle bundle = Platform.getBundle(beanBundleName);
		return (Class<StatusBean>)bundle.loadClass(beanClassName);
	} catch (Exception ne) {
		logger.error("Cannot get class "+beanClassName+". Defaulting to StatusBean. This will probably not work though.", ne);
		return StatusBean.class;
	}
}
 
开发者ID:eclipse,项目名称:scanning,代码行数:13,代码来源:StatusQueueView.java

示例15: initializeDefaultPreferences

import org.eclipse.core.runtime.Platform; //导入方法依赖的package包/类
@Override
public void initializeDefaultPreferences() {
	boolean compilerInstalled = Platform.getBundle(COMPILER_PLUGIN) != null;
	getPreferenceStore().setDefault(SolidityPreferences.COMPILER_ENABLED, compilerInstalled);
	getPreferenceStore().setDefault(SolidityPreferences.COMPILER_OUTPUT_ABI, false);
	getPreferenceStore().setDefault(SolidityPreferences.COMPILER_OUTPUT_AST, false);
	getPreferenceStore().setDefault(SolidityPreferences.COMPILER_OUTPUT_BIN, true);
	getPreferenceStore().setDefault(SolidityPreferences.COMPILER_OUTPUT_ASM, false);
	getPreferenceStore().setDefault(SolidityPreferences.COMPILER_OUTPUT_PATH, DEFAULT_OUTPUT_PATH);

	getPreferenceStore().setDefault(SolidityPreferences.FOLDING_COMMENT_AUTOFOLD, SolidityPreferences.FOLDING_COMMENT_AUTOFOLD_HEADER);
	getPreferenceStore().setDefault(SolidityPreferences.FOLDING_COMMENT_LINECOUNT, 5);
}
 
开发者ID:Yakindu,项目名称:solidity-ide,代码行数:14,代码来源:SolidityPreferenceInitializer.java


注:本文中的org.eclipse.core.runtime.Platform.getBundle方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。