use of org.eclipse.jface.viewers.IDoubleClickListener 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.IDoubleClickListener 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.IDoubleClickListener 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.IDoubleClickListener 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();
}
use of org.eclipse.jface.viewers.IDoubleClickListener in project cubrid-manager by CUBRID.
the class FavoriteQueryNavigatorView method createTableGroup.
private void createTableGroup(Composite composite) {
final String[] columnNames = new String[] { "", com.cubrid.common.ui.query.Messages.msgBatchRunSqlFile, com.cubrid.common.ui.query.Messages.msgBatchRunMemo, com.cubrid.common.ui.query.Messages.msgBatchRunRegdate };
tv = CommonUITool.createCommonTableViewer(composite, null, columnNames, CommonUITool.createGridData(GridData.FILL_BOTH, 3, 1, -1, 200));
tv.setInput(FavoriteQueryPersistUtil.getInstance().getListData());
{
TableLayout tableLayout = new TableLayout();
tableLayout.addColumnData(new ColumnPixelData(0));
tableLayout.addColumnData(new ColumnPixelData(209));
tableLayout.addColumnData(new ColumnPixelData(80));
tableLayout.addColumnData(new ColumnPixelData(118));
tv.getTable().setLayout(tableLayout);
}
editor = new TableEditor(tv.getTable());
editor.horizontalAlignment = SWT.LEFT;
editor.grabHorizontal = true;
tv.getTable().addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
widgetDefaultSelected(e);
}
public void widgetDefaultSelected(SelectionEvent e) {
updateButtonStatus();
}
});
tv.getTable().addListener(SWT.MouseUp, new Listener() {
public void handleEvent(Event event) {
if (event.button != 1) {
return;
}
updateButtonStatus();
Point pt = new Point(event.x, event.y);
int newIndex = tv.getTable().getSelectionIndex();
if (tv.getTable().getItemCount() <= newIndex || newIndex < 0) {
return;
}
final TableItem item = tv.getTable().getItem(newIndex);
if (item == null) {
return;
}
Rectangle rect = item.getBounds(2);
if (rect.contains(pt)) {
focusCell(item, newIndex, 2);
}
}
});
tv.addDoubleClickListener(new IDoubleClickListener() {
public void doubleClick(DoubleClickEvent event) {
ISelection selection = event.getSelection();
openSelectedFile(selection);
}
});
createContextMenu();
}
Aggregations