use of org.eclipse.jface.viewers.ISelection in project translationstudio8 by heartsome.
the class SrxConfigurationDialog method initListener.
/**
* 给增删改三个按钮提示添加事件 ;
*/
private void initListener() {
addBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
CreateOrUpdataSRXDialog createDialog = new CreateOrUpdataSRXDialog(getShell(), true);
int createResult = createDialog.open();
if (IDialogConstants.OK_ID == createResult) {
String addedSrxName = createDialog.getCurSrxName();
// 添加完成该文件后,解析该文件
boolean openResult = openSrx(ADConstants.configLocation + ADConstants.AD_SRXConfigFolder + File.separator + addedSrxName);
if (!openResult) {
return;
}
AddOrEditSrxConfigDialog addDialog = new AddOrEditSrxConfigDialog(getShell(), addedSrxName, handler);
addDialog.open();
refreshTable(addedSrxName);
}
}
});
editBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
editSrx();
}
});
deleteBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
ISelection selection = tableViewer.getSelection();
if (!selection.isEmpty() && selection != null && selection instanceof StructuredSelection) {
boolean response = MessageDialog.openConfirm(getShell(), Messages.getString("srx.SrxConfigurationDialog.msgTitle1"), Messages.getString("srx.SrxConfigurationDialog.msg1"));
if (!response) {
return;
}
StructuredSelection structSelection = (StructuredSelection) selection;
@SuppressWarnings("unchecked") Iterator<String[]> it = structSelection.iterator();
File deleteSrx;
boolean isTiped = false;
while (it.hasNext()) {
String srxName = it.next()[1];
if (isSystemSrx(srxName)) {
if (!isTiped) {
MessageDialog.openInformation(getShell(), Messages.getString("dialogs.CatalogManagerDialog.msgTitle2"), Messages.getString("srx.SrxConfigurationDialog.msg4"));
isTiped = true;
}
continue;
}
deleteSrx = new File(ADConstants.configLocation + ADConstants.AD_SRXConfigFolder + File.separator + srxName);
if (!deleteSrx.delete()) {
MessageDialog.openInformation(getShell(), Messages.getString("srx.SrxConfigurationDialog.msgTitle2"), MessageFormat.format(Messages.getString("srx.SrxConfigurationDialog.msg2"), srxName));
}
}
refreshTable(null);
} else {
MessageDialog.openInformation(getShell(), Messages.getString("srx.SrxConfigurationDialog.msgTitle2"), Messages.getString("srx.SrxConfigurationDialog.msg3"));
}
}
});
}
use of org.eclipse.jface.viewers.ISelection in project translationstudio8 by heartsome.
the class XmlConvertManagerDialog method initListener.
/**
* 给增删改三个按钮添加点击事件 ;
*/
protected void initListener() {
addBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
AddOrEditElementOfXmlConvertDialog dialog = new AddOrEditElementOfXmlConvertDialog(getShell(), true, elementsList);
int result = dialog.open();
if (result == IDialogConstants.OK_ID) {
refreshTable(dialog.getCurrentElement());
}
}
});
editBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
editElement();
}
});
deleteBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
ISelection selection = tableViewer.getSelection();
if (selection != null && !selection.isEmpty() && selection instanceof IStructuredSelection) {
if (MessageDialog.openConfirm(getShell(), Messages.getString("dialogs.XmlConvertManagerDialog.msgTitle1"), Messages.getString("dialogs.XmlConvertManagerDialog.msg1"))) {
IStructuredSelection structuredSelection = (IStructuredSelection) selection;
@SuppressWarnings("unchecked") Iterator<ElementBean> iter = structuredSelection.iterator();
ElementBean bean = new ElementBean();
while (iter.hasNext()) {
bean = iter.next();
elementsList.remove(bean);
}
refreshTable(null);
}
} else {
MessageDialog.openInformation(getShell(), Messages.getString("dialogs.XmlConvertManagerDialog.msgTitle2"), Messages.getString("dialogs.XmlConvertManagerDialog.msg2"));
}
}
});
}
use of org.eclipse.jface.viewers.ISelection in project translationstudio8 by heartsome.
the class XmlConverterConfigurationDialog method initListener.
public void initListener() {
addBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
AddOrEditXmlConvertConfigDialog dialog = new AddOrEditXmlConvertConfigDialog(getShell(), true);
int result = dialog.open();
if (result == IDialogConstants.OK_ID) {
String curentConvertXMl = dialog.getCurentConverXML();
refreshTable();
setTableSelection(curentConvertXMl);
}
}
});
editBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
editConfigXml();
}
});
deleteBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
ISelection selection = tableViewer.getSelection();
if (!selection.isEmpty() && selection != null && selection instanceof IStructuredSelection) {
IStructuredSelection structuredSelection = (IStructuredSelection) selection;
@SuppressWarnings("unchecked") Iterator<String[]> iter = structuredSelection.iterator();
while (iter.hasNext()) {
String convertXmlName = iter.next()[1];
String convertXmlLoaction = root.getLocation().append(ADConstants.AD_xmlConverterConfigFolder).append(convertXmlName).toOSString();
File convertXml = new File(convertXmlLoaction);
convertXml.delete();
}
refreshTable();
} else {
MessageDialog.openInformation(getShell(), Messages.getString("dialogs.XmlConverterConfigurationDialog.msgTitle"), Messages.getString("dialogs.XmlConverterConfigurationDialog.msg1"));
}
}
});
analysisBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
AnalysisXmlConvertConfigDialg dialog = new AnalysisXmlConvertConfigDialg(getShell());
int result = dialog.open();
if (result == IDialogConstants.OK_ID) {
String curentConvertXMl = dialog.getCurentConverXML();
refreshTable();
setTableSelection(curentConvertXMl);
}
}
});
}
use of org.eclipse.jface.viewers.ISelection in project translationstudio8 by heartsome.
the class XmlConverterConfigurationDialog method editConfigXml.
/**
* 编辑转换配置XML文件 ;
*/
public void editConfigXml() {
ISelection selection = tableViewer.getSelection();
if (!selection.isEmpty() && selection != null && selection instanceof IStructuredSelection) {
IStructuredSelection structuredSelection = (IStructuredSelection) selection;
@SuppressWarnings("unchecked") Iterator<String[]> iter = structuredSelection.iterator();
String convertXml = iter.next()[1];
AddOrEditXmlConvertConfigDialog dialog = new AddOrEditXmlConvertConfigDialog(getShell(), false);
dialog.create();
String convertXmlLoaction = root.getLocation().append(ADConstants.AD_xmlConverterConfigFolder).append(convertXml).toOSString();
if (dialog.setInitEditData(convertXmlLoaction)) {
int result = dialog.open();
// 如果点击的是确定按钮,那么更新列表
if (result == IDialogConstants.OK_ID) {
String curentConvertXMl = dialog.getCurentConverXML();
refreshTable();
setTableSelection(curentConvertXMl);
}
}
} else {
MessageDialog.openInformation(getShell(), Messages.getString("dialogs.XmlConverterConfigurationDialog.msgTitle"), Messages.getString("dialogs.XmlConverterConfigurationDialog.msg2"));
}
}
use of org.eclipse.jface.viewers.ISelection in project translationstudio8 by heartsome.
the class SrxMapRulesManageDialog method initListener.
public void initListener() {
addBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
AddOrEditMapRuleOfSrxDialog dialog = new AddOrEditMapRuleOfSrxDialog(getShell(), true, mapRulesList, handler, srxLocation);
int result = dialog.open();
if (result == IDialogConstants.OK_ID) {
refreshTable(dialog.getCurMapRuleBean());
}
}
});
editBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
editMapRule();
}
});
deleteBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
ISelection selection = tableViewer.getSelection();
if (!selection.isEmpty() && selection != null && selection instanceof StructuredSelection) {
boolean respose = MessageDialog.openConfirm(getShell(), Messages.getString("srx.SrxMapRulesManageDialog.msgTitle"), Messages.getString("srx.SrxMapRulesManageDialog.msg1"));
if (!respose) {
return;
}
StructuredSelection structSelection = (StructuredSelection) selection;
@SuppressWarnings("unchecked") Iterator<MapRuleBean> it = structSelection.iterator();
while (it.hasNext()) {
mapRulesList.remove(it.next());
}
refreshTable(null);
} else {
MessageDialog.openInformation(getShell(), Messages.getString("srx.SrxMapRulesManageDialog.msgTitle2"), Messages.getString("srx.SrxMapRulesManageDialog.msg2"));
}
}
});
}
Aggregations