當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。