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


Java Diagram类代码示例

本文整理汇总了Java中org.eclipse.gmf.runtime.notation.Diagram的典型用法代码示例。如果您正苦于以下问题:Java Diagram类的具体用法?Java Diagram怎么用?Java Diagram使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: getCrossReferencingViews

import org.eclipse.gmf.runtime.notation.Diagram; //导入依赖的package包/类
public static Set<View> getCrossReferencingViews(EObject referencedObject) {
	Set<View> referencingObjects = new HashSet<>();
	CrossReferenceAdapter crossReferenceAdapter = getCrossReferenceAdapter(referencedObject);
	if (crossReferenceAdapter != null) {
		// Retrieve all views referencing the referencedObject
		Iterator<?> views = crossReferenceAdapter.getInverseReferencers(referencedObject,
				NotationPackage.eINSTANCE.getView_Element(), NotationPackage.eINSTANCE.getView()).iterator();
		while (views.hasNext()) {
			View view = (View) views.next();
			if (!(view instanceof Diagram)) { 
				referencingObjects.add(view);
			}
		}
	}
	return referencingObjects;
}
 
开发者ID:bmaggi,项目名称:library-training,代码行数:17,代码来源:NoBookTwiceOneShellModelConstraint.java

示例2: getNavigatorSelection

import org.eclipse.gmf.runtime.notation.Diagram; //导入依赖的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

示例3: arrangeElementsOfDiagram

import org.eclipse.gmf.runtime.notation.Diagram; //导入依赖的package包/类
@Override
protected void arrangeElementsOfDiagram(Diagram diagram, IProgressMonitor monitor) throws ArrangeException{
	IDiagramElementsArranger diagramElementsArranger;
	DiagramEditPart diagep = diagramManager.getActiveDiagramEditPart();
	if(diagram.getType().equals("PapyrusUMLClassDiagram")){					
		diagramElementsArranger = new ClassDiagramElementsGmfArranger(diagep);
	}else if(diagram.getType().equals("PapyrusUMLActivityDiagram")){
		diagramElementsArranger = new ActivityDiagramElementsGmfArranger(diagep);
	}else if(diagram.getType().equals("PapyrusUMLStateMachineDiagram")){
		diagramElementsArranger = new StateMachineDiagramElementsGmfArranger(diagep);
	}else{
		return;
	}
	
	diagramElementsArranger.arrange(monitor);
}
 
开发者ID:ELTE-Soft,项目名称:txtUML,代码行数:17,代码来源:DefaultPapyrusModelManager.java

示例4: selectExistingElement

import org.eclipse.gmf.runtime.notation.Diagram; //导入依赖的package包/类
/**
 * @generated
 */
protected EObject selectExistingElement(IAdaptable host, Collection types) {
	if (types.isEmpty()) {
		return null;
	}
	IGraphicalEditPart editPart = (IGraphicalEditPart) host
			.getAdapter(IGraphicalEditPart.class);
	if (editPart == null) {
		return null;
	}
	Diagram diagram = (Diagram) editPart.getRoot().getContents().getModel();
	HashSet<EObject> elements = new HashSet<EObject>();
	for (Iterator<EObject> it = diagram.getElement().eAllContents(); it
			.hasNext();) {
		EObject element = it.next();
		if (isApplicableElement(element, types)) {
			elements.add(element);
		}
	}
	if (elements.isEmpty()) {
		return null;
	}
	return selectElement((EObject[]) elements.toArray(new EObject[elements
			.size()]));
}
 
开发者ID:spoenemann,项目名称:xtext-gef,代码行数:28,代码来源:StatemachineModelingAssistantProvider.java

示例5: getEditorInput

import org.eclipse.gmf.runtime.notation.Diagram; //导入依赖的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

示例6: findSelection

import org.eclipse.gmf.runtime.notation.Diagram; //导入依赖的package包/类
/**
 * @generated
 */
