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


Java WorkspaceSynchronizer.getFile方法代码示例

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


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

示例1: getEditorInput

import org.eclipse.emf.workspace.util.WorkspaceSynchronizer; //导入方法依赖的package包/类
/**
 * @generated
 */
private static IEditorInput getEditorInput(Diagram diagram) {
	Resource diagramResource = diagram.eResource();
	for (EObject nextEObject : diagramResource.getContents()) {
		if (nextEObject == diagram) {
			return new FileEditorInput(
					WorkspaceSynchronizer.getFile(diagramResource));
		}
		if (nextEObject instanceof Diagram) {
			break;
		}
	}
	URI uri = EcoreUtil.getURI(diagram);
	String editorName = uri.lastSegment() + '#'
			+ diagram.eResource().getContents().indexOf(diagram);
	IEditorInput editorInput = new URIEditorInput(uri, editorName);
	return editorInput;
}
 
开发者ID:spoenemann,项目名称:xtext-gef,代码行数:21,代码来源:StatemachineNavigatorLinkHelper.java

示例2: createGlossary

import org.eclipse.emf.workspace.util.WorkspaceSynchronizer; //导入方法依赖的package包/类
/**
 * Create glossary file
 * 
 * @param uri
 * @param monitor
 * @return Resource
 */
public static Resource createGlossary(URI uri, IProgressMonitor monitor) {
    monitor.beginTask("CreateGlossary", 3); //$NON-NLS-1$

    // UMLDomain umlDomain = DomainRegistry.getUMLDomain();
    IDomainModelHandler umlDomain = DomainRegistry.getUMLDomain();
    if (umlDomain == null) {
        umlDomain = ProjectUtil.createDomain(true);
    }

    IFile file = null;
    Resource resource = null;
    try {
        resource = DomainModelHandlerUtil.createUMLGlossary(uri);
        resource.save(DomainUtil.getSaveOptions());
        file = WorkspaceSynchronizer.getFile(resource);
        file.setCharset(UICoreConstant.PROJECT_CONSTANTS__ENCODING_UTF8, new NullProgressMonitor());
    } catch (Exception e) {
        Log.error(e);
        ALMLogger.getLog(UiCorePlugin.PLUGIN_ID).error(e.getMessage(), e);
    }

    return resource;
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:31,代码来源:ProjectUtil.java

示例3: getEditorInput

import org.eclipse.emf.workspace.util.WorkspaceSynchronizer; //导入方法依赖的package包/类
private IEditorInput getEditorInput() {
	for (EObject nextEObject : myDiagram.eResource().getContents()) {
		if (nextEObject == myDiagram) {
			return new FileEditorInput(
					WorkspaceSynchronizer.getFile(myDiagram.eResource()));
		}
		if (nextEObject instanceof Diagram) {
			break;
		}
	}
	URI uri = EcoreUtil.getURI(myDiagram);
	String editorName = uri.lastSegment()
			+ "#" + myDiagram.eResource().getContents().indexOf(myDiagram); //$NON-NLS-1$
	IEditorInput editorInput = new URIEditorInput(uri, editorName);
	return editorInput;
}
 
开发者ID:Yakindu,项目名称:statecharts,代码行数:17,代码来源:NavigatorActionProvider.java

示例4: getNavigatorSelection

import org.eclipse.emf.workspace.util.WorkspaceSynchronizer; //导入方法依赖的package包/类
/**
 * @generated
 */
private ISelection getNavigatorSelection() {
	IDiagramDocument document = getDiagramDocument();
	if (document == null) {
		return StructuredSelection.EMPTY;
	}
	Diagram diagram = document.getDiagram();
	if (diagram == null || diagram.eResource() == null) {
		return StructuredSelection.EMPTY;
	}
	IFile file = WorkspaceSynchronizer.getFile(diagram.eResource());
	if (file != null) {
		StatemachineNavigatorItem item = new StatemachineNavigatorItem(
				diagram, file, false);
		return new StructuredSelection(item);
	}
	return StructuredSelection.EMPTY;
}
 
开发者ID:spoenemann,项目名称:xtext-gef,代码行数:21,代码来源:StatemachineDiagramEditor.java

示例5: handleCloseEvent

import org.eclipse.emf.workspace.util.WorkspaceSynchronizer; //导入方法依赖的package包/类
private void handleCloseEvent(IResourceChangeEvent event) {
	if (event.getResource() instanceof IProject) {
		IProject project = ((IProject) event.getResource());
		for (IDebugTarget target : activeTargets) {
			EObject object = (EObject) target.getAdapter(EObject.class);
			IFile file = WorkspaceSynchronizer.getFile(object.eResource());
			if (project.equals(file.getProject())) {
				try {
					target.terminate();
				} catch (DebugException e) {
					e.printStackTrace();
				}
			}
		}
	}
}
 
开发者ID:Yakindu,项目名称:statecharts,代码行数:17,代码来源:SCTHotModelReplacementManager.java

示例6: getEditorInput

import org.eclipse.emf.workspace.util.WorkspaceSynchronizer; //导入方法依赖的package包/类
private static IEditorInput getEditorInput(Diagram diagram) {
	Resource diagramResource = diagram.eResource();
	for (Iterator<EObject> it = diagramResource.getContents().iterator(); it
			.hasNext();) {
		EObject nextEObject = (EObject) it.next();
		if (nextEObject == diagram) {
			return new FileEditorInput(
					WorkspaceSynchronizer.getFile(diagramResource));
		}
		if (nextEObject instanceof Diagram) {
			break;
		}
	}
	URI uri = EcoreUtil.getURI(diagram);
	String editorName = uri.lastSegment() + "#"
			+ diagram.eResource().getContents().indexOf(diagram);
	IEditorInput editorInput = new URIEditorInput(uri, editorName);
	return editorInput;
}
 
开发者ID:Yakindu,项目名称:statecharts,代码行数:20,代码来源:NavigatorLinkHelper.java

示例7: doValidateState

import org.eclipse.emf.workspace.util.WorkspaceSynchronizer; //导入方法依赖的package包/类
/**
 * @generated
 */
protected void doValidateState(Object element, Object computationContext)
		throws CoreException {
	ResourceSetInfo info = getResourceSetInfo(element);
	if (info != null) {
		LinkedList<IFile> files2Validate = new LinkedList<IFile>();
		for (Iterator<Resource> it = info.getLoadedResourcesIterator(); it
				.hasNext();) {
			Resource nextResource = it.next();
			IFile file = WorkspaceSynchronizer.getFile(nextResource);
			if (file != null && file.isReadOnly()) {
				files2Validate.add(file);
			}
		}
		ResourcesPlugin.getWorkspace().validateEdit(
				(IFile[]) files2Validate.toArray(new IFile[files2Validate
						.size()]), computationContext);
	}

	super.doValidateState(element, computationContext);
}
 
开发者ID:spoenemann,项目名称:xtext-gef,代码行数:24,代码来源:StatemachineDocumentProvider.java

示例8: updateCache

import org.eclipse.emf.workspace.util.WorkspaceSynchronizer; //导入方法依赖的package包/类
/**
 * @generated
 */
protected void updateCache(Object element) throws CoreException {
	ResourceSetInfo info = getResourceSetInfo(element);
	if (info != null) {
		for (Iterator<Resource> it = info.getLoadedResourcesIterator(); it
				.hasNext();) {
			Resource nextResource = it.next();
			IFile file = WorkspaceSynchronizer.getFile(nextResource);
			if (file != null && file.isReadOnly()) {
				info.setReadOnly(true);
				info.setModifiable(false);
				return;
			}
		}
		info.setReadOnly(false);
		info.setModifiable(true);
		return;
	}
}
 
开发者ID:spoenemann,项目名称:xtext-gef,代码行数:22,代码来源:StatemachineDocumentProvider.java

示例9: getValidateStateRule

import org.eclipse.emf.workspace.util.WorkspaceSynchronizer; //导入方法依赖的package包/类
/**
 * @generated
 */
protected ISchedulingRule getValidateStateRule(Object element) {
	ResourceSetInfo info = getResourceSetInfo(element);
	if (info != null) {
		LinkedList<ISchedulingRule> files = new LinkedList<ISchedulingRule>();
		for (Iterator<Resource> it = info.getLoadedResourcesIterator(); it
				.hasNext();) {
			Resource nextResource = it.next();
			IFile file = WorkspaceSynchronizer.getFile(nextResource);
			if (file != null) {
				files.add(file);
			}
		}
		return ResourcesPlugin
				.getWorkspace()
				.getRuleFactory()
				.validateEditRule(
						(IFile[]) files.toArray(new IFile[files.size()]));
	}
	return null;
}
 
开发者ID:spoenemann,项目名称:xtext-gef,代码行数:24,代码来源:StatemachineDocumentProvider.java

示例10: process

import org.eclipse.emf.workspace.util.WorkspaceSynchronizer; //导入方法依赖的package包/类
@Override
public ResourceDeltaToIssueResult process(IResourceChangeEvent event, Resource connectedResource,
		Multimap<String, SCTIssue> visibleIssues) {
	final IFile file = WorkspaceSynchronizer.getFile(connectedResource);
	final IResourceDelta deltaForFile = getDeltaForFile(event, file);
	if (deltaForFile == null) {
		return null;
	}
	currentIssues = HashMultimap.create(visibleIssues);
	changedIssuesElementIDs = Sets.newHashSet();
	
	if ((IResourceDelta.CHANGED == deltaForFile.getKind()) && ((deltaForFile.getFlags() & IResourceDelta.MARKERS) != 0)) {
		processMarkerDelta(deltaForFile);
	}
	return new ResourceDeltaToIssueResult(currentIssues,changedIssuesElementIDs);
}
 
开发者ID:Yakindu,项目名称:statecharts,代码行数:17,代码来源:DefaultResourceChangeToIssueProcessor.java

示例11: openDir

import org.eclipse.emf.workspace.util.WorkspaceSynchronizer; //导入方法依赖的package包/类
/**
	 * Creates or returns a project-specific folder
	 * @param resource
	 * @param dirName
	 * @return a handle to the folder
	 */
	public static IFolder openDir(Resource resource, String dirName) {
		IFile file = WorkspaceSynchronizer.getFile(resource);
		IProject project = file.getProject();
		IFolder folder = project.getFolder(dirName);
		if (!folder.exists()) {
			Logger.getLogger(AGCLUtil.class).info("requested folder for model-checker doesn't exist: " + dirName);
			try {
				createResource(folder);
//				folder.create(false, true, null);
				Logger.getLogger(AGCLUtil.class).info("folder for model-checker created: " + dirName);
			} catch (CoreException e) {
				e.printStackTrace();
				Logger.getLogger(AGCLUtil.class).info("failed to create folder for model-checker: " + dirName);
			}
		}
		return folder;
	}
 
开发者ID:eposse,项目名称:osate2-agcl,代码行数:24,代码来源:AGCLUtil.java

示例12: computeModificationStamp

import org.eclipse.emf.workspace.util.WorkspaceSynchronizer; //导入方法依赖的package包/类
/**
 * @generated
 */
private long computeModificationStamp(ResourceSetInfo info) {
	int result = 0;
	for (Iterator/*<org.eclipse.emf.ecore.resource.Resource>*/it = info
			.getLoadedResourcesIterator(); it.hasNext();) {
		Resource nextResource = (Resource) it.next();
		IFile file = WorkspaceSynchronizer.getFile(nextResource);
		if (file != null) {
			if (file.getLocation() != null) {
				result += file.getLocation().toFile().lastModified();
			} else {
				result += file.getModificationStamp();
			}
		}
	}
	return result;
}
 
开发者ID:road-framework,项目名称:ROADDesigner,代码行数:20,代码来源:SmcDocumentProvider.java

示例13: updateCache

import org.eclipse.emf.workspace.util.WorkspaceSynchronizer; //导入方法依赖的package包/类
/**
 * @generated
 */
protected void updateCache(Object element) throws CoreException {
	ResourceSetInfo info = getResourceSetInfo(element);
	if (info != null) {
		for (Iterator/*<org.eclipse.emf.ecore.resource.Resource>*/it = info
				.getLoadedResourcesIterator(); it.hasNext();) {
			Resource nextResource = (Resource) it.next();
			IFile file = WorkspaceSynchronizer.getFile(nextResource);
			if (file != null && file.isReadOnly()) {
				info.setReadOnly(true);
				info.setModifiable(false);
				return;
			}
		}
		info.setReadOnly(false);
		info.setModifiable(true);
		return;
	}
}
 
开发者ID:road-framework,项目名称:ROADDesigner,代码行数:22,代码来源:SmcDocumentProvider.java

示例14: findSelection

import org.eclipse.emf.workspace.util.WorkspaceSynchronizer; //导入方法依赖的package包/类
/**
 * @generated
 */
public IStructuredSelection findSelection(IEditorInput anInput) {
	IDiagramDocument document = Wc2014DiagramEditorPlugin.getInstance()
			.getDocumentProvider().getDiagramDocument(anInput);
	if (document == null) {
		return StructuredSelection.EMPTY;
	}
	Diagram diagram = document.getDiagram();
	if (diagram == null || diagram.eResource() == null) {
		return StructuredSelection.EMPTY;
	}
	IFile file = WorkspaceSynchronizer.getFile(diagram.eResource());
	if (file != null) {
		Wc2014NavigatorItem item = new Wc2014NavigatorItem(diagram, file,
				false);
		return new StructuredSelection(item);
	}
	return StructuredSelection.EMPTY;
}
 
开发者ID:ggxx,项目名称:HelloBrazil,代码行数:22,代码来源:Wc2014NavigatorLinkHelper.java

示例15: getResetRule

import org.eclipse.emf.workspace.util.WorkspaceSynchronizer; //导入方法依赖的package包/类
/**
 * @generated
 */
protected ISchedulingRule getResetRule(Object element) {
	ResourceSetInfo info = getResourceSetInfo(element);
	if (info != null) {
		LinkedList<ISchedulingRule> rules = new LinkedList<ISchedulingRule>();
		for (Iterator<Resource> it = info.getLoadedResourcesIterator(); it
				.hasNext();) {
			Resource nextResource = it.next();
			IFile file = WorkspaceSynchronizer.getFile(nextResource);
			if (file != null) {
				rules.add(ResourcesPlugin.getWorkspace().getRuleFactory()
						.modifyRule(file));
			}
		}
		return new MultiRule(
				(ISchedulingRule[]) rules.toArray(new ISchedulingRule[rules
						.size()]));
	}
	return null;
}
 
开发者ID:bluezio,项目名称:simplified-bpmn-example,代码行数:23,代码来源:SimpleBPMNDocumentProvider.java


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