gpt4 book ai didi

org.eclipse.wst.common.internal.emfworkbench.WorkbenchResourceHelper.getFile()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-27 12:39:05 29 4
gpt4 key购买 nike

本文整理了Java中org.eclipse.wst.common.internal.emfworkbench.WorkbenchResourceHelper.getFile()方法的一些代码示例,展示了WorkbenchResourceHelper.getFile()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WorkbenchResourceHelper.getFile()方法的具体详情如下:
包路径:org.eclipse.wst.common.internal.emfworkbench.WorkbenchResourceHelper
类名称:WorkbenchResourceHelper
方法名:getFile

WorkbenchResourceHelper.getFile介绍

[英]Return the IFile that currently corresponds to aResource.
[中]返回当前对应于aResource的IFile。

代码示例

代码示例来源:origin: org.eclipse/org.eclipse.wst.common.emfworkbench.integration

protected List getFiles(List refResources) {
  List files = new ArrayList(refResources.size());
  IFile file = null;
  ReferencedResource refRes = null;
  for (int i = 0; i < refResources.size(); i++) {
    refRes = (ReferencedResource) refResources.get(i);
    file = WorkbenchResourceHelper.getFile(refRes);
    if (file != null)
      files.add(file);
  }
  return files;
}

代码示例来源:origin: org.eclipse/org.eclipse.wst.xml.core

private void cacheSynchronizationStamp() {
  IFile file = WorkbenchResourceHelper.getFile(resource);
  if (file != null) {
    if (xmlModel != null)
      xmlModel.resetSynchronizationStamp(file);
  }
}

代码示例来源:origin: org.eclipse/org.eclipse.wst.common.emfworkbench.integration

/**
 * Delete
 * 
 * @aResource in the Workbench.
 */
public static void deleteResource(Resource aResource) throws CoreException {
  if (aResource != null)
    deleteFile(getFile(aResource));
}

代码示例来源:origin: org.eclipse/org.eclipse.jst.j2ee

public IResource getResource(Object object) {
  Resource resource = null;
  if (object != null && object instanceof EObject)
    resource = ((EObject) object).eResource();
  if (resource != null)
    return WorkbenchResourceHelper.getFile(resource);
  return null;
}

代码示例来源:origin: org.eclipse/org.eclipse.wst.common.emfworkbench.integration

public Set getAffectedFiles() {
  Set aSet = new HashSet();
  List mofResources = getResources();
  for (int i = 0; i < mofResources.size(); i++) {
    Resource aResource = (Resource) mofResources.get(i);
    IFile output = WorkbenchResourceHelper.getFile(aResource);
    if (output != null)
      aSet.add(output);
  }
  return aSet;
}

代码示例来源:origin: org.eclipse/org.eclipse.wst.common.emfworkbench.integration

public static IFile getFile(EObject obj) {
  if (obj == null)
    return null;
  Resource mofResource = obj.eResource();
  if (mofResource == null)
    return null;
  return getFile(mofResource);
}

代码示例来源:origin: org.eclipse/org.eclipse.wst.common.emfworkbench.integration

public static IFile getFile(IProject project, URI uri) {
  ResourceSet set = getResourceSet(project);
  return getFile(set, uri);
}

代码示例来源:origin: org.eclipse/org.eclipse.wst.xml.core

protected void loadDocument(InputStream in, Map options) throws IOException {
  if (null != in) {
    throw new RuntimeException(this.getClass().getName() + " should not use an InputStream for loading");} //$NON-NLS-1$
  IFile file = WorkbenchResourceHelper.getFile(resource);
  initializeXMLModel(file, (resource.getWriteCount() != 0));
  cacheSynchronizationStamp();
}

代码示例来源:origin: org.eclipse/org.eclipse.wst.common.emfworkbench.integration

protected static IFile internalGetFile(Resource aResource) {
  if (aResource != null)
    return getFile(aResource.getResourceSet(), aResource.getURI());
  return null;
}

代码示例来源:origin: org.eclipse/org.eclipse.jst.j2ee

protected void removeAllMessages(EObject eObject, String groupName) {
  Resource res = eObject.eResource();
  if(res != null) {
    IFile file = WorkbenchResourceHelper.getFile(res);
    if(file != null)
      _reporter.removeMessageSubset(this,file,groupName);
  }
}

代码示例来源:origin: org.eclipse/org.eclipse.wst.common.emfworkbench.integration

/**
 * Return the IFile that currently corresponds to <code>aResource</code>.
 */
public static IFile getFile(Resource aResource) {
  if (aResource != null) {
    if (isReferencedResource(aResource))
      return getFile((ReferencedResource) aResource);
    return internalGetFile(aResource);
  }
  return null;
}

代码示例来源:origin: org.eclipse/org.eclipse.jst.j2ee.ui

public static IEditorInput getEditorInput(Object input) {
  if (input instanceof EObject)
    return new FileEditorInput(WorkbenchResourceHelper.getFile((EObject) input));
  if (input instanceof IFile)
    return new FileEditorInput((IFile) input);
  return null;
}

