Search in sources :

Example 1 with AddOrEditNontransElementDialog

use of net.heartsome.cat.ts.ui.qa.dialogs.AddOrEditNontransElementDialog in project translationstudio8 by heartsome.

the class NonTranslationQAPage method addNonTransElement.

/**
	 * 添加非译元素
	 */
public void addNonTransElement() {
    NontransElementBean bean = new NontransElementBean();
    AddOrEditNontransElementDialog dialog = new AddOrEditNontransElementDialog(getShell(), true, tableViewer, bean);
    int result = dialog.open();
    if (result == IDialogConstants.OK_ID) {
        // 先添加到listViewer中
        dataList.add(bean);
        tableViewer.refresh();
        tableViewer.setSelection(new StructuredSelection(bean));
    }
}
Also used : NontransElementBean(net.heartsome.cat.ts.ui.qa.model.NontransElementBean) AddOrEditNontransElementDialog(net.heartsome.cat.ts.ui.qa.dialogs.AddOrEditNontransElementDialog) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) Point(org.eclipse.swt.graphics.Point)

Example 2 with AddOrEditNontransElementDialog

use of net.heartsome.cat.ts.ui.qa.dialogs.AddOrEditNontransElementDialog in project translationstudio8 by heartsome.

the class NonTranslationQAPage method editNontransElement.

/**
	 * 编辑非译元素
	 */
private void editNontransElement() {
    NontransElementBean bean = null;
    ISelection selection = tableViewer.getSelection();
    if (selection != null && !selection.isEmpty() && selection instanceof IStructuredSelection) {
        IStructuredSelection structuredSelection = (IStructuredSelection) selection;
        if (structuredSelection.getFirstElement() instanceof NontransElementBean) {
            bean = (NontransElementBean) structuredSelection.getFirstElement();
            if (validIsInternalElementNonTip(bean)) {
                return;
            }
            AddOrEditNontransElementDialog dialog = new AddOrEditNontransElementDialog(getShell(), false, tableViewer, bean);
            int result = dialog.open();
            if (result == IDialogConstants.OK_ID) {
                tableViewer.refresh();
            }
        }
    }
}
Also used : NontransElementBean(net.heartsome.cat.ts.ui.qa.model.NontransElementBean) AddOrEditNontransElementDialog(net.heartsome.cat.ts.ui.qa.dialogs.AddOrEditNontransElementDialog) ISelection(org.eclipse.jface.viewers.ISelection) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) Point(org.eclipse.swt.graphics.Point)

Aggregations

AddOrEditNontransElementDialog (net.heartsome.cat.ts.ui.qa.dialogs.AddOrEditNontransElementDialog)2 NontransElementBean (net.heartsome.cat.ts.ui.qa.model.NontransElementBean)2 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)2 Point (org.eclipse.swt.graphics.Point)2 ISelection (org.eclipse.jface.viewers.ISelection)1 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)1