一些问题

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

 

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

<extension point="org.eclipse.emf.ecore.extension_parser" id="resource-factory">
       <?gmfgen generated="true"?>
       <parser
          type="your extension"
            >>class="org.eclipse.gmf.runtime.emf.core.resources.GMFResourceFactory">
       </parser>
    </extension>

....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...

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值