本文整理汇总了Java中org.eclipse.gef.editparts.ScalableFreeformRootEditPart类的典型用法代码示例。如果您正苦于以下问题:Java ScalableFreeformRootEditPart类的具体用法?Java ScalableFreeformRootEditPart怎么用?Java ScalableFreeformRootEditPart使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ScalableFreeformRootEditPart类属于org.eclipse.gef.editparts包,在下文中一共展示了ScalableFreeformRootEditPart类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initializeGraphicalViewer
import org.eclipse.gef.editparts.ScalableFreeformRootEditPart; //导入依赖的package包/类
@Override
protected void initializeGraphicalViewer() {
super.initializeGraphicalViewer();
getGraphicalViewer().setRootEditPart(new ScalableFreeformRootEditPart());
FileEditorInput inp = (FileEditorInput) getEditorInput();
setPartName(inp.getFile().getName());
try {
String path = inp.getFile().getLocation().toOSString();
String text = FileUtils.readFileToString(new File(path));
CompositeNode node = parse(text);
root = new CompositeEditPart(node, inp.getFile().getProject().getFullPath().toOSString());
getGraphicalViewer().setContents(root);
} catch (IOException e) {
e.printStackTrace();
}
}
示例2: initializeGraphicalViewer
import org.eclipse.gef.editparts.ScalableFreeformRootEditPart; //导入依赖的package包/类
@Override
protected void initializeGraphicalViewer() {
super.initializeGraphicalViewer();
getGraphicalViewer().setRootEditPart(new ScalableFreeformRootEditPart());
FileEditorInput inp = (FileEditorInput) getEditorInput();
setPartName(inp.getFile().getName());
try {
String path = inp.getFile().getLocation().toOSString();
String text = FileUtils.readFileToString(new File(path));
LogicalSystemNode node = parse(text);
root = new LogicalSystemEditPart(node, inp.getFile().getProject().getFullPath().toOSString());
getGraphicalViewer().setContents(root);
} catch (IOException e) {
e.printStackTrace();
}
}
示例3: initializeGraphicalViewer
import org.eclipse.gef.editparts.ScalableFreeformRootEditPart; //导入依赖的package包/类
@Override
public void initializeGraphicalViewer() {
super.initializeGraphicalViewer();
getGraphicalViewer().setRootEditPart(new ScalableFreeformRootEditPart());
FileEditorInput inp = (FileEditorInput) getEditorInput();
setPartName(inp.getFile().getName());
try {
String path = inp.getFile().getLocation().toOSString();
String text = FileUtils.readFileToString(new File(path));
CompositeNode node = parse(text);
root = new CompositeEditPart(node, inp.getFile().getProject().getFullPath().toOSString());
getGraphicalViewer().setContents(root);
} catch (IOException e) {
e.printStackTrace();
}
}
示例4: initializeGraphicalViewer
import org.eclipse.gef.editparts.ScalableFreeformRootEditPart; //导入依赖的package包/类
@Override
public void initializeGraphicalViewer() {
super.initializeGraphicalViewer();
getGraphicalViewer().setRootEditPart(new ScalableFreeformRootEditPart());
FileEditorInput inp = (FileEditorInput) getEditorInput();
setPartName(inp.getFile().getName());
try {
String path = inp.getFile().getLocation().toOSString();
String text = FileUtils.readFileToString(new File(path));
DeploymentNode node = parse(text);
root = new DeploymentEditPart(node, inp.getFile().getProject().getFullPath().toOSString());
getGraphicalViewer().setContents(root);
} catch (IOException e) {
e.printStackTrace();
}
}
示例5: initializeGraphicalViewer
import org.eclipse.gef.editparts.ScalableFreeformRootEditPart; //导入依赖的package包/类
@Override
public void initializeGraphicalViewer() {
super.initializeGraphicalViewer();
getGraphicalViewer().setRootEditPart(new ScalableFreeformRootEditPart());
FileEditorInput inp = (FileEditorInput) getEditorInput();
setPartName(inp.getFile().getName());
try {
String path = inp.getFile().getLocation().toOSString();
String text = FileUtils.readFileToString(new File(path));
ComponentImplementationNode node = parse(text);
root = new ComponentImplementationEditPart(node, inp.getFile().getProject().getFullPath().toOSString());
getGraphicalViewer().setContents(root);
} catch (IOException e) {
e.printStackTrace();
}
}
示例6: getColumnIndex
import org.eclipse.gef.editparts.ScalableFreeformRootEditPart; //导入依赖的package包/类
private int getColumnIndex(final DirectEditRequest editRequest) {
final ZoomManager zoomManager = ((ScalableFreeformRootEditPart) getHost().getRoot()).getZoomManager();
final double zoom = zoomManager.getZoom();
final ColumnEditPart columnEditPart = (ColumnEditPart) getHost();
Column column = (Column) columnEditPart.getModel();
final TableView newTableView = (TableView) getHost().getParent().getModel();
final List<Column> columns = newTableView.getColumns();
if (column.getColumnHolder() instanceof ColumnGroup) {
column = (ColumnGroup) column.getColumnHolder();
}
int index = columns.indexOf(column);
final Rectangle columnRectangle = getColumnRectangle();
final int center = (int) ((columnRectangle.y + (columnRectangle.height / 2)) * zoom);
if (editRequest.getLocation().y >= center) {
index++;
}
return index;
}
示例7: getTableLocationMap
import org.eclipse.gef.editparts.ScalableFreeformRootEditPart; //导入依赖的package包/类
private static Map<TableView, Location> getTableLocationMap(final ScalableFreeformRootEditPart rootEditPart, final int translateX, final int translateY, final ERDiagram diagram) {
final Map<TableView, Location> tableLocationMap = new HashMap<TableView, Location>();
final Category category = diagram.getCurrentCategory();
for (final Object child : rootEditPart.getContents().getChildren()) {
final NodeElementEditPart editPart = (NodeElementEditPart) child;
final NodeElement nodeElement = (NodeElement) editPart.getModel();
if (!(nodeElement instanceof TableView)) {
continue;
}
if (category == null || category.isVisible(nodeElement, diagram)) {
final IFigure figure = editPart.getFigure();
final Rectangle figureRectangle = figure.getBounds();
final Location location = new Location(figureRectangle.x + translateX, figureRectangle.y + translateY, figureRectangle.width, figureRectangle.height);
tableLocationMap.put((TableView) nodeElement, location);
}
}
return tableLocationMap;
}
示例8: showThumbnail
import org.eclipse.gef.editparts.ScalableFreeformRootEditPart; //导入依赖的package包/类
private void showThumbnail() {
// RootEditPartのビューをソースとしてサムネイルを作成
ScalableFreeformRootEditPart editPart = (ScalableFreeformRootEditPart) this.graphicalViewer
.getRootEditPart();
if (this.thumbnail != null) {
this.thumbnail.deactivate();
}
this.thumbnail = new ScrollableThumbnail((Viewport) editPart
.getFigure());
this.thumbnail.setSource(editPart
.getLayer(LayerConstants.PRINTABLE_LAYERS));
this.lws.setContents(this.thumbnail);
}
示例9: getColumnIndex
import org.eclipse.gef.editparts.ScalableFreeformRootEditPart; //导入依赖的package包/类
private int getColumnIndex(DirectEditRequest editRequest) {
ZoomManager zoomManager = ((ScalableFreeformRootEditPart) this
.getHost().getRoot()).getZoomManager();
double zoom = zoomManager.getZoom();
IFigure figure = ((TableViewEditPart) this.getHost()).getFigure();
int center = (int) (figure.getBounds().y + (figure.getBounds().height / 2)
* zoom);
int index = 0;
if (editRequest.getLocation().y >= center) {
TableView newTableView = (TableView) this.getHost().getModel();
index = newTableView.getColumns().size();
}
return index;
}
示例10: showSizeOnDropFeedback
import org.eclipse.gef.editparts.ScalableFreeformRootEditPart; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
protected void showSizeOnDropFeedback(CreateRequest request) {
Point p = new Point(request.getLocation().getCopy());
ZoomManager zoomManager = ((ScalableFreeformRootEditPart) this
.getHost().getRoot()).getZoomManager();
double zoom = zoomManager.getZoom();
IFigure feedback = getSizeOnDropFeedback(request);
Dimension size = request.getSize().getCopy();
feedback.translateToRelative(size);
feedback.setBounds(new Rectangle((int) (p.x * zoom),
(int) (p.y * zoom), size.width, size.height)
.expand(getCreationFeedbackOffset(request)));
}
示例11: initializeOverview
import org.eclipse.gef.editparts.ScalableFreeformRootEditPart; //导入依赖的package包/类
/**
* Initialize overview.
*/
protected void initializeOverview() {
LightweightSystem lws = new J2DLightweightSystem(overview);
RootEditPart rep = editor.getGraphicalViewer().getRootEditPart();
if (rep instanceof MainDesignerRootEditPart) {
ScalableFreeformRootEditPart root = (ScalableFreeformRootEditPart) rep;
thumbnail = new JSSScrollableThumbnail((Viewport) root.getFigure(), (MRoot)getViewer().getContents().getModel());
thumbnail.setSource(root.getLayer(LayerConstants.PRINTABLE_LAYERS));
lws.setContents(thumbnail);
disposeListener = new DisposeListener() {
public void widgetDisposed(DisposeEvent e) {
if (thumbnail != null) {
thumbnail.deactivate();
thumbnail = null;
}
}
};
editor.getEditor().addDisposeListener(disposeListener);
}
lws.setControl(overview);
}
示例12: getAdapter
import org.eclipse.gef.editparts.ScalableFreeformRootEditPart; //导入依赖的package包/类
@Override
public Object getAdapter(@SuppressWarnings("rawtypes") Class type) {
if (type == ZoomManager.class) {
return ((ScalableFreeformRootEditPart) getGraphicalViewer().getRootEditPart()).getZoomManager();
}
if (type == IContentOutlinePage.class) {
return outlinePage;
}
if (type == IGotoMarker.class) {
return gotoMaker;
}
if (type == IPropertySheetPage.class) {
return propertySheetPage;
}
return super.getAdapter(type);
}
示例13: getColumnIndex
import org.eclipse.gef.editparts.ScalableFreeformRootEditPart; //导入依赖的package包/类
private int getColumnIndex(DirectEditRequest editRequest) {
final ZoomManager zoomManager = ((ScalableFreeformRootEditPart) getHost().getRoot()).getZoomManager();
final double zoom = zoomManager.getZoom();
final ColumnEditPart columnEditPart = (ColumnEditPart) getHost();
ERColumn column = (ERColumn) columnEditPart.getModel();
final TableView newTableView = (TableView) getHost().getParent().getModel();
final List<ERColumn> columns = newTableView.getColumns();
if (column.getColumnHolder() instanceof ColumnGroup) {
column = (ColumnGroup) column.getColumnHolder();
}
int index = columns.indexOf(column);
final Rectangle columnRectangle = getColumnRectangle();
final int center = (int) ((columnRectangle.y + (columnRectangle.height / 2)) * zoom);
if (editRequest.getLocation().y >= center) {
index++;
}
return index;
}
示例14: initializeOverview
import org.eclipse.gef.editparts.ScalableFreeformRootEditPart; //导入依赖的package包/类
protected void initializeOverview()
{
LightweightSystem lws = new LightweightSystem(mOverview);
RootEditPart rep = getGraphicalViewer().getRootEditPart();
if (rep instanceof ScalableFreeformRootEditPart) {
ScalableFreeformRootEditPart root = (ScalableFreeformRootEditPart)rep;
mThumbnail = new ScrollableThumbnail((Viewport)root.getFigure());
mThumbnail.setBorder(new MarginBorder(3));
mThumbnail.setSource(root
.getLayer(LayerConstants.PRINTABLE_LAYERS));
lws.setContents(mThumbnail);
mDisposeListener = new DisposeListener() {
public void widgetDisposed(DisposeEvent e)
{
if (mThumbnail != null) {
mThumbnail.deactivate();
mThumbnail = null;
}
}
};
getEditor().addDisposeListener(mDisposeListener);
}
}
示例15: configureGraphicalViewer
import org.eclipse.gef.editparts.ScalableFreeformRootEditPart; //导入依赖的package包/类
@Override
protected void configureGraphicalViewer() {
super.configureGraphicalViewer();
GraphicalViewer viewer = getGraphicalViewer();
viewer.setRootEditPart(new ScalableFreeformRootEditPart());
viewer.setEditPartFactory(new FormDesignerEditPartFactory(this));
ContextMenuProvider provider = new FormContextMenuProvider(viewer,
actionIds, getActionRegistry());
viewer.setContextMenu(provider);
viewer.setKeyHandler(new GraphicalViewerKeyHandler(viewer));
((FigureCanvas) viewer.getControl())
.setScrollBarVisibility(FigureCanvas.ALWAYS);
}