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


Java Platform类代码示例

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


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

示例1: loadCodeLensProviders

import org.eclipse.core.runtime.Platform; //导入依赖的package包/类
/**
 * Load the SourceMap language supports.
 */
private synchronized void loadCodeLensProviders() {
	if (codeLensProviderLoaded) {
		return;
	}

	try {
		IExtensionRegistry registry = Platform.getExtensionRegistry();
		if (registry == null) {
			return;
		}
		IConfigurationElement[] cf = registry.getConfigurationElementsFor(CodeLensPlugin.PLUGIN_ID,
				EXTENSION_CODELENS_PROVIDERS);
		loadCodeLensProvidersFromExtension(cf);
	} finally {
		codeLensProviderLoaded = true;
	}
}
 
开发者ID:angelozerr,项目名称:codelens-eclipse,代码行数:21,代码来源:CodeLensProviderRegistry.java

示例2: iterator

import org.eclipse.core.runtime.Platform; //导入依赖的package包/类
public Iterator<URI> iterator(IN4JSSourceContainer sourceContainer) {
	if (sourceContainer.isLibrary()) {
		return workspace.getArchiveIterator(sourceContainer.getLibrary().getLocation(),
				sourceContainer.getRelativeLocation());
	} else {
		if (sourceContainer.getProject().isExternal() && Platform.isRunning()) {
			// The `Platform.isRunning()` is not valid check for the OSGI headless compiler
			// it may still be valid in some scenarios (maybe some test scenarios)
			if (externalLibraryWorkspace instanceof NoopExternalLibraryWorkspace
					&& workspace instanceof FileBasedWorkspace
					&& workspace.findProjectWith(sourceContainer.getLocation()) != null) {
				return workspace.getFolderIterator(sourceContainer.getLocation());
			}

			return externalLibraryWorkspace.getFolderIterator(sourceContainer.getLocation());
		}
		return workspace.getFolderIterator(sourceContainer.getLocation());
	}
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:20,代码来源:N4JSModel.java

示例3: collectExternalProjectDependents

import org.eclipse.core.runtime.Platform; //导入依赖的package包/类
/**
 * Sugar for collecting {@link IWorkspace Eclipse workspace} projects that have any direct dependency to any
 * external projects. Same as {@link #collectExternalProjectDependents()} but does not consider all the available
 * projects but only those that are given as the argument.
 *
 * @param externalProjects
 *            the external projects that has to be considered as a possible dependency of an Eclipse workspace based
 *            project.
 * @return a map where each entry maps an external project to the workspace projects that depend on it.
 */
public Map<IProject, Collection<IProject>> collectExternalProjectDependents(
		final Iterable<? extends IProject> externalProjects) {
	final Multimap<IProject, IProject> mapping = Multimaps2.newLinkedHashListMultimap();

	if (Platform.isRunning()) {

		final Map<String, IProject> externalsMapping = new HashMap<>();
		externalProjects.forEach(p -> externalsMapping.put(p.getName(), p));

		asList(getWorkspace().getRoot().getProjects()).forEach(p -> {
			getDirectExternalDependencyIds(p).forEach(eID -> {
				IProject externalDependency = externalsMapping.get(eID);
				if (externalDependency != null) {
					mapping.put(externalDependency, p);
				}
			});
		});

	}

	return mapping.asMap();
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:33,代码来源:ExternalProjectsCollector.java

示例4: createFilesForTest

import org.eclipse.core.runtime.Platform; //导入依赖的package包/类
private void createFilesForTest() throws IOException{
	File configDir = new File(Platform.getInstallLocation().getURL().getPath() + "/config");
	if(!configDir.exists()){
		configDir.mkdir();
	}
	File mavenDir = new File(configDir.getPath() + "/maven");
	if(!mavenDir.exists()){
		mavenDir.mkdir();
	}
	File destinationFile = new File(mavenDir + "/pom.xml");
	if(destinationFile.exists()){
		return;
	}
	else{
		destinationFile.createNewFile();
	}
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:18,代码来源:TestProjectStructure.java

示例5: getBundleDirectory

import org.eclipse.core.runtime.Platform; //导入依赖的package包/类
/**
 * Return the bundle directory.
 *
 * @param bundle the bundle
 * @return the bundle directory
 */
public String getBundleDirectory(Bundle bundle) {
	
	if (bundle == null) return null;

	// --- Get File URL of bundle --------------------- 
	URL pluginURL = null;
	try {
		pluginURL = FileLocator.resolve(bundle.getEntry("/"));
	} catch (IOException e) {
		throw new RuntimeException("Could not get installation directory of the plugin: " + bundle.getSymbolicName());
	}
	
	// --- Clean up the directory path ----------------
	String pluginInstallDir = pluginURL.getFile().trim();
	if (pluginInstallDir.length()==0) {
		throw new RuntimeException("Could not get installation directory of the plugin: " + bundle.getSymbolicName());
	}

	// --- Corrections, if we are under windows -------
	if (Platform.getOS().compareTo(Platform.OS_WIN32) == 0) {
		//pluginInstallDir = pluginInstallDir.substring(1);
	}
	return pluginInstallDir;
}
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:31,代码来源:BundleEvaluator.java

示例6: retrieveLocators

import org.eclipse.core.runtime.Platform; //导入依赖的package包/类
/**
 * Retrieve all the locators registered with the extension point, and additionally store them in a cache.
 * 
 * @return All locators registered with the extension point.
 */
public List<ILocator> retrieveLocators() {
	if (locators == null) {
		IExtensionRegistry reg = Platform.getExtensionRegistry();
		IExtensionPoint ep = reg.getExtensionPoint("org.eclipse.gemoc.dsl.debug.locator");
		IExtension[] extensions = ep.getExtensions();
		ArrayList<ILocator> contributors = new ArrayList<ILocator>();
		for (int i = 0; i < extensions.length; i++) {
			IExtension ext = extensions[i];
			IConfigurationElement[] ce = ext.getConfigurationElements();
			for (int j = 0; j < ce.length; j++) {
				ILocator locator;
				try {
					locator = (ILocator)ce[j].createExecutableExtension("class");
					contributors.add(locator);
				} catch (CoreException e) {
					e.printStackTrace();
				}
			}
		}
		locators = contributors;
	}
	return locators;
}
 
开发者ID:eclipse,项目名称:gemoc-studio-modeldebugging,代码行数:29,代码来源:Activator.java

示例7: getMelangeBundle

import org.eclipse.core.runtime.Platform; //导入依赖的package包/类
/**
 * Return a bundle with a .melange declaring 'language'
 */
public static Bundle getMelangeBundle(String languageName){
	
	IConfigurationElement[] melangeLanguages = Platform
			.getExtensionRegistry().getConfigurationElementsFor(
					"fr.inria.diverse.melange.language");
	String melangeBundleName = "";
	
	for (IConfigurationElement lang : melangeLanguages) {
		if(lang.getAttribute("id").equals(languageName)){
			melangeBundleName = lang.getContributor().getName();
			return Platform.getBundle(melangeBundleName);
		}
	}
	
	return null;
}
 
开发者ID:eclipse,项目名称:gemoc-studio-modeldebugging,代码行数:20,代码来源:MelangeHelper.java

示例8: 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

示例9: 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

示例10: initialize

import org.eclipse.core.runtime.Platform; //导入依赖的package包/类
/**
 * Initializes the extensions map.
 * 
 * @throws CoreException
 *             if the registry cannot be initialized
 */
public void initialize() {
  try {
	if (Platform.isRunning()) {
		registry.clear();
		final IExtension[] extensions = Platform.getExtensionRegistry()
				.getExtensionPoint(OCCIE_EXTENSION_POINT).getExtensions();
		for (int i = 0; i < extensions.length; i++) {
			final IConfigurationElement[] configElements = extensions[i]
					.getConfigurationElements();
			for (int j = 0; j < configElements.length; j++) {
				String scheme = configElements[j].getAttribute("scheme"); //$NON-NLS-1$
				String uri = "platform:/plugin/" + extensions[i].getContributor().getName() + "/" + configElements[j].getAttribute("file"); //$NON-NLS-1$
				registerExtension(scheme, uri);
			}
		}
	}
  } catch(NoClassDefFoundError ncdfe) {
	  LOGGER.info("  Running out of an Eclipse Platform...");
  }
}
 
开发者ID:occiware,项目名称:OCCI-Studio,代码行数:27,代码来源:OcciRegistry.java

示例11: createConnection

import org.eclipse.core.runtime.Platform; //导入依赖的package包/类
public static ConnectionService createConnection ( final ConnectionInformation info, final Integer autoReconnectDelay, final boolean lazyActivation )
{
    if ( info == null )
    {
        return null;
    }

    for ( final IConfigurationElement ele : Platform.getExtensionRegistry ().getConfigurationElementsFor ( Activator.EXTP_CONNECTON_CREATOR ) )
    {
        final String interfaceName = ele.getAttribute ( "interface" );
        final String driverName = ele.getAttribute ( "driver" );
        if ( interfaceName == null || driverName == null )
        {
            continue;
        }
        if ( interfaceName.equals ( info.getInterface () ) && driverName.equals ( info.getDriver () ) )
        {
            final ConnectionService service = createConnection ( info, ele, autoReconnectDelay, lazyActivation );
            if ( service != null )
            {
                return service;
            }
        }
    }
    return null;
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:27,代码来源:ConnectionCreatorHelper.java

示例12: createBestPlatformMessagingSystem

import org.eclipse.core.runtime.Platform; //导入依赖的package包/类
/**
 * 
 * @return a new MessagingSystem that is supposed to be the best implementation for the current platform
 * @param baseMessageGroup id for the messaging system, if two instances of MessagingSystem use the same id, the platform may decide to group the messages in a single console
 * @param userFriendlyName, name for the console, if several instances use the same  baseMessageGroup, it will use one of the userFriendlyName (the first that is created) 
 */
public MessagingSystem createBestPlatformMessagingSystem(String baseMessageGroup, String userFriendlyName ){
	MessagingSystem result = null;
	IConfigurationElement[] confElements = Platform.getExtensionRegistry()
			.getConfigurationElementsFor(MESSAGINGSYSTEM_EXTENSION_POINT_NAME);
	for (int i = 0; i < confElements.length; i++) {
		// get first working contribution
		// TODO find some criterion or properties allowing to have better selection in case of multiple definitions
		//String name = confElements[i].getAttribute(MESSAGINGSYSTEM_EXTENSION_POINT_CONTRIB_NAME_ATT);
		try {
			result = (MessagingSystem) confElements[i].createExecutableExtension(MESSAGINGSYSTEM_EXTENSION_POINT_CONTRIB_MESSAGINGSYSTEM_ATT);
			result.initialize(baseMessageGroup, userFriendlyName);
			if(result != null)	break;
		} catch (Throwable e) {;
		}
	}
	if (result == null){
		// still not created, either due to exception or to missing extension contributor
		// fallback to default constructor
		result = new StdioSimpleMessagingSystem();
	}
	
	return result;
}
 
开发者ID:eclipse,项目名称:gemoc-studio,代码行数:30,代码来源:MessagingSystemManager.java

示例13: createFactories

import org.eclipse.core.runtime.Platform; //导入依赖的package包/类
public static Collection<KeyProviderFactory> createFactories ()
{
    final Collection<KeyProviderFactory> result = new LinkedList<KeyProviderFactory> ();

    for ( final IConfigurationElement ele : Platform.getExtensionRegistry ().getConfigurationElementsFor ( EXTP_KEY_PROVIDER_FACTORY ) )
    {
        if ( !ELE_FACTORY.equals ( ele.getName () ) )
        {
            continue;
        }

        try
        {
            result.add ( (KeyProviderFactory)ele.createExecutableExtension ( ATTR_CLASS ) );
        }
        catch ( final CoreException e )
        {
            StatusManager.getManager ().handle ( e, Activator.PLUGIN_ID );
        }
    }

    return result;
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:24,代码来源:Helper.java

示例14: getExtensionDescriptors

import org.eclipse.core.runtime.Platform; //导入依赖的package包/类
public static List<ExtensionDescriptor> getExtensionDescriptors ()
{
    final List<ExtensionDescriptor> result = new LinkedList<ExtensionDescriptor> ();

    for ( final IConfigurationElement element : Platform.getExtensionRegistry ().getConfigurationElementsFor ( EXTP_VIEWER ) )
    {
        if ( !"viewerExtension".equals ( element.getName () ) )
        {
            continue;
        }

        result.add ( new ExtensionDescriptor ( element ) );
    }

    return result;
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:17,代码来源:Activator.java

示例15: loadDescriptors

import org.eclipse.core.runtime.Platform; //导入依赖的package包/类
protected static List<ViewInstanceDescriptor> loadDescriptors ()
{
    final List<ViewInstanceDescriptor> result = new LinkedList<ViewInstanceDescriptor> ();
    for ( final IConfigurationElement element : Platform.getExtensionRegistry ().getConfigurationElementsFor ( EXTP_VIEW ) )
    {
        if ( !ELE_VIEW_INSTANCE.equals ( element.getName () ) )
        {
            continue;
        }

        final ViewInstanceDescriptor descriptor = convert ( element );
        if ( descriptor != null )
        {
            result.add ( descriptor );
        }
    }
    return result;
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:19,代码来源:Activator.java


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