public IStructuredSelection findSelection(IEditorInput anInput) {
	IDiagramDocument document = StatemachineDiagramEditorPlugin
			.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) {
		StatemachineNavigatorItem item = new StatemachineNavigatorItem(
				diagram, file, false);
		return new StructuredSelection(item);
	}
	return StructuredSelection.EMPTY;
}
 
开发者ID:spoenemann,项目名称:xtext-gef,代码行数:23,代码来源:StatemachineNavigatorLinkHelper.java

示例7: getDiagramContaining

import org.eclipse.gmf.runtime.notation.Diagram; //导入依赖的package包/类
/**
 * Returns the {@link Diagram} that contains a given semantic element.
 */
public static Diagram getDiagramContaining(EObject element) {
	Assert.isNotNull(element);
	Resource eResource = element.eResource();
	Collection<Diagram> objects = EcoreUtil.getObjectsByType(eResource.getContents(),
			NotationPackage.Literals.DIAGRAM);
	for (Diagram diagram : objects) {
		TreeIterator<EObject> eAllContents = diagram.eAllContents();
		while (eAllContents.hasNext()) {
			EObject next = eAllContents.next();
			if (next instanceof View) {
				if (EcoreUtil.equals(((View) next).getElement(), element)) {
					return ((View) next).getDiagram();
				}
			}
		}
	}
	return null;
}
 
开发者ID:Yakindu,项目名称:statecharts,代码行数:22,代码来源:DiagramPartitioningUtil.java

示例8: openEditor

import org.eclipse.gmf.runtime.notation.Diagram; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:Yakindu,项目名称:statecharts,代码行数:19,代码来源:DiagramPartitioningUtil.java

示例9: findNotationView

import org.eclipse.gmf.runtime.notation.Diagram; //导入依赖的package包/类
public static View findNotationView(EObject semanticElement) {
	Collection<Diagram> objects = EcoreUtil.getObjectsByType(semanticElement.eResource().getContents(),
			NotationPackage.Literals.DIAGRAM);
	for (Diagram diagram : objects) {
		TreeIterator<EObject> eAllContents = diagram.eAllContents();
		while (eAllContents.hasNext()) {
			EObject next = eAllContents.next();
			if (next instanceof View) {
				if (((View) next).getElement() == semanticElement) {
					return ((View) next);
				}
			}
		}
	}
	return null;
}
 
开发者ID:Yakindu,项目名称:statecharts,代码行数:17,代码来源:DiagramPartitioningUtil.java

示例10: createElement

import org.eclipse.gmf.runtime.notation.Diagram; //导入依赖的package包/类
public IAdaptable createElement(IMemento memento) {
	String uriStr = memento.getString(EMF_URI);
	if (uriStr == null) {
		return null;
	}
	URI uri = URI.createURI(uriStr);
	ResourceSet resourceSet = DiagramPartitioningUtil.getSharedDomain().getResourceSet();
	Resource resource = resourceSet.getResource(uri, false);
	if (resource == null)
		resource = resourceSet.createResource(uri);
	try {
		resource.load(Collections.emptyMap());
	} catch (IOException e) {
		e.printStackTrace();
	}
	Diagram diagram = (Diagram) resource.getEObject(uri.fragment());
	return new DiagramEditorInput(diagram);
}
 
开发者ID:Yakindu,项目名称:statecharts,代码行数:19,代码来源:DiagramEditorInputFactory.java

示例11: getProjectStatechartInput

import org.eclipse.gmf.runtime.notation.Diagram; //导入依赖的package包/类
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;
}
 
开发者ID:Yakindu,项目名称:statecharts,代码行数:24,代码来源:DiagramPartitioningBreadcrumbViewer.java

示例12: doExecuteWithResult

