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


Java URI.createPlatformPluginURI方法代码示例

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


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

示例1: uriPlugin

import org.eclipse.emf.common.util.URI; //导入方法依赖的package包/类
@Test
public void uriPlugin() throws Exception {
	Class<? extends TestToIResourceNegative> self = this.getClass();
	String pathName = FrameworkUtil.getBundle(self).getSymbolicName() + "/"
			+ self.getPackageName().replace('.', '/') + "/" + self.getSimpleName() + ".class";
	URI uri = URI.createPlatformPluginURI(pathName, true);
	IResource iResource = UriUtils.toIResource(uri);

	assertNull(iResource);
}
 
开发者ID:enikao,项目名称:eclipse-commons,代码行数:11,代码来源:TestToIResourceNegative.java

示例2: createAndLoadOCCIEcoreResource

import org.eclipse.emf.common.util.URI; //导入方法依赖的package包/类
private Resource createAndLoadOCCIEcoreResource(String pathToDDLEcore) {
	// creating a proper URI is vitally important since this is how
	// referenced objects in the is ecore file will be found from the ecore
	// file that we produce.
	ResourceSet resSet = new ResourceSetImpl();
	final URI uri = URI.createPlatformPluginURI(pathToDDLEcore, true);
	Resource res = resSet.createResource(uri);
	try {
		res.load(Collections.emptyMap());
	} catch (IOException e) {
		e.printStackTrace();
	}
	return res;
}
 
开发者ID:occiware,项目名称:OCCI-Studio,代码行数:15,代码来源:OCCIExtension2Ecore.java

示例3: getTemplateURI

import org.eclipse.emf.common.util.URI; //导入方法依赖的package包/类
/**
 * Finds the template in the plug-in. Returns the template plug-in URI.
 * 
 * @param bundleID
 *            is the plug-in ID
 * @param relativePath
 *            is the relative path of the template in the plug-in
 * @return the template URI
 * @throws IOException
 * @generated
 */
@SuppressWarnings("unchecked")
private URI getTemplateURI(String bundleID, IPath relativePath) throws IOException {
	Bundle bundle = Platform.getBundle(bundleID);
	if (bundle == null) {
		// no need to go any further
		return URI.createPlatformResourceURI(new Path(bundleID).append(relativePath).toString(), false);
	}
	URL url = bundle.getEntry(relativePath.toString());
	if (url == null && relativePath.segmentCount() > 1) {
		Enumeration<URL> entries = bundle.findEntries("/", "*.emtl", true);
		if (entries != null) {
			String[] segmentsRelativePath = relativePath.segments();
			while (url == null && entries.hasMoreElements()) {
				URL entry = entries.nextElement();
				IPath path = new Path(entry.getPath());
				if (path.segmentCount() > relativePath.segmentCount()) {
					path = path.removeFirstSegments(path.segmentCount() - relativePath.segmentCount());
				}
				String[] segmentsPath = path.segments();
				boolean equals = segmentsPath.length == segmentsRelativePath.length;
				for (int i = 0; equals && i < segmentsPath.length; i++) {
					equals = segmentsPath[i].equals(segmentsRelativePath[i]);
				}
				if (equals) {
					url = bundle.getEntry(entry.getPath());
				}
			}
		}
	}
	URI result;
	if (url != null) {
		result = URI.createPlatformPluginURI(new Path(bundleID).append(new Path(url.getPath())).toString(), false);
	} else {
		result = URI.createPlatformResourceURI(new Path(bundleID).append(relativePath).toString(), false);
	}
	return result;
}
 
开发者ID:occiware,项目名称:OCCI-Studio,代码行数:49,代码来源:GenerateAll.java

示例4: getTemplateURI

import org.eclipse.emf.common.util.URI; //导入方法依赖的package包/类
/**
 * Finds the template in the plug-in. Returns the template plug-in URI.
 * 
 * @param bundleID
 *            is the plug-in ID
 * @param relativePath
 *            is the relative path of the template in the plug-in
 * @return the template URI
 * @throws IOException
 * @generated
 */
@SuppressWarnings ( "unused" )
private URI getTemplateURI ( final String bundleID, final IPath relativePath ) throws IOException
{
    final Bundle bundle = Platform.getBundle ( bundleID );
    if ( bundle == null )
    {
        // no need to go any further 
        return URI.createPlatformResourceURI ( new Path ( bundleID ).append ( relativePath ).toString (), false );
    }
    URL url = bundle.getEntry ( relativePath.toString () );
    if ( url == null && relativePath.segmentCount () > 1 )
    {
        final Enumeration<URL> entries = bundle.findEntries ( "/", "*.emtl", true );
        if ( entries != null )
        {
            final String[] segmentsRelativePath = relativePath.segments ();
            while ( url == null && entries.hasMoreElements () )
            {
                final URL entry = entries.nextElement ();
                IPath path = new Path ( entry.getPath () );
                if ( path.segmentCount () > relativePath.segmentCount () )
                {
                    path = path.removeFirstSegments ( path.segmentCount () - relativePath.segmentCount () );
                }
                final String[] segmentsPath = path.segments ();
                boolean equals = segmentsPath.length == segmentsRelativePath.length;
                for ( int i = 0; equals && i < segmentsPath.length; i++ )
                {
                    equals = segmentsPath[i].equals ( segmentsRelativePath[i] );
                }
                if ( equals )
                {
                    url = bundle.getEntry ( entry.getPath () );
                }
            }
        }
    }
    URI result;
    if ( url != null )
    {
        result = URI.createPlatformPluginURI ( new Path ( bundleID ).append ( new Path ( url.getPath () ) ).toString (), false );
    }
    else
    {
        result = URI.createPlatformResourceURI ( new Path ( bundleID ).append ( relativePath ).toString (), false );
    }
    return result;
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:60,代码来源:GenerateAll.java


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