org.eclipse.emf.workspace.util.WorkspaceSynchronizer Java Examples
The following examples show how to use
org.eclipse.emf.workspace.util.WorkspaceSynchronizer.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ProcessDocumentProvider.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
/** * @generated */ protected ISchedulingRule getSynchronizeRule(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().refreshRule(file)); } } return new MultiRule((ISchedulingRule[]) rules.toArray(new ISchedulingRule[rules.size()])); } return null; }
Example #2
Source File: CrossflowNavigatorLinkHelper.java From scava with Eclipse Public License 2.0 | 6 votes |
/** * @generated */ public IStructuredSelection findSelection(IEditorInput anInput) { IDiagramDocument document = CrossflowDiagramEditorPlugin.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) { CrossflowNavigatorItem item = new CrossflowNavigatorItem(diagram, file, false); return new StructuredSelection(item); } return StructuredSelection.EMPTY; }
Example #3
Source File: ProcessNavigatorLinkHelper.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
/** * @generated */ public IStructuredSelection findSelection(IEditorInput anInput) { IDiagramDocument document = ProcessDiagramEditorPlugin.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) { ProcessNavigatorItem item = new ProcessNavigatorItem(diagram, file, false); return new StructuredSelection(item); } return StructuredSelection.EMPTY; }
Example #4
Source File: CrossflowNavigatorActionProvider.java From scava with Eclipse Public License 2.0 | 6 votes |
/** * @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; }
Example #5
Source File: SexecLaunchConfigurationDelegate.java From statecharts with Eclipse Public License 1.0 | 6 votes |
@Override protected ISimulationEngine createExecutionContainer(final ILaunch launch, Statechart statechart) { try { Injector injector = getInjector(statechart, launch); IFile file = WorkspaceSynchronizer.getFile(statechart.eResource()); injector.injectMembers(this); for (IOperationExecutor mockup : mockups) { if (mockup instanceof JavaOperationMockup) { IProject project = file.getProject(); String classes = launch.getLaunchConfiguration().getAttribute(ISCTLaunchParameters.OPERATION_CLASS, ""); String[] split = classes.split(","); ((JavaOperationMockup) mockup).initOperationCallbacks(project, split); } } return factory.createExecutionContainer(statechart, launch); } catch (CoreException e) { e.printStackTrace(); return null; } }
Example #6
Source File: CrossflowDocumentProvider.java From scava with Eclipse Public License 2.0 | 6 votes |
/** * @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; }
Example #7
Source File: CrossflowDocumentProvider.java From scava with Eclipse Public License 2.0 | 6 votes |
/** * @generated */ protected ISchedulingRule getSynchronizeRule(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().refreshRule(file)); } } return new MultiRule((ISchedulingRule[]) rules.toArray(new ISchedulingRule[rules.size()])); } return null; }
Example #8
Source File: CrossflowDocumentProvider.java From scava with Eclipse Public License 2.0 | 6 votes |
/** * @generated */ protected ISchedulingRule getSaveRule(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(computeSchedulingRule(file)); } } return new MultiRule((ISchedulingRule[]) rules.toArray(new ISchedulingRule[rules.size()])); } return null; }
Example #9
Source File: CrossflowDocumentProvider.java From scava with Eclipse Public License 2.0 | 6 votes |
/** * @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; }
Example #10
Source File: CrossflowDocumentProvider.java From scava with Eclipse Public License 2.0 | 6 votes |
/** * @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; } }
Example #11
Source File: CrossflowDocumentProvider.java From scava with Eclipse Public License 2.0 | 6 votes |
/** * @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); }
Example #12
Source File: CrossflowDocumentProvider.java From scava with Eclipse Public License 2.0 | 6 votes |
/** * @generated */ private long computeModificationStamp(ResourceSetInfo info) { int result = 0; for (Iterator<Resource> it = info.getLoadedResourcesIterator(); it.hasNext();) { Resource nextResource = 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; }
Example #13
Source File: ExtendendResourceLinkHelper.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
@Override public IStructuredSelection findSelection(IEditorInput anInput) { IDiagramDocument document = ProcessDiagramEditorPlugin.getInstance().getDocumentProvider() .getDiagramDocument(anInput); if (document == null) { return super.findSelection(anInput); } Diagram diagram = document.getDiagram(); if (diagram == null || diagram.eResource() == null) { return StructuredSelection.EMPTY; } IFile file = WorkspaceSynchronizer.getFile(diagram.eResource()); if (file != null) { return new StructuredSelection(file); } return StructuredSelection.EMPTY; }
Example #14
Source File: DefaultResourceChangeToIssueProcessor.java From statecharts with Eclipse Public License 1.0 | 6 votes |
@Override public ResourceDeltaToIssueResult process(IResourceChangeEvent event, Resource connectedResource, Multimap<String, SCTIssue> visibleIssues) { final IFile file = WorkspaceSynchronizer.getFile(connectedResource); if (file == null) { return null; } 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); }
Example #15
Source File: ValidateAction.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
/** * @generated */ private static void validate(DiagramEditPart diagramEditPart, View view) { IFile target = view.eResource() != null ? WorkspaceSynchronizer.getFile(view.eResource()) : null; if (target != null) { ProcessMarkerNavigationProvider.deleteMarkers(target); } Diagnostic diagnostic = runEMFValidator(view); createMarkers(target, diagnostic, diagramEditPart); IBatchValidator validator = (IBatchValidator) ModelValidationService.getInstance() .newValidator(EvaluationMode.BATCH); validator.setIncludeLiveConstraints(true); if (view.isSetElement() && view.getElement() != null) { IStatus status = validator.validate(view.getElement()); createMarkers(target, status, diagramEditPart); } }
Example #16
Source File: ProcessDocumentProvider.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
/** * @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; }
Example #17
Source File: DiagramPartitioningUtil.java From statecharts with Eclipse Public License 1.0 | 6 votes |
/** * Opens a subdiagram for a given {@link Diagram} */ public static IEditorPart openEditor(Diagram diagramToOpen) { IFile file = WorkspaceSynchronizer.getFile(diagramToOpen.eResource()); try { IEditorDescriptor desc = PlatformUI.getWorkbench().getEditorRegistry().getDefaultEditor(file.getName()); final IWorkbenchPage wbPage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); if (diagramToOpen.getElement() instanceof Statechart) { return wbPage.openEditor(new FileEditorInput(file), desc.getId()); } else if (diagramToOpen.getElement() instanceof State) { return wbPage.openEditor(new DiagramEditorInput(diagramToOpen), desc.getId()); } } catch (PartInitException e) { e.printStackTrace(); } return null; }
Example #18
Source File: ProcessDocumentProvider.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
/** * @generated */ protected ISchedulingRule getSaveRule(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(computeSchedulingRule(file)); } } return new MultiRule((ISchedulingRule[]) rules.toArray(new ISchedulingRule[rules.size()])); } return null; }
Example #19
Source File: ProcessDocumentProvider.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
/** * @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; }
Example #20
Source File: ProcessDocumentProvider.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
/** * @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; } }
Example #21
Source File: DiagramPartitioningBreadcrumbViewer.java From statecharts with Eclipse Public License 1.0 | 6 votes |
protected Set<IFile> getProjectStatechartInput(Diagram diagram) { final IFile file = WorkspaceSynchronizer.getFile(diagram.eResource()); final IProject project = file.getProject(); final Set<IFile> result = new HashSet<IFile>(); try { project.accept(new IResourceVisitor() { public boolean visit(IResource resource) throws CoreException { // TODO check for package explorer filters here if (resource.isHidden()) { return false; } if (resource instanceof IFile) { if (file.getFileExtension().equals(resource.getFileExtension())) result.add((IFile) resource); } return true; } }); } catch (CoreException e) { e.printStackTrace(); } return result; }
Example #22
Source File: ProcessDocumentProvider.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
/** * @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); }
Example #23
Source File: ProcessDocumentProvider.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
/** * @generated */ private long computeModificationStamp(ResourceSetInfo info) { int result = 0; for (Iterator<Resource> it = info.getLoadedResourcesIterator(); it.hasNext();) { Resource nextResource = 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; }
Example #24
Source File: ProcessDiagramEditor.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
/** * @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) { ProcessNavigatorItem item = new ProcessNavigatorItem(diagram, file, false); return new StructuredSelection(item); } return StructuredSelection.EMPTY; }
Example #25
Source File: AbstractMarkerBasedDecorationProvider.java From statecharts with Eclipse Public License 1.0 | 6 votes |
public void refresh() { removeDecoration(); View view = (View) getDecoratorTarget().getAdapter(View.class); if (view == null || view.eResource() == null) { return; } EditPart editPart = (EditPart) getDecoratorTarget().getAdapter(EditPart.class); if (editPart == null || editPart.getViewer() == null) { return; } IResource resource = WorkspaceSynchronizer.getFile(view.eResource()); if (resource == null || !resource.exists()) { return; } List<IMarker> markers = new ArrayList<IMarker>(); try { markers.addAll(Arrays.asList(resource.findMarkers(getMarkerType(), true, IResource.DEPTH_INFINITE))); } catch (CoreException e) { e.printStackTrace(); } if (markers == null || markers.size() == 0) { return; } createDecorators(view, markers); }
Example #26
Source File: SCTHotModelReplacementManager.java From statecharts with Eclipse Public License 1.0 | 6 votes |
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(); } } } } }
Example #27
Source File: NavigatorActionProvider.java From statecharts with Eclipse Public License 1.0 | 6 votes |
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; }
Example #28
Source File: NavigatorLinkHelper.java From statecharts with Eclipse Public License 1.0 | 6 votes |
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; }
Example #29
Source File: ValidationMarkerProvider.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
public void clearMarkers(final Map<Diagram, DiagramEditPart> diagramsToDiagramEditPart) { final Iterator<Entry<Diagram, DiagramEditPart>> iterator = diagramsToDiagramEditPart.entrySet().iterator(); while (iterator.hasNext()) { final Entry<Diagram, DiagramEditPart> entry = iterator.next(); final Diagram d = entry.getKey(); final DiagramEditPart de = entry.getValue(); if (de != null) { final EObject resolvedSemanticElement = de.resolveSemanticElement(); if (resolvedSemanticElement instanceof MainProcess) { final IFile target = d.eResource() != null ? WorkspaceSynchronizer.getFile(d.eResource()) : null; if (target != null) { org.bonitasoft.studio.model.process.diagram.providers.ProcessMarkerNavigationProvider.deleteMarkers(target); break; } } } } }
Example #30
Source File: BatchValidationOperation.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
public IStatus getResult() { final MultiStatus result = new MultiStatus(ValidationCommonPlugin.PLUGIN_ID, IStatus.OK, "", null); fileProcessed.clear(); for (final Diagram d : diagramsToDiagramEditPart.keySet()) { final EObject element = d.getElement(); if (element != null) { final IFile target = d.eResource() != null ? WorkspaceSynchronizer.getFile(d.eResource()) : null; if (target != null && !fileProcessed.contains(target)) { try { buildMultiStatus(target, result); } catch (final CoreException e) { BonitaStudioLog.error(e); } } } } return result; }