代码示例来源:origin: org.eclipse/org.eclipse.jst.jee

public IStatus validateEdit(IPath modelPath, Object context) {
  if (modelPath == null)
    modelPath = getDefaultResourcePath();
  IWorkspace work = ResourcesPlugin.getWorkspace();
  IFile file = WorkbenchResourceHelper.getFile(getModelResource(modelPath));
  if (file != null) {
    IFile[] files = { file };
    if (context == null)
      context = IWorkspace.VALIDATE_PROMPT;
    return work.validateEdit(files, context);
  } else
    return Status.OK_STATUS;
}

代码示例来源:origin: org.eclipse/org.eclipse.wst.common.emfworkbench.integration

protected boolean shouldSaveReadOnly(Resource aResource) {
  IFile aFile = WorkbenchResourceHelper.getFile(aResource);
  if (aFile == null || !aFile.isReadOnly())
    return false;
  return getSaveHandler().shouldContinueAndMakeFileEditable(aFile);
}

代码示例来源:origin: org.eclipse/org.eclipse.wst.common.emfworkbench.integration

public static IProject getProject(Resource res) {
  IProject proj = getProject(res.getResourceSet());
  if (proj == null) {
    IFile file = getFile(res);
    if (file != null)
      proj = file.getProject();
  }
  return proj;
}

代码示例来源:origin: org.eclipse/org.eclipse.jst.j2ee.ejb

protected static IModule getModule(EObject refObject) {
  IProject proj = ProjectUtilities.getProject(refObject);
  Resource refResource = refObject.eResource();
  IVirtualResource[] resources = null;
  IVirtualComponent component = null;
  try {
    IResource eclipeServResoruce = WorkbenchResourceHelper.getFile(refResource);
    resources = ComponentCore.createResources(eclipeServResoruce);
    if (resources[0] != null)
      component = resources[0].getComponent();
  } catch (Exception e) {
    e.printStackTrace();
  }
  return getModule(proj, component);
}

代码示例来源:origin: org.eclipse/org.eclipse.wst.xml.core

public void processPreModelEvent(ModelLifecycleEvent event) {
  if (!isSaving) {
    if (event.getType() == ModelLifecycleEvent.MODEL_SAVED) {
      ResourceSetWorkbenchEditSynchronizer synchronizer = (ResourceSetWorkbenchEditSynchronizer) ((ProjectResourceSet) resource.getResourceSet()).getSynchronizer();
      IFile aFile = WorkbenchResourceHelper.getFile(resource);
      synchronizer.preSave(aFile);
    }
  }
}

代码示例来源:origin: org.eclipse/org.eclipse.jst.j2ee

protected void cleanUpAllRefSubTaskMessages(Resource res) {
  if (res != null) {
    IFile file = WorkbenchResourceHelper.getFile(res);
    if (file != null)
      _reporter.removeMessageSubset(this, file, EJB_REF_GROUP_NAME);
    _reporter.removeMessageSubset(this, file, RES_REF_GROUP_NAME);
    _reporter.removeMessageSubset(this, file, SERVICE_REF_GROUP_NAME);
    _reporter.removeMessageSubset(this, file, SEC_ROLE_REF_GROUP_NAME);
    _reporter.removeMessageSubset(this, file, MESSAGE_REF_GROUP_NAME);
    _reporter.removeMessageSubset(this, file, RES_ENV_REF_GROUP_NAME);
  }
}

代码示例来源:origin: org.eclipse/org.eclipse.jst.j2ee.webservice

public Resource getWSDLResource(WebServiceDescription webService) {
  if (webService == null)
    return null;
  String wsdlFileName = webService.getWsdlFile();
  Resource res = null;
  IVirtualResource[] resources = ComponentCore.createResources(WorkbenchResourceHelper.getFile(webService));
  if (resources == null || resources.length==0) return res;
  WSDDArtifactEdit artifactEdit = getExistingWSDDArtifactEdit(resources[0].getComponent().getProject());
  if (artifactEdit!=null) 
    res = artifactEdit.getWsdlResource(wsdlFileName);
  return res;
}

代码示例来源:origin: org.eclipse/org.eclipse.wst.xml.core

public void modelDirtyStateChanged(IStructuredModel model, boolean isDirty) {
  if (!isDirty && resource.isModified()) { // The XMLModel was saved
    resource.setModified(false);
    long stamp = WorkbenchResourceHelper.computeModificationStamp(resource);
    WorkbenchResourceHelper.setSynhronizationStamp(resource, stamp);
    IProject proj = WorkbenchResourceHelper.getProject(resource);
    ResourceSetWorkbenchEditSynchronizer synchronizer = (ResourceSetWorkbenchEditSynchronizer) ((ProjectResourceSet) WorkbenchResourceHelperBase.getResourceSet(proj)).getSynchronizer();
    IFile aFile = WorkbenchResourceHelper.getFile(resource);
    synchronizer.preSave(aFile);
  }
  if (isDirty)
    resource.setModified(true);
}

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com