use of org.eclipse.draw2d.AncestorListener in project statecharts by Yakindu.
the class DirectEditManagerEx method hookListeners.
protected void hookListeners() {
ancestorListener = new AncestorListener.Stub() {
public void ancestorMoved(IFigure ancestor) {
placeCellEditor();
}
};
getEditPart().getFigure().addAncestorListener(ancestorListener);
Control control = getControl();
controlListener = new ControlAdapter() {
public void controlMoved(ControlEvent e) {
// This must be handled async because during scrolling, the
// CellEditor moves
// first, but then afterwards the viewport Scrolls, which would
// cause the
// shadow to move twice
Display.getCurrent().asyncExec(new Runnable() {
public void run() {
placeBorder();
}
});
}
public void controlResized(ControlEvent e) {
placeBorder();
}
};
control.addControlListener(controlListener);
cellEditorListener = new ICellEditorListener() {
public void applyEditorValue() {
commit();
}
public void cancelEditor() {
bringDown();
}
public void editorValueChanged(boolean old, boolean newState) {
handleValueChanged();
}
};
getCellEditor().addListener(cellEditorListener);
editPartListener = new EditPartListener.Stub() {
public void partDeactivated(EditPart editpart) {
bringDown();
}
};
getEditPart().addEditPartListener(editPartListener);
}
use of org.eclipse.draw2d.AncestorListener in project archi by archimatetool.
the class DirectEditManager method hookListeners.
protected void hookListeners() {
ancestorListener = new AncestorListener.Stub() {
@Override
public void ancestorMoved(IFigure ancestor) {
placeCellEditor();
}
};
getEditPart().getFigure().addAncestorListener(ancestorListener);
Control control = getControl();
controlListener = new ControlAdapter() {
@Override
public void controlMoved(ControlEvent e) {
// This must be handled async because during scrolling, the
// CellEditor moves
// first, but then afterwards the viewport Scrolls, which would
// cause the
// shadow to move twice
Display.getCurrent().asyncExec(new Runnable() {
@Override
public void run() {
placeCellEditorFrame();
}
});
}
@Override
public void controlResized(ControlEvent e) {
placeCellEditorFrame();
}
};
control.addControlListener(controlListener);
cellEditorListener = new ICellEditorListener() {
@Override
public void applyEditorValue() {
commit();
}
@Override
public void cancelEditor() {
bringDown();
}
@Override
public void editorValueChanged(boolean old, boolean newState) {
handleValueChanged();
}
};
getCellEditor().addListener(cellEditorListener);
editPartListener = new EditPartListener.Stub() {
@Override
public void partDeactivated(EditPart editpart) {
bringDown();
}
};
getEditPart().addEditPartListener(editPartListener);
}
Aggregations