use of org.eclipse.swt.events.SelectionEvent in project translationstudio8 by heartsome.
the class ProjectSettingTBPage method createContents.
/**
* Create contents of the preference page.
* @param parent
*/
@Override
public Control createContents(Composite parent) {
Composite container = new Composite(parent, SWT.NULL);
container.setLayout(new GridLayout(1, false));
tableViewer = new TableViewer(container, SWT.BORDER | SWT.FULL_SELECTION | SWT.SINGLE);
Table table = tableViewer.getTable();
table.setLinesVisible(true);
table.setHeaderVisible(true);
table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
tableViewer.setContentProvider(new ArrayContentProvider());
createColumn(tableViewer);
tableViewer.setInput(curDbList);
tableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
IStructuredSelection selection = (IStructuredSelection) tableViewer.getSelection();
DatabaseModelBean dbModel = (DatabaseModelBean) selection.getFirstElement();
if (null == dbModel) {
return;
}
if (Constants.DBTYPE_SQLITE.equals(dbModel.getDbType())) {
String path = dbModel.getItlDBLocation() + File.separator + dbModel.getDbName();
File file = new File(path);
if (!file.exists()) {
setMessage(Messages.getString("projectsetting.ProjectSettingTBPage.FileNotFoundMsg"));
return;
} else {
setMessage(Messages.getString("projectsetting.ProjectSettingTBPage.title"));
}
}
if (dbModel != null && !dbModel.isHasMatch()) {
setMessage(Messages.getString("projectsetting.ProjectSettingTBPage.msg1"));
}
}
});
Composite composite = new Composite(container, SWT.NONE);
composite.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
composite.setLayout(new GridLayout(5, false));
new Label(composite, SWT.NONE);
HSDropDownButton addBtn = new HSDropDownButton(composite, SWT.NONE);
addBtn.setText(Messages.getString("projectsetting.ProjectSettingTBPage.addBtn"));
Menu addMenu = addBtn.getMenu();
MenuItem item = new MenuItem(addMenu, SWT.PUSH);
item.setText(Messages.getString("tb.dialog.addTb.DropDownButton.AddFileTb"));
item.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
FileDialog fileDialg = new FileDialog(getShell());
fileDialg.setFilterExtensions(new String[] { "*.hstb", "*.*" });
String result = fileDialg.open();
if (result == null) {
return;
}
File f = new File(result);
if (!f.exists()) {
return;
}
Map<DatabaseModelBean, String> r = null;
try {
r = Utils.convertFile2TbModel(f, false);
} catch (Exception e1) {
MessageDialog.openError(getShell(), Messages.getString("tb.dialog.addFileTb.errorTitle"), e1.getMessage());
}
if (r == null) {
return;
}
Iterator<DatabaseModelBean> it = r.keySet().iterator();
if (it.hasNext()) {
DatabaseModelBean selectedVal = it.next();
List<DatabaseModelBean> dbList = new ArrayList<DatabaseModelBean>();
dbList.add(selectedVal);
addToCurrDbList(dbList);
}
}
});
MenuItem serverItem = new MenuItem(addMenu, SWT.PUSH);
serverItem.setText(Messages.getString("tb.dialog.addTb.DropDownButton.AddServerTb"));
serverItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
TermDbManagerDialog dialog = new TermDbManagerDialog(getShell());
dialog.setDialogUseFor(TermDbManagerDialog.TYPE_DBSELECTED);
if (dialog.open() == Window.OK) {
Iterator<DatabaseModelBean> it = dialog.getHasSelectedDatabase().keySet().iterator();
List<DatabaseModelBean> dbList = new ArrayList<DatabaseModelBean>();
while (it.hasNext()) {
dbList.add(it.next());
}
addToCurrDbList(dbList);
}
}
});
Button createBtn = new Button(composite, SWT.NONE);
createBtn.setText(Messages.getString("projectsetting.ProjectSettingTBPage.createBtn"));
createBtn.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
NewTermDbWizard wizard = new NewTermDbWizard();
TermDbManagerImportWizardDialog dlg = new TermDbManagerImportWizardDialog(getShell(), wizard);
if (dlg.open() == 0) {
DatabaseModelBean dbModel = wizard.getCreateDb();
List<DatabaseModelBean> dbList = new ArrayList<DatabaseModelBean>();
dbList.add(dbModel);
addToCurrDbList(dbList);
}
}
});
Button removeBtn = new Button(composite, SWT.NONE);
removeBtn.setText(Messages.getString("projectsetting.ProjectSettingTBPage.removeBtn"));
removeBtn.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
removeForCurrDbList((IStructuredSelection) tableViewer.getSelection());
}
});
Button importTmxBtn = new Button(composite, SWT.NONE);
importTmxBtn.setText(Messages.getString("projectsetting.ProjectSettingTBPage.importTmxBtn"));
importTmxBtn.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
IStructuredSelection selection = (IStructuredSelection) tableViewer.getSelection();
Iterator<?> it = selection.iterator();
if (it.hasNext()) {
DatabaseModelBean dbModel = (DatabaseModelBean) it.next();
TbxImportWizard wizard = new TbxImportWizard(dbModel);
TermDbManagerImportWizardDialog dlg = new TermDbManagerImportWizardDialog(getShell(), wizard);
if (dlg.open() == 0) {
checkDbHashMatch(dbModel);
tableViewer.refresh();
}
// 刷新项目
ResourceUtils.refreshCurentSelectProject();
} else {
MessageDialog.openInformation(getShell(), Messages.getString("projectsetting.ProjectSettingTBPage.msgTitle"), Messages.getString("projectsetting.ProjectSettingTBPage.msg2"));
}
}
});
addBtn.setFocus();
Point addPoint = addBtn.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
Point createPoint = createBtn.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
Point remPoint = removeBtn.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
Point importPoint = importTmxBtn.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
int width = Math.max(importPoint.x, Math.max(remPoint.x, Math.max(addPoint.x, createPoint.x)));
GridData btnData = new GridData();
btnData.widthHint = width + 10;
addBtn.setLayoutData(btnData);
createBtn.setLayoutData(btnData);
removeBtn.setLayoutData(btnData);
importTmxBtn.setLayoutData(btnData);
return container;
}
use of org.eclipse.swt.events.SelectionEvent in project translationstudio8 by heartsome.
the class TermDbManagerDialog method createHelpControl.
/**
* 添加帮助按钮 robert 2012-09-06
*/
@Override
protected Control createHelpControl(Composite parent) {
// ROBERTHELP 术语库管理
String language = CommonFunction.getSystemLanguage();
final String helpUrl = MessageFormat.format("/net.heartsome.cat.ts.ui.help/html/{0}/ch06s04.html#tb-management", language);
Image helpImage = JFaceResources.getImage(DLG_IMG_HELP);
ToolBar toolBar = new ToolBar(parent, SWT.FLAT | SWT.NO_FOCUS);
((GridLayout) parent.getLayout()).numColumns++;
toolBar.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER));
final Cursor cursor = new Cursor(parent.getDisplay(), SWT.CURSOR_HAND);
toolBar.setCursor(cursor);
toolBar.addDisposeListener(new DisposeListener() {
public void widgetDisposed(DisposeEvent e) {
cursor.dispose();
}
});
ToolItem helpItem = new ToolItem(toolBar, SWT.NONE);
helpItem.setImage(helpImage);
//$NON-NLS-1$
helpItem.setToolTipText(JFaceResources.getString("helpToolTip"));
helpItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
PlatformUI.getWorkbench().getHelpSystem().displayHelpResource(helpUrl);
}
});
return toolBar;
}
use of org.eclipse.swt.events.SelectionEvent in project translationstudio8 by heartsome.
the class ImportTbxHandler method execute.
/**
* (non-Javadoc)
*
* @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
*/
public Object execute(ExecutionEvent event) throws ExecutionException {
IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindow(event);
TermDbManagerImportWizard wizard = new TermDbManagerImportWizard();
TermDbManagerImportWizardDialog dlg = new TermDbManagerImportWizardDialog(window.getShell(), wizard) {
// robert help 2012-09-06
@Override
protected Control createHelpControl(Composite parent) {
// ROBERTHELP 导入TBX
String language = CommonFunction.getSystemLanguage();
final String helpUrl = MessageFormat.format("/net.heartsome.cat.ts.ui.help/html/{0}/ch05s03.html#create-tb-wizard-import-tbx", language);
Image helpImage = JFaceResources.getImage(DLG_IMG_HELP);
ToolBar toolBar = new ToolBar(parent, SWT.FLAT | SWT.NO_FOCUS);
((GridLayout) parent.getLayout()).numColumns++;
toolBar.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER));
final Cursor cursor = new Cursor(parent.getDisplay(), SWT.CURSOR_HAND);
toolBar.setCursor(cursor);
toolBar.addDisposeListener(new DisposeListener() {
public void widgetDisposed(DisposeEvent e) {
cursor.dispose();
}
});
ToolItem helpItem = new ToolItem(toolBar, SWT.NONE);
helpItem.setImage(helpImage);
//$NON-NLS-1$
helpItem.setToolTipText(JFaceResources.getString("helpToolTip"));
helpItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
PlatformUI.getWorkbench().getHelpSystem().displayHelpResource(helpUrl);
}
});
return toolBar;
}
};
dlg.setHelpAvailable(true);
dlg.open();
return null;
}
use of org.eclipse.swt.events.SelectionEvent in project translationstudio8 by heartsome.
the class TableHierarchicalExample method createControls.
/**
* Create the controls that compose the console test.
*
*/
protected void createControls(IHierarchicalJaretTableModel hierarchicalModel) {
GridLayout gl = new GridLayout();
gl.numColumns = 1;
_shell.setLayout(gl);
GridData gd = new GridData(GridData.FILL_BOTH);
_jt = new JaretTable(_shell, SWT.V_SCROLL | SWT.H_SCROLL);
_jt.setLayoutData(gd);
IHierarchicalJaretTableModel hmodel = hierarchicalModel;
if (hierarchicalModel == null) {
ITableNode root = new DummyTableNode("tn1", "tn1", "Root", "This the root node");
ITableNode r1 = new DummyTableNode("tn11", "tn12", "1", "Child 1 of the root");
ITableNode r2 = new DummyTableNode("tn12", "tn12", "2", "Child 2 of the root");
ITableNode r3 = new DummyTableNode("tn13", "tn13", "3", "Child 3 of the root");
root.addNode(r1);
root.addNode(r2);
root.addNode(r3);
r1.addNode(new DummyTableNode("tn111", "tn111", "1", "A second level child"));
r1.addNode(new DummyTableNode("tn112", "tn112", "2", "Another second level child"));
ITableNode n1 = new DummyTableNode("tn131", "tn131", "1", "A second level child");
r3.addNode(n1);
ITableNode n2 = new DummyTableNode("tn132", "tn132", "2", "Another second level child");
r3.addNode(n2);
n1.addNode(new DummyTableNode("tn1311", "tn1311", "1", "A third level child"));
n1.addNode(new DummyTableNode("tn1312", "tn1312", "2", "Another third level child"));
DefaultHierarchicalTableModel dhmodel = new DefaultHierarchicalTableModel(root);
hmodel = dhmodel;
if (SUPPORT_DND) {
// init the simple drag and drop handling
initDND(_jt, _shell);
}
}
_jt.setTableModel(hmodel);
StdHierarchicalTableModel model = (StdHierarchicalTableModel) _jt.getTableModel();
IColumn hcol = new HierarchyColumn();
// create and setup hierarchy renderer
final TableHierarchyRenderer hierarchyRenderer = new TableHierarchyRenderer();
hierarchyRenderer.setLabelProvider(new LabelProvider());
hierarchyRenderer.setDrawIcons(true);
hierarchyRenderer.setDrawLabels(true);
_jt.registerCellRenderer(hcol, hierarchyRenderer);
model.addColumn(hcol);
model.addColumn(new PropCol("b1", "column 1", "B1"));
model.addColumn(new PropCol("t1", "column 2", "T1"));
model.addColumn(new PropCol("t2", "column 3", "T2"));
model.addColumn(new PropCol("t3", "column 4", "T3"));
JaretTableActionFactory af = new JaretTableActionFactory();
MenuManager mm = new MenuManager();
mm.add(af.createStdAction(_jt, JaretTableActionFactory.ACTION_CONFIGURECOLUMNS));
_jt.setHeaderContextMenu(mm.createContextMenu(_jt));
MenuManager rm = new MenuManager();
rm.add(af.createStdAction(_jt, JaretTableActionFactory.ACTION_OPTROWHEIGHT));
rm.add(af.createStdAction(_jt, JaretTableActionFactory.ACTION_OPTALLROWHEIGHTS));
_jt.setRowContextMenu(rm.createContextMenu(_jt));
TableControlPanel ctrlPanel = new TableControlPanel(_shell, SWT.NULL, _jt);
Label l = new Label(_shell, SWT.NONE);
l.setText("Level width:");
final Scale levelWidthScale = new Scale(_shell, SWT.HORIZONTAL);
levelWidthScale.setMaximum(40);
levelWidthScale.setMinimum(0);
levelWidthScale.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent ev) {
int val = levelWidthScale.getSelection();
hierarchyRenderer.setLevelWidth(val);
_jt.redraw();
}
});
}
use of org.eclipse.swt.events.SelectionEvent in project translationstudio8 by heartsome.
the class TableControlPanel method createControls.
/**
* @param panel
*/
private void createControls() {
RowLayout rl = new RowLayout();
rl.type = SWT.HORIZONTAL;
this.setLayout(rl);
Composite col1 = new Composite(this, SWT.NULL);
rl = new RowLayout();
rl.type = SWT.VERTICAL;
col1.setLayout(rl);
Composite col2 = new Composite(this, SWT.NULL);
rl = new RowLayout();
rl.type = SWT.VERTICAL;
col2.setLayout(rl);
Composite col3 = new Composite(this, SWT.NULL);
rl = new RowLayout();
rl.type = SWT.VERTICAL;
col3.setLayout(rl);
final Button autoFilterCheck = new Button(col1, SWT.CHECK);
autoFilterCheck.setText("AutoFilter");
autoFilterCheck.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent arg0) {
_table.setAutoFilterEnable(autoFilterCheck.getSelection());
}
});
final Button drawHeaderCheck = new Button(col1, SWT.CHECK);
drawHeaderCheck.setSelection(_table.getDrawHeader());
drawHeaderCheck.setText("Draw header");
drawHeaderCheck.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent arg0) {
_table.setDrawHeader(drawHeaderCheck.getSelection());
}
});
final Button fillDragCheck = new Button(col1, SWT.CHECK);
fillDragCheck.setSelection(_table.isSupportFillDragging());
fillDragCheck.setText("Support fill dragging");
fillDragCheck.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent arg0) {
_table.setSupportFillDragging(fillDragCheck.getSelection());
}
});
Button b = new Button(col2, SWT.PUSH);
b.setText("Print");
b.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent arg0) {
print();
}
});
final Scale headerRotationScale = new Scale(col2, SWT.HORIZONTAL);
headerRotationScale.setMaximum(90);
headerRotationScale.setMinimum(0);
headerRotationScale.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent ev) {
int val = headerRotationScale.getSelection();
((DefaultTableHeaderRenderer) _table.getHeaderRenderer()).setRotation(val);
if (val > 0) {
_table.setHeaderHeight(50);
} else {
_table.setHeaderHeight(18);
}
_table.redraw();
}
});
final Button allowHeaderResizeCheck = new Button(col1, SWT.CHECK);
allowHeaderResizeCheck.setSelection(_table.getDrawHeader());
allowHeaderResizeCheck.setText("Allow header resize");
allowHeaderResizeCheck.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent arg0) {
_table.setHeaderResizeAllowed(allowHeaderResizeCheck.getSelection());
}
});
final Button allowRowResizeCheck = new Button(col1, SWT.CHECK);
allowRowResizeCheck.setSelection(_table.getDrawHeader());
allowRowResizeCheck.setText("Allow row resize");
allowRowResizeCheck.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent arg0) {
_table.setRowResizeAllowed(allowRowResizeCheck.getSelection());
}
});
final Button allowColResizeCheck = new Button(col1, SWT.CHECK);
allowColResizeCheck.setSelection(_table.getDrawHeader());
allowColResizeCheck.setText("Allow column resize");
allowColResizeCheck.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent arg0) {
_table.setColumnResizeAllowed(allowColResizeCheck.getSelection());
}
});
Label l = new Label(col2, SWT.NULL);
l.setText("Fixed columns");
final Combo fixedColCombo = new Combo(col2, SWT.BORDER | SWT.READ_ONLY);
fixedColCombo.setItems(new String[] { "0", "1", "2", "3", "4" });
fixedColCombo.select(0);
fixedColCombo.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent arg0) {
_table.setFixedColumns(fixedColCombo.getSelectionIndex());
}
});
l = new Label(col2, SWT.NULL);
l.setText("Fixed rows");
final Combo fixedRowCombo = new Combo(col2, SWT.BORDER | SWT.READ_ONLY);
fixedRowCombo.setItems(new String[] { "0", "1", "2", "3", "4" });
fixedRowCombo.select(0);
fixedRowCombo.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent arg0) {
_table.setFixedRows(fixedRowCombo.getSelectionIndex());
}
});
final Button resizeRestrictionCheck = new Button(col1, SWT.CHECK);
resizeRestrictionCheck.setSelection(_table.getResizeRestriction());
resizeRestrictionCheck.setText("Restrict resizing to headers/row headers");
resizeRestrictionCheck.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent arg0) {
_table.setResizeRestriction(resizeRestrictionCheck.getSelection());
}
});
final Button excludeFixedRowsCheck = new Button(col1, SWT.CHECK);
excludeFixedRowsCheck.setSelection(_table.getExcludeFixedRowsFromSorting());
excludeFixedRowsCheck.setText("Exclude fixed rows from sorting");
excludeFixedRowsCheck.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent arg0) {
_table.setExcludeFixedRowsFromSorting(excludeFixedRowsCheck.getSelection());
}
});
final Button rowFilterCheck = new Button(col1, SWT.CHECK);
rowFilterCheck.setSelection(false);
rowFilterCheck.setText("Set rowfilter (even char count on col2)");
rowFilterCheck.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent arg0) {
boolean sel = rowFilterCheck.getSelection();
if (sel) {
_table.setRowFilter(new AbstractRowFilter() {
public boolean isInResult(IRow row) {
return ((DummyRow) row).getT2() != null && ((DummyRow) row).getT2().length() % 2 == 0;
}
});
} else {
_table.setRowFilter(null);
}
}
});
final Button rowSorterCheck = new Button(col1, SWT.CHECK);
rowSorterCheck.setSelection(false);
rowSorterCheck.setText("Set rowsorter (char count on col3)");
rowSorterCheck.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent arg0) {
boolean sel = rowSorterCheck.getSelection();
if (sel) {
_table.setRowSorter(new AbstractRowSorter() {
public int compare(IRow o1, IRow o2) {
int c1 = ((DummyRow) o1).getT3() != null ? ((DummyRow) o1).getT3().length() : 0;
int c2 = ((DummyRow) o2).getT3() != null ? ((DummyRow) o2).getT3().length() : 0;
return c1 - c2;
}
});
} else {
_table.setRowSorter(null);
}
}
});
final Button onlyRowSelectionCheck = new Button(col1, SWT.CHECK);
onlyRowSelectionCheck.setSelection(false);
onlyRowSelectionCheck.setText("Only row selection allowed");
onlyRowSelectionCheck.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent arg0) {
boolean sel = onlyRowSelectionCheck.getSelection();
_table.getSelectionModel().setOnlyRowSelectionAllowed(sel);
_table.getSelectionModel().clearSelection();
}
});
final Button optimizeScrollingCheck = new Button(col1, SWT.CHECK);
optimizeScrollingCheck.setSelection(_table.getOptimizeScrolling());
optimizeScrollingCheck.setText("Optimize scrolling");
optimizeScrollingCheck.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent arg0) {
boolean sel = optimizeScrollingCheck.getSelection();
_table.setOptimizeScrolling(sel);
}
});
/**
* Style strategy coloring the background of odd row indizes. The implementation is brute force creating
* tons of objects underway ... so be careful.
*/
final IStyleStrategy _styleStrategy = new IStyleStrategy() {
public ICellStyle getCellStyle(IRow row, IColumn column, ICellStyle incomingStyle, ICellStyle defaultCellStyle) {
if (_table.getInternalRowIndex(row) % 2 == 0) {
return incomingStyle;
} else {
ICellStyle s = incomingStyle.copy();
s.setBackgroundColor(new RGB(230, 230, 230));
return s;
}
}
};
final Button bgColoringCheck = new Button(col1, SWT.CHECK);
bgColoringCheck.setSelection(_table.getTableViewState().getCellStyleProvider().getStyleStrategy() != null);
bgColoringCheck.setText("BG coloring (IStyleStrategy)");
bgColoringCheck.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent arg0) {
boolean sel = bgColoringCheck.getSelection();
if (!sel) {
_table.getTableViewState().getCellStyleProvider().setStyleStrategy(null);
_table.redraw();
} else {
_table.getTableViewState().getCellStyleProvider().setStyleStrategy(_styleStrategy);
_table.redraw();
}
}
});
Button b2 = new Button(col2, SWT.PUSH);
b2.setText("Spawn new window");
b2.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent arg0) {
// hack
if (_table.getHierarchicalModel() == null) {
if (_table.getTableModel() instanceof SimpleJaretTableModel) {
new SimpleModelExample(_table.getTableModel());
} else {
new TableExample(_table.getTableModel());
}
} else {
new TableHierarchicalExample(_table.getHierarchicalModel());
}
}
});
b2 = new Button(col2, SWT.PUSH);
b2.setText("Start changing bars");
b2.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent arg0) {
for (int i = 0; i < _table.getTableModel().getRowCount(); i++) {
Runnable r = new Changer(_table.getTableModel(), i);
Thread t = new Thread(r);
t.start();
}
}
});
b2 = new Button(col3, SWT.PUSH);
b2.setText("Set heightmode OPTIMAL");
b2.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent arg0) {
_table.getTableViewState().setRowHeightMode(ITableViewState.RowHeightMode.OPTIMAL);
}
});
b2 = new Button(col3, SWT.PUSH);
b2.setText("Set heightmode OPTANDVAR");
b2.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent arg0) {
_table.getTableViewState().setRowHeightMode(ITableViewState.RowHeightMode.OPTANDVAR);
}
});
b2 = new Button(col3, SWT.PUSH);
b2.setText("Set heightmode VARIABLE");
b2.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent arg0) {
_table.getTableViewState().setRowHeightMode(ITableViewState.RowHeightMode.VARIABLE);
}
});
b2 = new Button(col3, SWT.PUSH);
b2.setText("Set heightmode FIXED");
b2.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent arg0) {
_table.getTableViewState().setRowHeightMode(ITableViewState.RowHeightMode.FIXED);
}
});
l = new Label(col3, SWT.NULL);
l.setText("Column resize mode");
final Combo colModeCombo = new Combo(col3, SWT.BORDER | SWT.READ_ONLY);
colModeCombo.setItems(new String[] { "NONE", "SUBSEQUENT", "ALLSUBSEQUENT", "ALL" });
colModeCombo.select(0);
colModeCombo.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent arg0) {
String sel = colModeCombo.getText();
_table.getTableViewState().setColumnResizeMode(ITableViewState.ColumnResizeMode.valueOf(sel));
}
});
b2 = new Button(col3, SWT.PUSH);
b2.setText("Clipboard info");
b2.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent arg0) {
Clipboard cb = new Clipboard(Display.getCurrent());
System.out.println("Clipboard info");
TextTransfer textTransfer = TextTransfer.getInstance();
Object content = cb.getContents(textTransfer);
if (content != null) {
System.out.println("TEXT: " + content.getClass() + ":" + content.toString());
}
RTFTransfer rtfTransfer = RTFTransfer.getInstance();
content = cb.getContents(rtfTransfer);
if (content != null) {
System.out.println("RTF: " + content.getClass() + ":" + content.toString());
}
HTMLTransfer htmlTransfer = HTMLTransfer.getInstance();
content = cb.getContents(htmlTransfer);
if (content != null) {
System.out.println("HTML: " + content.getClass() + ":" + content.toString());
}
}
});
final Button includeColHeadingsWhenCopying = new Button(col3, SWT.CHECK);
includeColHeadingsWhenCopying.setText("Include col header when copying");
if (_table.getCcpStrategy() instanceof DefaultCCPStrategy) {
DefaultCCPStrategy stategy = (DefaultCCPStrategy) _table.getCcpStrategy();
includeColHeadingsWhenCopying.setSelection(stategy.getIncludeHeadersInCopy());
includeColHeadingsWhenCopying.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent arg0) {
boolean sel = includeColHeadingsWhenCopying.getSelection();
DefaultCCPStrategy stategy = (DefaultCCPStrategy) _table.getCcpStrategy();
stategy.setIncludeHeadersInCopy(sel);
}
});
} else {
includeColHeadingsWhenCopying.setEnabled(false);
}
}
Aggregations