本文整理汇总了Java中org.eclipse.gef.EditPart.refresh方法的典型用法代码示例。如果您正苦于以下问题:Java EditPart.refresh方法的具体用法?Java EditPart.refresh怎么用?Java EditPart.refresh使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.gef.EditPart
的用法示例。
在下文中一共展示了EditPart.refresh方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: deepRefresh
import org.eclipse.gef.EditPart; //导入方法依赖的package包/类
/**
* Refresh {@link EditPart} in depth.
*/
private void deepRefresh() {
refresh();
for (Branch branch : getModelChildren()) {
final EditPart branchEditPart = (EditPart)getViewer().getEditPartRegistry().get(branch);
branchEditPart.refresh();
for (Choice choice : branch.getChoices()) {
final EditPart choiceEditPart = (EditPart)getViewer().getEditPartRegistry().get(choice);
choiceEditPart.refresh();
for (PossibleStep possibleStep : choice.getPossibleSteps()) {
final EditPart possibleStepEditPart = (EditPart)getViewer().getEditPartRegistry().get(
possibleStep);
possibleStepEditPart.refresh();
}
}
}
}
示例2: createImage
import org.eclipse.gef.EditPart; //导入方法依赖的package包/类
public static ImageInfo createImage(final GraphicalViewer viewer, final int format, final String path) {
GC figureCanvasGC = null;
GC imageGC = null;
try {
final ScalableFreeformRootEditPart rootEditPart = (ScalableFreeformRootEditPart) viewer.getRootEditPart();
rootEditPart.refresh();
final IFigure rootFigure = ((LayerManager) rootEditPart).getLayer(LayerConstants.PRINTABLE_LAYERS);
final EditPart editPart = viewer.getContents();
editPart.refresh();
final ERDiagram diagram = (ERDiagram) editPart.getModel();
final Rectangle rootFigureBounds = getBounds(diagram, rootEditPart, rootFigure.getBounds());
final Control figureCanvas = viewer.getControl();
figureCanvasGC = new GC(figureCanvas);
final Image img = new Image(Display.getCurrent(), rootFigureBounds.width + 20, rootFigureBounds.height + 20);
imageGC = new GC(img);
imageGC.setBackground(figureCanvasGC.getBackground());
imageGC.setForeground(figureCanvasGC.getForeground());
imageGC.setFont(figureCanvasGC.getFont());
imageGC.setLineStyle(figureCanvasGC.getLineStyle());
imageGC.setLineWidth(figureCanvasGC.getLineWidth());
imageGC.setAntialias(SWT.OFF);
// imageGC.setInterpolation(SWT.HIGH);
final Graphics imgGraphics = new SWTGraphics(imageGC);
imgGraphics.setBackgroundColor(figureCanvas.getBackground());
imgGraphics.fillRectangle(0, 0, rootFigureBounds.width + 20, rootFigureBounds.height + 20);
final int translateX = translateX(rootFigureBounds.x);
final int translateY = translateY(rootFigureBounds.y);
imgGraphics.translate(translateX, translateY);
rootFigure.paint(imgGraphics);
final Map<TableView, Location> tableLoacationMap = getTableLocationMap(rootEditPart, translateX, translateY, diagram);
final ImageInfo imageInfo = new ImageInfo(img, tableLoacationMap);
imageInfo.setFormat(format);
imageInfo.setPath(path);
return imageInfo;
} finally {
if (figureCanvasGC != null) {
figureCanvasGC.dispose();
}
if (imageGC != null) {
imageGC.dispose();
}
}
}
示例3: createImage
import org.eclipse.gef.EditPart; //导入方法依赖的package包/类
public static ImageInfo createImage(GraphicalViewer viewer, int format,
String path) {
GC figureCanvasGC = null;
GC imageGC = null;
try {
ScalableFreeformRootEditPart rootEditPart = (ScalableFreeformRootEditPart) viewer
.getRootEditPart();
rootEditPart.refresh();
IFigure rootFigure = ((LayerManager) rootEditPart)
.getLayer(LayerConstants.PRINTABLE_LAYERS);
EditPart editPart = viewer.getContents();
editPart.refresh();
ERDiagram diagram = (ERDiagram) editPart.getModel();
Rectangle rootFigureBounds = getBounds(diagram, rootEditPart,
rootFigure.getBounds());
Control figureCanvas = viewer.getControl();
figureCanvasGC = new GC(figureCanvas);
Image img = new Image(Display.getCurrent(),
rootFigureBounds.width + 20, rootFigureBounds.height + 20);
imageGC = new GC(img);
imageGC.setBackground(figureCanvasGC.getBackground());
imageGC.setForeground(figureCanvasGC.getForeground());
imageGC.setFont(figureCanvasGC.getFont());
imageGC.setLineStyle(figureCanvasGC.getLineStyle());
imageGC.setLineWidth(figureCanvasGC.getLineWidth());
imageGC.setAntialias(SWT.OFF);
// imageGC.setInterpolation(SWT.HIGH);
Graphics imgGraphics = new SWTGraphics(imageGC);
imgGraphics.setBackgroundColor(figureCanvas.getBackground());
imgGraphics.fillRectangle(0, 0, rootFigureBounds.width + 20,
rootFigureBounds.height + 20);
int translateX = translateX(rootFigureBounds.x);
int translateY = translateY(rootFigureBounds.y);
imgGraphics.translate(translateX, translateY);
rootFigure.paint(imgGraphics);
Map<TableView, Location> tableLoacationMap = getTableLocationMap(
rootEditPart, translateX, translateY, diagram);
ImageInfo imageInfo = new ImageInfo(img, tableLoacationMap);
imageInfo.setFormat(format);
imageInfo.setPath(path);
return imageInfo;
} finally {
if (figureCanvasGC != null) {
figureCanvasGC.dispose();
}
if (imageGC != null) {
imageGC.dispose();
}
}
}