use of org.eclipse.jface.viewers.TableViewerColumn in project cubrid-manager by CUBRID.
the class ViewDashboardEditorPart method createViewsDetailInfoTable.
public void createViewsDetailInfoTable(Composite parent) {
final Composite tableComposite = new Composite(parent, SWT.NONE);
{
tableComposite.setLayout(new FillLayout());
tableComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
}
viewsDetailInfoTable = new TableViewer(tableComposite, SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.MULTI | SWT.BORDER);
viewsDetailInfoTable.getTable().setHeaderVisible(true);
viewsDetailInfoTable.getTable().setLinesVisible(true);
final TableViewerColumn columnViewName = new TableViewerColumn(viewsDetailInfoTable, SWT.LEFT);
columnViewName.getColumn().setWidth(150);
columnViewName.getColumn().setText(Messages.viewDetailInfoPartColViewName);
final TableViewerColumn scriptDescColumn = new TableViewerColumn(viewsDetailInfoTable, SWT.LEFT);
scriptDescColumn.getColumn().setWidth(200);
scriptDescColumn.getColumn().setText(Messages.viewDetailInfoPartTableDefColumn);
final TableViewerColumn ownerColumn = new TableViewerColumn(viewsDetailInfoTable, SWT.LEFT);
ownerColumn.getColumn().setWidth(80);
ownerColumn.getColumn().setText(Messages.viewDetailInfoPartTableOwnerColumn);
viewsDetailInfoTable.setContentProvider(new ViewsDetailTableViewerContentProvider());
viewsDetailInfoTable.setLabelProvider(new ViewsDetailTableViewerLabelProvider());
viewsDetailInfoTable.addDoubleClickListener(new IDoubleClickListener() {
public void doubleClick(DoubleClickEvent event) {
IStructuredSelection selection = (IStructuredSelection) event.getSelection();
ViewDetailInfo oneViewDetail = (ViewDetailInfo) selection.getFirstElement();
//if had opend,set it selection
for (CTabItem tabItem : tabFolder.getItems()) {
if (tabItem.getText().equals(oneViewDetail.getViewName())) {
tabFolder.setSelection(tabItem);
return;
}
}
//if a new view info,create a new tab
ViewDashboardComposite viewComp = new ViewDashboardComposite(tabFolder, SWT.NONE);
viewComp.initialize();
SchemaInfo schemaInfo = database.getDatabaseInfo().getSchemaInfo(oneViewDetail.getViewName());
viewComp.setInput(schemaInfo);
}
});
viewsDetailInfoTable.getTable().addKeyListener(new KeyAdapter() {
public void keyPressed(KeyEvent event) {
if ((event.stateMask & SWT.CTRL) != 0 && event.keyCode == 'c') {
}
}
});
registerContextMenu();
}
use of org.eclipse.jface.viewers.TableViewerColumn in project cubrid-manager by CUBRID.
the class TableContentProvider method createPartControl.
/**
* Create part controls
*
* @param parent of the controls
*
*/
public void createPartControl(Composite parent) {
Composite backPanel = new Composite(parent, SWT.NONE);
backPanel.setLayout(new GridLayout(1, false));
backPanel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
Composite progressPanel = new Composite(backPanel, SWT.NONE);
progressPanel.setLayout(new GridLayout(2, false));
progressPanel.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
progressIndicator = new ProgressIndicator(progressPanel, SWT.NONE);
progressIndicator.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true));
btnStop = new Button(progressPanel, SWT.NONE);
btnStop.setText(com.cubrid.common.ui.common.Messages.btnStop);
btnStop.setImage(CommonUIPlugin.getImage("icons/queryeditor/query_run_stop.png"));
btnStop.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
processStop();
}
});
tvProgress = new TableViewer(backPanel, SWT.BORDER | SWT.FULL_SELECTION);
tvProgress.getTable().setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, true));
tvProgress.getTable().setLinesVisible(true);
tvProgress.getTable().setHeaderVisible(true);
final TableViewerColumn tableName = new TableViewerColumn(tvProgress, SWT.NONE);
final TableViewerColumn totalCount = new TableViewerColumn(tvProgress, SWT.NONE);
final TableViewerColumn parseCount = new TableViewerColumn(tvProgress, SWT.NONE);
final TableViewerColumn status = new TableViewerColumn(tvProgress, SWT.NONE);
final TableViewerColumn elapsedTime = new TableViewerColumn(tvProgress, SWT.NONE);
tableName.getColumn().setWidth(250);
tableName.getColumn().setText(Messages.exportMonitorPartColumnFileName);
totalCount.getColumn().setWidth(100);
totalCount.getColumn().setText(Messages.exportMonitorPartColumnTotalcount);
parseCount.getColumn().setWidth(100);
parseCount.getColumn().setText(Messages.exportMonitorPartColumnParsecount);
status.getColumn().setWidth(100);
status.getColumn().setText(com.cubrid.common.ui.common.Messages.columnStatus);
elapsedTime.getColumn().setWidth(130);
elapsedTime.getColumn().setText(com.cubrid.common.ui.common.Messages.columnElapsedTime);
tvProgress.setContentProvider(new TableContentProvider());
tvProgress.setLabelProvider(new TableLabelProvider());
init();
}
use of org.eclipse.jface.viewers.TableViewerColumn in project ACS by ACS-Community.
the class EventDetailPart method createPartControl.
@PostConstruct
public void createPartControl(Composite parent, EMenuService menuService) {
try {
em = EventModel.getInstance();
} catch (Throwable thr) {
thr.printStackTrace();
IStatus someStatus = statusReporter.newStatus(IStatus.ERROR, "Connection with NCs failed.", thr);
statusReporter.report(someStatus, StatusReporter.SHOW);
throw new RuntimeException(thr);
}
logger = em.getLogger();
viewer = new TableViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
Table table = viewer.getTable();
table.setHeaderVisible(true);
table.setLinesVisible(true);
GridLayout gridLayout = new GridLayout();
gridLayout.marginHeight = 0;
gridLayout.marginWidth = 0;
gridLayout.verticalSpacing = 0;
parent.setLayout(gridLayout);
TableViewerColumn tvcol = new TableViewerColumn(viewer, SWT.NONE, 0);
tvcol.setLabelProvider(new DetailNameLabelProvider());
TableColumn col = tvcol.getColumn();
col.setText("Name");
col.setWidth(200);
col.setAlignment(SWT.LEFT);
tvcol = new TableViewerColumn(viewer, SWT.NONE, 1);
tvcol.setLabelProvider(new DetailTypeLabelProvider());
col = tvcol.getColumn();
col.setText("Type");
col.setWidth(100);
col.setAlignment(SWT.LEFT);
tvcol = new TableViewerColumn(viewer, SWT.NONE, 2);
tvcol.setLabelProvider(new DetailValueLabelProvider());
col = tvcol.getColumn();
col.setText("Value");
col.setWidth(200);
col.setAlignment(SWT.LEFT);
GridDataFactory.fillDefaults().grab(true, true).applyTo(viewer.getTable());
viewer.setContentProvider(new DetailContentProvider());
hookContextMenu(menuService);
// Attach a selection listener to our table, which will post selections to the ESelectionService
// to be processed by CopyDetailsToClipboardHandler
viewer.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
IStructuredSelection selection = (IStructuredSelection) event.getSelection();
List<ParsedAnyData> parsedAnyList = new ArrayList<ParsedAnyData>();
for (Iterator<?> iterator = selection.iterator(); iterator.hasNext(); ) {
ParsedAnyData parsedAny = (ParsedAnyData) iterator.next();
parsedAnyList.add(parsedAny);
}
selectionService.setSelection(parsedAnyList.toArray(new ParsedAnyData[0]));
}
});
}
use of org.eclipse.jface.viewers.TableViewerColumn in project ACS by ACS-Community.
the class ServiceSummaryPart method createComposite.
@PostConstruct
public void createComposite(Composite parent, EMenuService menuService) {
try {
eventModel = EventModel.getInstance();
} catch (Throwable thr) {
thr.printStackTrace();
IStatus someStatus = statusReporter.newStatus(IStatus.ERROR, "Connection with NCs failed.", thr);
statusReporter.report(someStatus, StatusReporter.SHOW);
throw new RuntimeException(thr);
}
viewer = new TableViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
Table table = viewer.getTable();
table.setHeaderVisible(true);
table.setLinesVisible(true);
TableViewerColumn tvcol = new TableViewerColumn(viewer, SWT.NONE, 0);
tvcol.setLabelProvider(new ServiceNameLabelProvider());
TableColumn col = tvcol.getColumn();
col.setText("Notify Service");
col.setWidth(110);
col.setAlignment(SWT.LEFT);
tvcol = new TableViewerColumn(viewer, SWT.NONE, 1);
tvcol.setLabelProvider(new NumConsumersLabelProvider());
col = tvcol.getColumn();
col.setText("#consumers");
col.setWidth(50);
col.setAlignment(SWT.LEFT);
tvcol = new TableViewerColumn(viewer, SWT.NONE, 2);
tvcol.setLabelProvider(new NumSuppliersLabelProvider());
col = tvcol.getColumn();
col.setText("#suppliers");
col.setWidth(50);
col.setAlignment(SWT.LEFT);
viewer.setContentProvider(new ViewContentProvider());
viewer.setComparator(new ServiceViewerComparator());
//was: getViewSite() -- the dummy arg seems to become the input arg for ViewContentProvider#getElements(Object)
viewer.setInput(new Object());
hookContextMenu(menuService);
}
use of org.eclipse.jface.viewers.TableViewerColumn in project translationstudio8 by heartsome.
the class ConversionWizardPage method createFilesGroup.
/**
* 创建文件列表区域
* @param contents
* ;
*/
private Composite createFilesGroup(Composite contents) {
Composite filesComposite = new Composite(contents, SWT.NONE);
GridLayout gd = new GridLayout(2, false);
gd.marginWidth = 0;
filesComposite.setLayout(gd);
filesComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
filesTable = new Table(filesComposite, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI | SWT.FULL_SELECTION);
GridData tableData = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL);
tableData.heightHint = 100;
filesTable.setLayoutData(tableData);
filesTable.setLinesVisible(true);
filesTable.setHeaderVisible(true);
filesTable.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
doSelectedEvent();
}
});
tableViewer = new TableViewer(filesTable);
lineNumColumn = new TableViewerColumn(tableViewer, SWT.NONE).getColumn();
lineNumColumn.setText(Messages.getString("wizard.ConversionWizardPage.lineNumColumn"));
sourceColumn = new TableViewerColumn(tableViewer, SWT.NONE).getColumn();
sourceColumn.setText(Messages.getString("wizard.ConversionWizardPage.sourceColumn"));
formatColumn = new TableViewerColumn(tableViewer, SWT.NONE).getColumn();
formatColumn.setText(Messages.getString("wizard.ConversionWizardPage.formatColumn"));
srcEncColumn = new TableViewerColumn(tableViewer, SWT.NONE).getColumn();
srcEncColumn.setText(Messages.getString("wizard.ConversionWizardPage.srcEncColumn"));
IValueProperty[] valueProperties = BeanProperties.values(ConversionConfigBean.class, new String[] { "index", "source", "fileType", "srcEncoding" });
ViewerSupport.bind(tableViewer, new WritableList(conversionConfigBeans, ConversionConfigBean.class), valueProperties);
filesComposite.addPaintListener(new PaintListener() {
public void paintControl(PaintEvent arg0) {
int width = filesTable.getClientArea().width;
lineNumColumn.setWidth(width * 1 / 10);
sourceColumn.setWidth(width * 5 / 10);
formatColumn.setWidth(width * 3 / 10);
srcEncColumn.setWidth(width * 1 / 10);
}
});
Composite opComp = new Composite(filesComposite, SWT.NONE);
GridLayout opCompGl = new GridLayout();
opCompGl.marginWidth = 0;
opCompGl.marginLeft = 0;
opCompGl.marginTop = 0;
opCompGl.marginHeight = 0;
opComp.setLayout(opCompGl);
GridData gd_opComp = new GridData();
gd_opComp.verticalAlignment = SWT.TOP;
opComp.setLayoutData(gd_opComp);
Button addBt = new Button(opComp, SWT.NONE);
addBt.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
addBt.setText(Messages.getString("wizard.ConversionWizardPage.addbutton"));
addBt.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
FileFolderSelectionDialog dialog = new FileFolderSelectionDialog(getShell(), true, IResource.FILE) {
// 打开对话框时展开树形目录
public void create() {
super.create();
super.getTreeViewer().expandAll();
}
};
dialog.setMessage(Messages.getString("wizard.ConversionWizardPage.selectfiledialog.message"));
dialog.setTitle(Messages.getString("wizard.ConversionWizardPage.selectfiledialog.title"));
dialog.setDoubleClickSelects(true);
try {
dialog.setInput(EFS.getStore(ResourcesPlugin.getWorkspace().getRoot().getLocationURI()));
} catch (CoreException e1) {
LOGGER.error("", e1);
e1.printStackTrace();
}
dialog.addFilter(new ViewerFilter() {
@Override
public boolean select(Viewer viewer, Object parentElement, Object element) {
if (element instanceof LocalFile) {
LocalFile folder = (LocalFile) element;
if (folder.getName().equalsIgnoreCase(".hsConfig") || folder.getName().equalsIgnoreCase(".metadata")) {
return false;
}
String projectPath = currentProject.getLocation().toOSString();
if (projectPath.equals(folder.toString())) {
return true;
}
String xliffFolderPath = folder.toString();
String path1 = projectPath + File.separator + Constant.FOLDER_SRC;
if (xliffFolderPath.startsWith(path1)) {
for (ConversionConfigBean bean : conversionConfigBeans) {
if (xliffFolderPath.indexOf(bean.getSource()) != -1) {
return false;
}
}
return true;
}
}
return false;
}
});
dialog.create();
dialog.open();
if (dialog.getResult() != null) {
Object[] selectFiles = dialog.getResult();
for (Object selectedFile : selectFiles) {
LocalFile folder = (LocalFile) selectedFile;
ConverterViewModel model = new ConverterViewModel(Activator.getContext(), Converter.DIRECTION_POSITIVE);
Object adapter = Platform.getAdapterManager().getAdapter(ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(Path.fromOSString(folder.toString())), IConversionItem.class);
IConversionItem sourceItem = null;
if (adapter instanceof IConversionItem) {
sourceItem = (IConversionItem) adapter;
}
// 记住所选择的文件
model.setConversionItem(sourceItem);
ConversionConfigBean bean = model.getConfigBean();
// 初始化源文件路径
bean.setSource(ResourceUtils.toWorkspacePath(folder.toString()));
// 初始化源语言
bean.setSrcLang(srcLang);
bean.setTgtLangList(targetlanguage);
if (targetlanguage != null && targetlanguage.size() > 0) {
List<Language> lang = new ArrayList<Language>();
lang.add(targetlanguage.get(0));
bean.setHasSelTgtLangList(lang);
}
bean.setReplaceTarget(isReplaceTarget);
bean.setInitSegmenter(srxFile.getText());
conversionConfigBeans.add(bean);
converterViewModels.add(model);
}
loadFiles();
validate();
tableViewer.refresh();
}
}
});
Button removeBt = new Button(opComp, SWT.NONE);
removeBt.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
removeBt.setText(Messages.getString("wizard.ConversionWizardPage.removebutton"));
removeBt.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
if (conversionConfigBeans.size() == 0) {
return;
}
ISelection sel = tableViewer.getSelection();
if (sel.isEmpty()) {
MessageDialog.openError(getShell(), Messages.getString("wizard.ConversionWizardPage.removebutton.msg1.title"), Messages.getString("wizard.ConversionWizardPage.removebutton.msg1"));
return;
}
if (sel instanceof IStructuredSelection) {
IStructuredSelection ssel = (IStructuredSelection) sel;
Object[] objs = ssel.toArray();
int index = conversionConfigBeans.indexOf(ssel.getFirstElement());
index -= ssel.size();
index = index < 0 ? 0 : index;
for (Object obj : objs) {
int i = conversionConfigBeans.indexOf(obj);
conversionConfigBeans.remove(i);
converterViewModels.remove(i);
}
loadFiles();
tableViewer.refresh();
if (!conversionConfigBeans.isEmpty()) {
tableViewer.getTable().select(index);
doSelectedEvent();
}
validate();
}
}
});
return filesComposite;
}
Aggregations