當前位置: 首頁>>代碼示例>>Java>>正文


Java Resource.isLoaded方法代碼示例

本文整理匯總了Java中org.eclipse.emf.ecore.resource.Resource.isLoaded方法的典型用法代碼示例。如果您正苦於以下問題:Java Resource.isLoaded方法的具體用法?Java Resource.isLoaded怎麽用?Java Resource.isLoaded使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.eclipse.emf.ecore.resource.Resource的用法示例。


在下文中一共展示了Resource.isLoaded方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: handleChangedResources

import org.eclipse.emf.ecore.resource.Resource; //導入方法依賴的package包/類
/**
 * Handles what to do with changed resources on activation.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected void handleChangedResources() {
	if (!changedResources.isEmpty() && (!isDirty() || handleDirtyConflict())) {
		if (isDirty()) {
			changedResources.addAll(editingDomain.getResourceSet().getResources());
		}
		editingDomain.getCommandStack().flush();

		updateProblemIndication = false;
		for (Resource resource : changedResources) {
			if (resource.isLoaded()) {
				resource.unload();
				try {
					resource.load(Collections.EMPTY_MAP);
				}
				catch (IOException exception) {
					if (!resourceToDiagnosticMap.containsKey(resource)) {
						resourceToDiagnosticMap.put(resource, analyzeResourceProblems(resource, exception));
					}
				}
			}
		}

		if (AdapterFactoryEditingDomain.isStale(editorSelection)) {
			setSelection(StructuredSelection.EMPTY);
		}

		updateProblemIndication = true;
		updateProblemIndication();
	}
}
 
開發者ID:polarsys,項目名稱:time4sys,代碼行數:37,代碼來源:Time4sysEditor.java

示例2: resolveObject

import org.eclipse.emf.ecore.resource.Resource; //導入方法依賴的package包/類
/**
 * {@link EcoreUtil#resolve(EObject, EObject)} pretty much does the same thing but will eagerly load the resource.
 * We are happy with the content that we just put into it.
 */
private EObject resolveObject(URI objectURI, Resource resource) {
	if (resource.isLoaded())
		throw new IllegalStateException("Should not be loaded beforehand");
	EObject result = resource.getEObject(objectURI.fragment());
	if (resource.isLoaded())
		throw new IllegalStateException("Should not be loaded due to fragment traversal");
	return result;
}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:13,代碼來源:UserDataAwareScope.java

示例3: handleChangedResources

import org.eclipse.emf.ecore.resource.Resource; //導入方法依賴的package包/類
/**
 * Handles what to do with changed resources on activation.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected void handleChangedResources ()
{
    if ( !changedResources.isEmpty () && ( !isDirty () || handleDirtyConflict () ) )
    {
        if ( isDirty () )
        {
            changedResources.addAll ( editingDomain.getResourceSet ().getResources () );
        }
        editingDomain.getCommandStack ().flush ();

        updateProblemIndication = false;
        for ( Resource resource : changedResources )
        {
            if ( resource.isLoaded () )
            {
                resource.unload ();
                try
                {
                    resource.load ( Collections.EMPTY_MAP );
                }
                catch ( IOException exception )
                {
                    if ( !resourceToDiagnosticMap.containsKey ( resource ) )
                    {
                        resourceToDiagnosticMap.put ( resource, analyzeResourceProblems ( resource, exception ) );
                    }
                }
            }
        }

        if ( AdapterFactoryEditingDomain.isStale ( editorSelection ) )
        {
            setSelection ( StructuredSelection.EMPTY );
        }

        updateProblemIndication = true;
        updateProblemIndication ();
    }
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:46,代碼來源:ItemEditor.java

示例4: loadInstanceModel

import org.eclipse.emf.ecore.resource.Resource; //導入方法依賴的package包/類
/**
 * Gets root EObject of given xmi file path
 *
 * @param xmiFileFullPath file path of xmi file
 * @return root @EObject
 * @throws IOException
 */
@SuppressWarnings({"rawtypes", "unchecked"})
public static Resource loadInstanceModel(final String xmiFileFullPath) throws IOException {
  final Map options = new HashMap();
  options.put(XMLResource.OPTION_SCHEMA_LOCATION, Boolean.TRUE);

  final ResourceSetImpl resourceSet = new ResourceSetImpl();
  resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap()
      .put(Resource.Factory.Registry.DEFAULT_EXTENSION, new XMIResourceFactoryImpl());
  Resource resource =
      resourceSet.getResource(URI.createPlatformResourceURI(xmiFileFullPath, true), true);
  if (resource == null) {
    resource = resourceSet.getResource(URI.createFileURI(xmiFileFullPath), true);
    if (resource == null) {
      resource =
          resourceSet.getResource(URI.createPlatformPluginURI(xmiFileFullPath, true), true);
      if (resource == null) {
        resource = resourceSet.getResource(URI.createURI(xmiFileFullPath), true);
      }
    }
  }
  resource.load(options);
  if (resource.isLoaded()) {
    return resource;
  }
  return null;
}
 
開發者ID:ModelWriter,項目名稱:Tarski,代碼行數:34,代碼來源:EcoreUtilities.java

示例5: postProcess

import org.eclipse.emf.ecore.resource.Resource; //導入方法依賴的package包/類
/**
 * Convenience method to fully resolve all lazy cross-references and perform post-processing on the N4JSResource
 * 'resource'. Does nothing if 'resource' is <code>null</code> or not an N4JSResource.
 */
public static final void postProcess(Resource resource) {
	if (resource instanceof N4JSResource && resource.isLoaded())
		((N4JSResource) resource).performPostProcessing();
}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:9,代碼來源:N4JSResource.java


注:本文中的org.eclipse.emf.ecore.resource.Resource.isLoaded方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。