import org.eclipse.gmf.runtime.notation.Diagram; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info)
		throws ExecutionException {
	BooleanValueStyle inlineStyle = DiagramPartitioningUtil.getInlineStyle(node);
	if (inlineStyle != null) {
		inlineStyle.setBooleanValue(false);
	} else {
		inlineStyle = DiagramPartitioningUtil.createInlineStyle();
		inlineStyle.setBooleanValue(false);
		node.getStyles().add(inlineStyle);
	}
	Diagram subdiagram = ViewService.createDiagram(node.getElement(), StatechartDiagramEditor.ID,
			DiagramActivator.DIAGRAM_PREFERENCES_HINT);
	node.eResource().getContents().add(subdiagram);
	return CommandResult.newOKCommandResult();
}
 
开发者ID:Yakindu,项目名称:statecharts,代码行数:18,代码来源:CreateSubdiagramCommand.java

示例13: addElementsToDiagram

import org.eclipse.gmf.runtime.notation.Diagram; //导入依赖的package包/类
@Override
protected void addElementsToDiagram(Diagram diagram, IProgressMonitor monitor) {
	Element container = diagramManager.getDiagramContainer(diagram);
	AbstractDiagramElementsManager diagramElementsManager;
	DiagramEditPart diagep = diagramManager.getActiveDiagramEditPart();
	if(diagram.getType().equals("PapyrusUMLClassDiagram")){					
		diagramElementsManager = new ClassDiagramElementsManager(diagep);
	}else if(diagram.getType().equals("PapyrusUMLActivityDiagram")){
		diagramElementsManager = new ActivityDiagramElementsManager(diagep);
	}else if(diagram.getType().equals("PapyrusUMLStateMachineDiagram")){
		diagramElementsManager = new StateMachineDiagramElementsManager(diagep);
	}else{
		return;
	}
	
	List<Element> baseElements = modelManager.getAllChildrenOfPackage(container);
	diagramElementsManager.addElementsToDiagram(baseElements);
}
 
开发者ID:ELTE-Soft,项目名称:txtUML,代码行数:19,代码来源:DefaultPapyrusModelManager.java

示例14: getAllSubDiagrams

import org.eclipse.gmf.runtime.notation.Diagram; //导入依赖的package包/类
protected Collection<? extends Diagram> getAllSubDiagrams(State semanticState) {
	List<Diagram> subDiagrams = new ArrayList<>();
	addSubDiagram(semanticState, subDiagrams);

	TreeIterator<EObject> iter = semanticState.eAllContents();
	while (iter.hasNext()) {
		EObject next = iter.next();
		if (next instanceof State) {
			State subState = (State) next;
			if (subState.isComposite()) {
				addSubDiagram(subState, subDiagrams);
			} else {
				iter.prune();
			}
		}
	}
	return subDiagrams;
}
 
开发者ID:Yakindu,项目名称:statecharts,代码行数:19,代码来源:SubdiagramAwareCopyCommand.java

示例15: getOverrideChildPasteOperation

import org.eclipse.gmf.runtime.notation.Diagram; //导入依赖的package包/类
/**
 * By default, don't provide any child paste override behaviour.
 * 
 * @return <code>null</code>, always
 */
public OverridePasteChildOperation getOverrideChildPasteOperation(
		PasteChildOperation overriddenChildPasteOperation) {
	if (shouldAllowPaste(overriddenChildPasteOperation)) {
		EObject eObject = overriddenChildPasteOperation.getEObject();
		if (eObject instanceof org.eclipse.gmf.runtime.notation.Node) {
			org.eclipse.gmf.runtime.notation.Node node = (org.eclipse.gmf.runtime.notation.Node) eObject;
			EObject element = node.getElement();
			if ((element != null)) {
				return new PositionalGeneralViewPasteOperation(overriddenChildPasteOperation, true);
			} else {
				return new PositionalGeneralViewPasteOperation(overriddenChildPasteOperation, false);
			}
		} else if (eObject instanceof Edge) {
			return new ConnectorViewPasteOperation(overriddenChildPasteOperation);
		} else if (eObject instanceof Diagram) {
			return new DiagramPasteOperation(overriddenChildPasteOperation);
		}
	}
	return null;
}
 
开发者ID:Yakindu,项目名称:statecharts,代码行数:26,代码来源:NotationClipboardOperationHelper.java


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