use of org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager in project statecharts by Yakindu.
the class ExternalXtextLabelEditPart method performDirectEditRequest.
@Override
protected void performDirectEditRequest(final Request request) {
final DirectEditManager manager = createDirectEditManager();
final Request theRequest = request;
try {
getEditingDomain().runExclusive(new Runnable() {
public void run() {
if (isActive()) {
if (theRequest.getExtendedData().get(REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
final Character initialChar = (Character) theRequest.getExtendedData().get(REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
if (manager instanceof XtextDirectEditManager) {
XtextDirectEditManager xtextDirectEditManager = (XtextDirectEditManager) manager;
xtextDirectEditManager.show(initialChar);
} else if (manager instanceof TextDirectEditManager) {
((TextDirectEditManager) manager).show(initialChar);
}
} else {
manager.show();
}
if (manager instanceof XtextDirectEditManager) {
XtextDirectEditManager xtextDirectEditManager = (XtextDirectEditManager) manager;
XtextStyledTextCellEditor cellEditor = (XtextStyledTextCellEditor) xtextDirectEditManager.getCellEditor();
setContext(cellEditor.getXtextAdapter().getFakeResourceContext().getFakeResource());
}
}
}
});
} catch (final InterruptedException e) {
e.printStackTrace();
}
}
use of org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager in project statecharts by Yakindu.
the class XtextLabelEditPart method performDirectEditRequest.
@Override
public void performDirectEditRequest(final Request request) {
final DirectEditManager manager = createDirectEditManager();
final Request theRequest = request;
try {
getEditingDomain().runExclusive(new Runnable() {
public void run() {
if (isActive()) {
if (theRequest.getExtendedData().get(REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
final Character initialChar = (Character) theRequest.getExtendedData().get(REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
if (manager instanceof XtextDirectEditManager) {
XtextDirectEditManager xtextDirectEditManager = (XtextDirectEditManager) manager;
xtextDirectEditManager.show(initialChar);
} else if (manager instanceof TextDirectEditManager) {
((TextDirectEditManager) manager).show(initialChar);
}
} else {
manager.show();
}
if (manager instanceof XtextDirectEditManager) {
XtextDirectEditManager xtextDirectEditManager = (XtextDirectEditManager) manager;
XtextStyledTextCellEditor cellEditor = (XtextStyledTextCellEditor) xtextDirectEditManager.getCellEditor();
setContext(cellEditor.getXtextAdapter().getFakeResourceContext().getFakeResource());
}
}
}
});
} catch (final InterruptedException e) {
e.printStackTrace();
}
}
Aggregations