1. 云栖社区>
  2. PHP教程>
  3. 正文

一些问题

作者:用户 来源:互联网 时间:2017-12-01 11:36:09

问题一些

一些问题 - 摘要: 本文讲的是一些问题, 下面都是从新闻组看到的一些东西,留作以后查看   1.could not creat link Ok. If"true"is returned from XXXCreateCommand.canExecute() then you can


下面都是从新闻组看到的一些东西,留作以后查看


 


1.could not creat link


Ok. If"true"is returned from XXXCreateCommand.canExecute() then you can try placing a breakpont into XXXViewProvider.createEdge()(in past this method was called"getEdgeViewClass()) operation - this method will be called as a second part of link creation and can be another reason preventing you from second link creation.


 


(also XXXItemSemanticEditPolicy.getCreateRelationshipCommand())


If you have several links with same underlying domain model meta-element then you have to add some (OCL) constraints to make it possible for GMF to destinguish between these links.


 


 


2.How can I make static picture on canvas like the compass in taipan
editor?


It was done by writing custom code - check AquatoryEditPart.createFigure().


 


3.drawback of providers structure


Try raising priorities of View/EditPart providers registered in a plugin.xml generated by GMF for your diagram - this is a drawback of providers structure - anybody can easily break your diagram by itroducing their own provider.. In near future we are going to generate provider-based implementation only in situations then it is necessary.


 


 


4.GMF Editor without FileInput
This could help?
In your DiagramEditor, the method below opens the editor with new EditorInput, you could change it here.
// in Diagram Editor
public static boolean openDiagram(Resource diagram)
throws PartInitException {
IWorkbenchPage page = PlatformUI.getWorkbench()
.getActiveWorkbenchWindow().getActivePage();
 >> page.openEditor(new URIEditorInput(diagram.getURI()),
YourDiagramEditor.ID);
return true;
}
.....and make sure the DocumentProvider can handle your new Editor input.
// In Document provider
protected ElementInfo createElementInfo(Object element)
throws CoreException {
if (false == element instanceof URIEditorInput) {
...
}
IEditorInput editorInput = (IEditorInput) element;
IDiagramDocument document = (IDiagramDocument) createDocument(editorInput);
ResourceSetInfo info = new ResourceSetInfo(document, editorInput);
...
}
.... also here you need to hackin to set your content properly, you might
need your version of DiagramDocument
protected void setDocumentContent(IDocument document, IEditorInput element)
throws CoreException {
IDiagramDocument diagramDocument = (IDiagramDocument) document;
TransactionalEditingDomain domain = diagramDocument.getEditingDomain();
......
EObject rootElement = resource.getEObject(uri.fragment());
if (rootElement instanceof Diagram) {
document.setContent((Diagram) rootElement);
return;
}
......
.... Of course the Resource if by default an EMF Resource with certain characteristics. (Like XMI serialization), you could change this by
creating a ResourceFactory and tigh this factory to an extension or protocol.
//plugin.xml

       <?gmfgen generated="true"?>
                 type="your extension"
            >>class="org.eclipse.gmf.runtime.emf.core.resources.GMFResourceFactory">
      
   
....Your factory my need a custom Resource used by the document provider to set the content.


 


 


dnd


http://www.eclipse.org/newsportal/article.php?id=16299&group=eclipse.modeling.gmf#16299


 


 


to be continued...

以上是云栖社区小编为您精心准备的的内容,在云栖社区的博客、问答、公众号、人物、课程等栏目也有的相关内容,欢迎继续使用右上角搜索按钮进行搜索问题 一些 ,以便于您获取更多的相关知识。