本文整理汇总了Java中org.eclipse.gmf.runtime.notation.Diagram.getElement方法的典型用法代码示例。如果您正苦于以下问题:Java Diagram.getElement方法的具体用法?Java Diagram.getElement怎么用?Java Diagram.getElement使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.gmf.runtime.notation.Diagram
的用法示例。
在下文中一共展示了Diagram.getElement方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
示例2: getDiagramContainerHierachy
import org.eclipse.gmf.runtime.notation.Diagram; //导入方法依赖的package包/类
public static List<Diagram> getDiagramContainerHierachy(Diagram diagram) {
Assert.isNotNull(diagram);
List<Diagram> result = new ArrayList<Diagram>();
result.add(diagram);
while (diagram.getElement() instanceof State) {
diagram = DiagramPartitioningUtil.getDiagramContaining((State) diagram.getElement());
result.add(diagram);
}
Collections.reverse(result);
return result;
}
示例3: getSubDiagramHierachy
import org.eclipse.gmf.runtime.notation.Diagram; //导入方法依赖的package包/类
public static List<Diagram> getSubDiagramHierachy(Diagram diagram) {
Assert.isNotNull(diagram);
List<Diagram> result = new ArrayList<Diagram>();
result.add(diagram);
while (diagram.getElement() instanceof State) {
diagram = DiagramPartitioningUtil.getSubDiagram((CompositeElement) diagram.getElement());
result.add(diagram);
}
Collections.reverse(result);
return result;
}
示例4: createDiagramViewer
import org.eclipse.gmf.runtime.notation.Diagram; //导入方法依赖的package包/类
protected TreeViewer createDiagramViewer(final Composite composite, Diagram diagram) {
TreeViewer viewer = new TreeViewer(composite);
viewer.setLabelProvider(new AdapterFactoryLabelProvider(new SGraphItemProviderAdapterFactory()));
viewer.setContentProvider(new AdapterFactoryContentProvider(new BreadcrumbItemProviderAdapterFactory()));
EObject element = diagram.getElement();
viewer.setInput(element);
viewer.addSelectionChangedListener(this);
return viewer;
}
示例5: initializeTitle
import org.eclipse.gmf.runtime.notation.Diagram; //导入方法依赖的package包/类
protected void initializeTitle(Diagram diagram) {
EObject element = diagram.getElement();
AdapterFactoryLabelProvider labelProvider = new AdapterFactoryLabelProvider(
new SGraphItemProviderAdapterFactory());
setTitleImage(labelProvider.getImage(element));
setPartName(labelProvider.getText(element));
}
示例6: updateLabel
import org.eclipse.gmf.runtime.notation.Diagram; //导入方法依赖的package包/类
public void updateLabel(ViewerLabel label, TreePath elementPath) {
Diagram lastSegment = (Diagram) elementPath.getLastSegment();
NamedElement element = (NamedElement) lastSegment.getElement();
AdapterFactoryLabelProvider provider = new AdapterFactoryLabelProvider(
new SGraphItemProviderAdapterFactory());
label.setText(provider.getText(element));
if (element instanceof Statechart)
label.setImage(StatechartImages.LOGO.image());
else
label.setImage(provider.getImage(element));
}
示例7: getDiagramContainer
import org.eclipse.gmf.runtime.notation.Diagram; //导入方法依赖的package包/类
/**
* Gets the {@link Element} that is the container of the diagram
* @param diagram - The Diagram
* @return Container of the diagram
*/
public Element getDiagramContainer(Diagram diagram){
return (Element) diagram.getElement();
}