현재 Zest를 사용하여 트리를 표시하는 eclipse 용 플러그인을 개발 중입니다.Zest 그래프에 MouseListener 추가
두 번 누르기 기능을 추가하려고 했으므로 노드를 표시하는 그림에 사용자 정의 MouseListener
을 추가하려고 시도했지만 노드를 드래그 할 수있는 자연스럽게 나타나는 기능을 무시합니다.
드래그를 위해 Draw2D 기반 기능을 추가하려했지만 작동하지 않았습니다. 시도한 코드는 다음과 같습니다.
private Point location;
public void mousePressed(MouseEvent me) {
location = me.getLocation();
me.consume();
}
public void mouseReleased(MouseEvent me) {
location = null;
me.consume();
}
public void mouseDragged(MouseEvent me) {
if (location == null) {
return;
}
Point moved= me.getLocation();
if (moved == null) {
return;
}
Dimension offset= moved.getDifference(location);
if (offset.width == 0 && offset.height == 0) {
return;
}
location= moved;
UpdateManager uMgr= figure.getUpdateManager();
LayoutManager lMgr= figure.getLayoutManager();
Rectangle bounds= figure.getBounds();
uMgr.addDirtyRegion(figure.getParent(), bounds);
bounds= bounds.getCopy().translate(offset.width, offset.height);
lMgr.setConstraint(figure, bounds);
figure.translate(offset.width, offset.height);
uMgr.addDirtyRegion(figure.getParent(), bounds);
me.consume();
}
누구든지 내 코드 또는 해결 방법에 대한 해결책을 제공 할 수 있습니까?