Search in sources :

Example 1 with EditableManager

use of net.heartsome.cat.ts.ui.xliffeditor.nattable.celleditor.EditableManager in project translationstudio8 by heartsome.

the class ChangeSourceEditableHandler method execute.

public Object execute(ExecutionEvent event) throws ExecutionException {
    IEditorPart editor = HandlerUtil.getActiveEditor(event);
    if (editor != null && editor instanceof XLIFFEditorImplWithNatTable) {
        XLIFFEditorImplWithNatTable xliffEditor = (XLIFFEditorImplWithNatTable) editor;
        ICellEditor cellEditor = xliffEditor.getTable().getConfigRegistry().getConfigAttribute(EditConfigAttributes.CELL_EDITOR, DisplayMode.EDIT, XLIFFEditorImplWithNatTable.SOURCE_EDIT_CELL_LABEL);
        if (cellEditor == null || !(cellEditor instanceof StyledTextCellEditor)) {
            return null;
        }
        HsMultiActiveCellEditor.commit(false);
        StyledTextCellEditor sce = (StyledTextCellEditor) cellEditor;
        EditableManager editableManager = sce.getEditableManager();
        //			SourceEditMode nextMode = editableManager.getSourceEditMode().getNextMode();
        SourceEditMode nextMode = getSourceEditMode(editableManager);
        editableManager.setSourceEditMode(nextMode);
        //			element.setIcon(Activator.getImageDescriptor(nextMode.getImagePath()));
        if (!sce.isClosed()) {
            editableManager.judgeEditable();
            //				更新全局 Action 的可用状态,主要是更新编辑-删除功能的可用状态。
            sce.getActionHandler().updateActionsEnableState();
        }
        sce.addClosingListener(listener);
    }
    return null;
}
Also used : XLIFFEditorImplWithNatTable(net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable) SourceEditMode(net.heartsome.cat.ts.ui.xliffeditor.nattable.celleditor.SourceEditMode) EditableManager(net.heartsome.cat.ts.ui.xliffeditor.nattable.celleditor.EditableManager) ICellEditor(net.sourceforge.nattable.edit.editor.ICellEditor) IEditorPart(org.eclipse.ui.IEditorPart) StyledTextCellEditor(net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.StyledTextCellEditor)

Aggregations

EditableManager (net.heartsome.cat.ts.ui.xliffeditor.nattable.celleditor.EditableManager)1 SourceEditMode (net.heartsome.cat.ts.ui.xliffeditor.nattable.celleditor.SourceEditMode)1 StyledTextCellEditor (net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.StyledTextCellEditor)1 XLIFFEditorImplWithNatTable (net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable)1 ICellEditor (net.sourceforge.nattable.edit.editor.ICellEditor)1 IEditorPart (org.eclipse.ui.IEditorPart)1