use of org.eclipse.jface.viewers.DoubleClickEvent in project translationstudio8 by heartsome.
the class AddOrEditSrxConfigDialog method createLanguageGroup.
/**
* 创建语言规则配置
* @param tparent
* ;
*/
private void createLanguageGroup(Composite tparent, GridData groupData, GridLayout groupLayout) {
Group group = new Group(tparent, SWT.BORDER);
group.setLayoutData(groupData);
group.setLayout(groupLayout);
group.setText(Messages.getString("srx.AddOrEditSrxConfigDialog.groupLang"));
langTableViewer = new TableViewer(group, SWT.FULL_SELECTION | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI);
langTable = langTableViewer.getTable();
langTable.setLinesVisible(true);
langTable.setHeaderVisible(true);
GridDataFactory.fillDefaults().span(4, SWT.DEFAULT).grab(true, true).applyTo(langTable);
langTableViewer.setLabelProvider(new TableViewerLabelProvider());
langTableViewer.setContentProvider(new ArrayContentProvider());
String[] columnNames = new String[] { Messages.getString("srx.AddOrEditSrxConfigDialog.langColumnNames1"), Messages.getString("srx.AddOrEditSrxConfigDialog.langColumnNames2") };
int[] columnAlignments = new int[] { SWT.LEFT, SWT.LEFT };
for (int i = 0; i < columnNames.length; i++) {
TableColumn tableColumn = new TableColumn(langTable, columnAlignments[i]);
tableColumn.setText(columnNames[i]);
tableColumn.setWidth(50);
}
refreshTableWidth(langTable);
langAddBtn = new Button(group, SWT.NONE);
langAddBtn.setText(Messages.getString("srx.AddOrEditSrxConfigDialog.langAddBtn"));
setButtonLayoutData(langAddBtn);
langEditBtn = new Button(group, SWT.NONE);
langEditBtn.setText(Messages.getString("srx.AddOrEditSrxConfigDialog.langEditBtn"));
setButtonLayoutData(langEditBtn);
langDeleteBtn = new Button(group, SWT.NONE);
langDeleteBtn.setText(Messages.getString("srx.AddOrEditSrxConfigDialog.langDeleteBtn"));
setButtonLayoutData(langDeleteBtn);
new Label(group, SWT.NONE);
langTableViewer.addDoubleClickListener(new IDoubleClickListener() {
public void doubleClick(DoubleClickEvent event) {
editLangRules();
}
});
}
use of org.eclipse.jface.viewers.DoubleClickEvent in project translationstudio8 by heartsome.
the class XmlConvertManagerDialog method createTable.
protected void createTable(Composite tparent) {
tableViewer = new TableViewer(tparent, SWT.FULL_SELECTION | SWT.V_SCROLL | SWT.H_SCROLL | SWT.MULTI | SWT.BORDER);
table = tableViewer.getTable();
table.setHeaderVisible(true);
table.setLinesVisible(true);
GridDataFactory.fillDefaults().grab(true, true).applyTo(table);
createTableColumns();
// 让列表列宽动态变化
table.addListener(SWT.Resize, new Listener() {
public void handleEvent(Event event) {
final Table table = ((Table) event.widget);
final TableColumn[] columns = table.getColumns();
event.widget.getDisplay().syncExec(new Runnable() {
public void run() {
double[] columnWidths = new double[] { 0.2, 0.2, 0.2, 0.20, 0.14 };
for (int i = 0; i < columns.length; i++) columns[i].setWidth((int) (table.getBounds().width * columnWidths[i]));
}
});
}
});
tableViewer.setLabelProvider(new TViewerLabelProvider());
tableViewer.setContentProvider(new ArrayContentProvider());
tableViewer.addDoubleClickListener(new IDoubleClickListener() {
public void doubleClick(DoubleClickEvent event) {
editElement();
}
});
}
use of org.eclipse.jface.viewers.DoubleClickEvent in project translationstudio8 by heartsome.
the class SrxMapRulesManageDialog method createTable.
private void createTable(Composite tparent) {
tableViewer = new TableViewer(tparent, SWT.FULL_SELECTION | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI);
table = tableViewer.getTable();
table.setLinesVisible(true);
table.setHeaderVisible(true);
GridDataFactory.fillDefaults().span(4, SWT.DEFAULT).grab(true, true).applyTo(table);
tableViewer.setLabelProvider(new TViewerLabelProvider());
tableViewer.setContentProvider(new ArrayContentProvider());
String[] columnNames = new String[] { Messages.getString("srx.SrxMapRulesManageDialog.columnNames1"), Messages.getString("srx.SrxMapRulesManageDialog.columnNames2") };
int[] columnAlignments = new int[] { SWT.LEFT, SWT.LEFT };
for (int i = 0; i < columnNames.length; i++) {
TableColumn tableColumn = new TableColumn(table, columnAlignments[i]);
tableColumn.setText(columnNames[i]);
tableColumn.setWidth(50);
}
// 让列表列宽动态变化
table.addListener(SWT.Resize, new Listener() {
public void handleEvent(Event event) {
final Table table = ((Table) event.widget);
final TableColumn[] columns = table.getColumns();
event.widget.getDisplay().syncExec(new Runnable() {
public void run() {
double[] columnWidths = new double[] { 0.2, 0.77 };
for (int i = 0; i < columns.length; i++) columns[i].setWidth((int) (table.getBounds().width * columnWidths[i]));
}
});
}
});
tableViewer.addDoubleClickListener(new IDoubleClickListener() {
public void doubleClick(DoubleClickEvent event) {
editMapRule();
}
});
}
use of org.eclipse.jface.viewers.DoubleClickEvent in project translationstudio8 by heartsome.
the class LocationPageContentProvider method setupListeners.
/**
* 注册监听 ;
*/
void setupListeners() {
wsTreeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
IStructuredSelection s = (IStructuredSelection) event.getSelection();
Object obj = s.getFirstElement();
if (obj instanceof IContainer) {
wsContainer = (IContainer) obj;
} else if (obj instanceof IFile) {
IFile tempFile = (IFile) obj;
wsContainer = tempFile.getParent();
wsFilenameText.setText(tempFile.getName());
}
}
});
wsTreeViewer.addDoubleClickListener(new IDoubleClickListener() {
public void doubleClick(DoubleClickEvent event) {
ISelection s = event.getSelection();
if (s instanceof IStructuredSelection) {
Object item = ((IStructuredSelection) s).getFirstElement();
if (wsTreeViewer.getExpandedState(item)) {
wsTreeViewer.collapseToLevel(item, 1);
} else {
wsTreeViewer.expandToLevel(item, 1);
}
}
}
});
wsFilenameText.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
String patchName = wsFilenameText.getText();
if (patchName.trim().equals("")) {
//$NON-NLS-1$
okButton.setEnabled(false);
setErrorMessage(Messages.getString("dialog.WorkspaceDialog.msg1"));
} else if (!(ResourcesPlugin.getWorkspace().validateName(patchName, IResource.FILE)).isOK()) {
// make sure that the filename does not contain more than one segment
okButton.setEnabled(false);
setErrorMessage(Messages.getString("dialog.WorkspaceDialog.msg2"));
} else {
okButton.setEnabled(true);
setErrorMessage(null);
}
}
});
}
use of org.eclipse.jface.viewers.DoubleClickEvent in project cubrid-manager by CUBRID.
the class SerialDashboardEditorPart method createSerialsDetailInfoTable.
public void createSerialsDetailInfoTable(Composite parent) {
final Composite tableComposite = new Composite(parent, SWT.NONE);
tableComposite.setLayout(new FillLayout());
tableComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
serialsDetailInfoTable = new TableViewer(tableComposite, SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.MULTI | SWT.BORDER);
serialsDetailInfoTable.getTable().setHeaderVisible(true);
serialsDetailInfoTable.getTable().setLinesVisible(true);
CommonUITool.hackForYosemite(serialsDetailInfoTable.getTable());
final TableViewerColumn nameColumn = new TableViewerColumn(serialsDetailInfoTable, SWT.LEFT);
nameColumn.getColumn().setWidth(150);
nameColumn.getColumn().setText(Messages.serialsDetailInfoPartTableNameCol);
final TableViewerColumn curValColumn = new TableViewerColumn(serialsDetailInfoTable, SWT.LEFT);
curValColumn.getColumn().setWidth(120);
curValColumn.getColumn().setText(Messages.serialsDetailInfoPartTableCurValCol);
final TableViewerColumn increValColumn = new TableViewerColumn(serialsDetailInfoTable, SWT.LEFT);
increValColumn.getColumn().setWidth(120);
increValColumn.getColumn().setText(Messages.serialsDetailInfoPartTableIncreValCol);
final TableViewerColumn minValColumn = new TableViewerColumn(serialsDetailInfoTable, SWT.LEFT);
minValColumn.getColumn().setWidth(100);
minValColumn.getColumn().setText(Messages.serialsDetailInfoPartTableMinValCol);
final TableViewerColumn maxValColumn = new TableViewerColumn(serialsDetailInfoTable, SWT.LEFT);
maxValColumn.getColumn().setWidth(100);
maxValColumn.getColumn().setText(Messages.serialsDetailInfoPartTableMaxValCol);
final TableViewerColumn cacheNumColumn = new TableViewerColumn(serialsDetailInfoTable, SWT.LEFT);
cacheNumColumn.getColumn().setWidth(70);
cacheNumColumn.getColumn().setText(Messages.serialsDetailInfoPartTableCacheNumCol);
final TableViewerColumn cycleColumn = new TableViewerColumn(serialsDetailInfoTable, SWT.LEFT);
cycleColumn.getColumn().setWidth(50);
cycleColumn.getColumn().setText(Messages.serialsDetailInfoPartTableCycleCol);
serialsDetailInfoTable.setComparator(new ColumnViewerSorter());
serialsDetailInfoTable.setContentProvider(new SerialsDetailTableViewerContentProvider());
serialsDetailInfoTable.setLabelProvider(new SerialTableViewerLabelProvider());
serialsDetailInfoTable.addDoubleClickListener(new IDoubleClickListener() {
public void doubleClick(DoubleClickEvent event) {
StructuredSelection sel = (StructuredSelection) event.getSelection();
if (sel == null) {
return;
}
SerialInfo serialInfo = (SerialInfo) sel.getFirstElement();
if (serialInfo == null) {
return;
}
openEditSerialDialog(serialInfo);
}
});
registerContextMenu();
}
Aggregations