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


Java URI类代码示例

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


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

示例1: startServer

import org.eclipse.emf.common.util.URI; //导入依赖的package包/类
public Collection<? extends ServerDescriptor> startServer ( final URI exporterFileUri, final String locationLabel ) throws CoreException
{
    final ResourceSetImpl resourceSet = new ResourceSetImpl ();

    resourceSet.getResourceFactoryRegistry ().getExtensionToFactoryMap ().put ( "*", new ExporterResourceFactoryImpl () );

    final Resource resource = resourceSet.createResource ( exporterFileUri );
    try
    {
        resource.load ( null );
    }
    catch ( final IOException e )
    {
        throw new CoreException ( StatusHelper.convertStatus ( HivesPlugin.PLUGIN_ID, "Failed to load configuration", e ) );
    }

    final DocumentRoot root = (DocumentRoot)EcoreUtil.getObjectByType ( resource.getContents (), ExporterPackage.Literals.DOCUMENT_ROOT );
    if ( root == null )
    {
        throw new CoreException ( new Status ( IStatus.ERROR, HivesPlugin.PLUGIN_ID, "Failed to locate exporter configuration in: " + exporterFileUri ) );
    }
    return startServer ( root, locationLabel );
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:24,代码来源:ServerHostImpl.java

示例2: loadPackage

import org.eclipse.emf.common.util.URI; //导入依赖的package包/类
/**
 * Laods the package and any sub-packages from their serialized form.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void loadPackage() {
	if (isLoaded)
		return;
	isLoaded = true;

	URL url = getClass().getResource(packageFilename);
	if (url == null) {
		throw new RuntimeException("Missing serialized package: " + packageFilename);
	}
	URI uri = URI.createURI(url.toString());
	Resource resource = new EcoreResourceFactoryImpl().createResource(uri);
	try {
		resource.load(null);
	} catch (IOException exception) {
		throw new WrappedException(exception);
	}
	initializeFromLoadedEPackage(this, (EPackage) resource.getContents().get(0));
	createResource(eNS_URI);
}
 
开发者ID:shenan4321,项目名称:BIMplatform,代码行数:26,代码来源:StorePackageImpl.java

示例3: createResource

import org.eclipse.emf.common.util.URI; //导入依赖的package包/类
/**
 * Creates an instance of the resource.
 * <!-- begin-user-doc --> <!-- end-user-doc -->
 * @generated
 */
@Override
public Resource createResource(URI uri)
{
  XMLResource result = new MailModuleResourceImpl(uri);
  result.getDefaultSaveOptions().put(XMLResource.OPTION_EXTENDED_META_DATA, Boolean.TRUE);
  result.getDefaultLoadOptions().put(XMLResource.OPTION_EXTENDED_META_DATA, Boolean.TRUE);

  result.getDefaultSaveOptions().put(XMLResource.OPTION_SCHEMA_LOCATION, Boolean.TRUE);

  result.getDefaultLoadOptions().put(XMLResource.OPTION_USE_ENCODED_ATTRIBUTE_STYLE, Boolean.TRUE);
  result.getDefaultSaveOptions().put(XMLResource.OPTION_USE_ENCODED_ATTRIBUTE_STYLE, Boolean.TRUE);

  result.getDefaultLoadOptions().put(XMLResource.OPTION_USE_LEXICAL_HANDLER, Boolean.TRUE);
  return result;
}
 
开发者ID:Morgan-Stanley,项目名称:Saturn,代码行数:21,代码来源:MailModuleResourceFactoryImpl.java

示例4: createModel

import org.eclipse.emf.common.util.URI; //导入依赖的package包/类
/**
 * This is the method called to load a resource into the editing domain's resource set based on the editor's input.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void createModel() {
	URI resourceURI = EditUIUtil.getURI(getEditorInput(), editingDomain.getResourceSet().getURIConverter());
	Exception exception = null;
	Resource resource = null;
	try {
		// Load the resource through the editing domain.
		//
		resource = editingDomain.getResourceSet().getResource(resourceURI, true);
	}
	catch (Exception e) {
		exception = e;
		resource = editingDomain.getResourceSet().getResource(resourceURI, false);
	}

	Diagnostic diagnostic = analyzeResourceProblems(resource, exception);
	if (diagnostic.getSeverity() != Diagnostic.OK) {
		resourceToDiagnosticMap.put(resource,  analyzeResourceProblems(resource, exception));
	}
	editingDomain.getResourceSet().eAdapters().add(problemIndicationAdapter);
}
 
开发者ID:awortmann,项目名称:xmontiarc,代码行数:27,代码来源:RuntimeEditor.java

示例5: loadLastSelection

import org.eclipse.emf.common.util.URI; //导入依赖的package包/类
private MasterServer loadLastSelection ()
{
    final String lastUri = this.dialogSettings.get ( SETTINGS_LAST_SELECTION );
    if ( lastUri == null )
    {
        return null;
    }

    try
    {
        final EObject lastSelection = this.world.eResource ().getResourceSet ().getEObject ( URI.createURI ( lastUri ), true );
        if ( lastSelection instanceof MasterServer )
        {
            return (MasterServer)lastSelection;
        }
    }
    catch ( final Exception e )
    {
    }
    return null;
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:22,代码来源:MasterSelectionDialog.java

示例6: loadPackage

import org.eclipse.emf.common.util.URI; //导入依赖的package包/类
/**
 * Laods the package and any sub-packages from their serialized form.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void loadPackage() {
	if (isLoaded) return;
	isLoaded = true;

	URL url = getClass().getResource(packageFilename);
	if (url == null) {
		throw new RuntimeException("Missing serialized package: " + packageFilename);
	}
	URI uri = URI.createURI(url.toString());
	Resource resource = new EcoreResourceFactoryImpl().createResource(uri);
	try {
		resource.load(null);
	}
	catch (IOException exception) {
		throw new WrappedException(exception);
	}
	initializeFromLoadedEPackage(this, (EPackage)resource.getContents().get(0));
	createResource(eNS_URI);
}
 
开发者ID:georghinkel,项目名称:ttc2017smartGrids,代码行数:26,代码来源:CIMPackageImpl.java

示例7: getProjects

import org.eclipse.emf.common.util.URI; //导入依赖的package包/类
@Override
public Iterable<IProject> getProjects(java.net.URI rootLocation) {
	ensureInitialized();
	final File rootFolder = new File(rootLocation);

	final Map<String, IProject> projectsMapping = newTreeMap();
	final URI rootUri = URI.createFileURI(rootFolder.getAbsolutePath());

	for (Entry<URI, Optional<Pair<ExternalProject, ProjectDescription>>> entry : projectCache.asMap().entrySet()) {
		final URI projectLocation = entry.getKey();
		if (rootUri.equals(projectLocation.trimSegments(1))) {
			final Pair<ExternalProject, ProjectDescription> pair = entry.getValue().orNull();
			if (null != pair && null != pair.getFirst()) {
				final ExternalProject project = pair.getFirst();
				projectsMapping.put(project.getName(), project);
			}
		}
	}

	return unmodifiableCollection(projectsMapping.values());
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:22,代码来源:EclipseExternalLibraryWorkspace.java

示例8: getIncomingReferences

import org.eclipse.emf.common.util.URI; //导入依赖的package包/类
/***/
public static Set<IReferenceDescription> getIncomingReferences(URI uri) {
	Set<IReferenceDescription> desc = Sets.newHashSet();
	Iterable<IResourceDescription> descriptions = getAllResourceDescriptions();
	for (IResourceDescription res : descriptions) {
		Iterable<IReferenceDescription> descriptions2 = res.getReferenceDescriptions();
		for (IReferenceDescription ref : descriptions2) {
			if (uri.hasFragment()) {
				if (ref.getTargetEObjectUri().equals(uri))
					desc.add(ref);
			} else {
				if (ref.getTargetEObjectUri().trimFragment().equals(uri.trimFragment()))
					desc.add(ref);
			}
		}
	}
	return desc;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:19,代码来源:BuilderUtil.java

示例9: createModel

import org.eclipse.emf.common.util.URI; //导入依赖的package包/类
/**
 * This is the method called to load a resource into the editing domain's resource set based on the editor's input.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void createModel ()
{
    URI resourceURI = EditUIUtil.getURI ( getEditorInput () );
    Exception exception = null;
    Resource resource = null;
    try
    {
        // Load the resource through the editing domain.
        //
        resource = editingDomain.getResourceSet ().getResource ( resourceURI, true );
    }
    catch ( Exception e )
    {
        exception = e;
        resource = editingDomain.getResourceSet ().getResource ( resourceURI, false );
    }

    Diagnostic diagnostic = analyzeResourceProblems ( resource, exception );
    if ( diagnostic.getSeverity () != Diagnostic.OK )
    {
        resourceToDiagnosticMap.put ( resource, analyzeResourceProblems ( resource, exception ) );
    }
    editingDomain.getResourceSet ().eAdapters ().add ( problemIndicationAdapter );
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:31,代码来源:ConfigurationEditor.java

示例10: load

import org.eclipse.emf.common.util.URI; //导入依赖的package包/类
public T load ( final URI uri, final String contentTypeId ) throws IOException
{
    final ResourceSet rs = new ResourceSetImpl ();
    final Resource r = rs.createResource ( uri, contentTypeId );
    r.load ( null );

    for ( final Object o : r.getContents () )
    {
        if ( this.clazz.isAssignableFrom ( o.getClass () ) )
        {
            return this.clazz.cast ( o );
        }
    }

    throw new IllegalStateException ( String.format ( "Model %s does not contain an object of type %s", uri, this.clazz ) );
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:17,代码来源:ModelLoader.java

示例11: generateDesignProject

import org.eclipse.emf.common.util.URI; //导入依赖的package包/类
private IProject generateDesignProject(String occieLocation, String designName, String designProjectName,
		final IProgressMonitor monitor) throws CoreException, IOException {

	// Load the ecore file.
	String ecoreLocation = occieLocation.replace(".occie", ".ecore");
	URI ecoreURI = URI.createFileURI(ecoreLocation);
	// Create a new resource set.
	ResourceSet resourceSet = new ResourceSetImpl();
	// Load the OCCI resource.
	org.eclipse.emf.ecore.resource.Resource resource = resourceSet.getResource(ecoreURI, true);
	// Return the first element.
	EPackage ePackage = (EPackage) resource.getContents().get(0);

	String extensionScheme = Occi2Ecore.convertEcoreNamespace2OcciScheme(ePackage.getNsURI());

	// Register the ePackage to avoid an error when trying to open the generated
	// .odesign file,
	EPackage.Registry.INSTANCE.put(ePackage.getNsURI(), ePackage);

	
	URI occieURI = URI.createFileURI(occieLocation);
	
	/*
	 * Create design project
	 */
	IProject project = DesignerGeneratorUtils.genDesignProject(designProjectName, designName, extensionScheme,
			new ProgressMonitorDialog(shell));

	/*
	 * Create design model
	 */
	org.eclipse.cmf.occi.core.gen.design.main.Generate generator = new org.eclipse.cmf.occi.core.gen.design.main.Generate(
			occieURI, project.getFolder("description").getLocation().toFile(), new ArrayList<String>());
	generator.doGenerate(BasicMonitor.toMonitor(monitor));
	project.refreshLocal(IResource.DEPTH_INFINITE, monitor);
	return project;
}
 
开发者ID:occiware,项目名称:OCCI-Studio,代码行数:38,代码来源:DesignerGeneratorAction.java

示例12: createResource

import org.eclipse.emf.common.util.URI; //导入依赖的package包/类
/**
 * Creates an instance of the resource.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public Resource createResource ( URI uri )
{
    XMLResource result = new ChartResourceImpl ( uri );
    result.getDefaultSaveOptions ().put ( XMLResource.OPTION_EXTENDED_META_DATA, Boolean.TRUE );
    result.getDefaultLoadOptions ().put ( XMLResource.OPTION_EXTENDED_META_DATA, Boolean.TRUE );

    result.getDefaultSaveOptions ().put ( XMLResource.OPTION_SCHEMA_LOCATION, Boolean.TRUE );

    result.getDefaultLoadOptions ().put ( XMLResource.OPTION_USE_ENCODED_ATTRIBUTE_STYLE, Boolean.TRUE );
    result.getDefaultSaveOptions ().put ( XMLResource.OPTION_USE_ENCODED_ATTRIBUTE_STYLE, Boolean.TRUE );

    result.getDefaultLoadOptions ().put ( XMLResource.OPTION_USE_LEXICAL_HANDLER, Boolean.TRUE );
    return result;
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:22,代码来源:ChartResourceFactoryImpl.java

示例13: getProjectDescription

import org.eclipse.emf.common.util.URI; //导入依赖的package包/类
@Override
public ProjectDescription getProjectDescription(URI location) {
	LazyProjectDescriptionHandle handle = projectElementHandles.get(location);
	if (handle == null) {
		// check case without trailing path separator
		if (location.hasTrailingPathSeparator()) {
			handle = projectElementHandles.get(location.trimSegments(1));
		}
	}

	if (handle == null) {
		return null;
	}

	ProjectDescription description = handle.resolve();
	return description;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:18,代码来源:FileBasedWorkspace.java

示例14: matches

import org.eclipse.emf.common.util.URI; //导入依赖的package包/类
@Override
public boolean matches(Issue issue) {
	URI actualValue = getActualValue.apply(issue);
	if (actualValue == null)
		return false;

	List<String> actualSegments = actualValue.segmentsList();
	List<String> expectedSegments = expectedPattern.segmentsList();

	switch (mode) {
	case StartsWith:
		return Collections.indexOfSubList(actualSegments, expectedSegments) == 0;
	case EndsWith:
		return Collections.lastIndexOfSubList(actualSegments, expectedSegments) == actualSegments.size()
				- expectedSegments.size();
	case Equals:
		return actualSegments.equals(expectedSegments);
	}

	throw new IllegalStateException("Unknown URI property matching mode: " + mode);
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:22,代码来源:URIPropertyMatcher.java

示例15: getIFile

import org.eclipse.emf.common.util.URI; //导入依赖的package包/类
/**
 * Getting an IFile from an EMF Resource
 * 
 * @param eObject
 * @return
 */
public static IFile getIFile(Resource res) {
	URI uri = res.getURI();
	String filePath = uri.toPlatformString(true);
	IFile ifile = ResourcesPlugin.getWorkspace().getRoot()
			.getFile(new Path(filePath));
	return ifile;
}
 
开发者ID:eclipse,项目名称:gemoc-studio,代码行数:14,代码来源:EMFResource.java


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