use of org.eclipse.swt.events.ControlEvent in project iobserve-analysis by research-iobserve.
the class systemadaptationEditor method createPages.
/**
* This is the method used by the framework to install your own controls.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void createPages() {
// Creates the model from the editor input
//
createModel();
//
if (!getEditingDomain().getResourceSet().getResources().isEmpty()) {
// Create a page for the selection tree view.
//
{
ViewerPane viewerPane = new ViewerPane(getSite().getPage(), systemadaptationEditor.this) {
@Override
public Viewer createViewer(Composite composite) {
Tree tree = new Tree(composite, SWT.MULTI);
TreeViewer newTreeViewer = new TreeViewer(tree);
return newTreeViewer;
}
@Override
public void requestActivation() {
super.requestActivation();
setCurrentViewerPane(this);
}
};
viewerPane.createControl(getContainer());
selectionViewer = (TreeViewer) viewerPane.getViewer();
selectionViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));
selectionViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
selectionViewer.setInput(editingDomain.getResourceSet());
selectionViewer.setSelection(new StructuredSelection(editingDomain.getResourceSet().getResources().get(0)), true);
viewerPane.setTitle(editingDomain.getResourceSet());
new AdapterFactoryTreeEditor(selectionViewer.getTree(), adapterFactory);
createContextMenuFor(selectionViewer);
int pageIndex = addPage(viewerPane.getControl());
setPageText(pageIndex, getString("_UI_SelectionPage_label"));
}
// Create a page for the parent tree view.
//
{
ViewerPane viewerPane = new ViewerPane(getSite().getPage(), systemadaptationEditor.this) {
@Override
public Viewer createViewer(Composite composite) {
Tree tree = new Tree(composite, SWT.MULTI);
TreeViewer newTreeViewer = new TreeViewer(tree);
return newTreeViewer;
}
@Override
public void requestActivation() {
super.requestActivation();
setCurrentViewerPane(this);
}
};
viewerPane.createControl(getContainer());
parentViewer = (TreeViewer) viewerPane.getViewer();
parentViewer.setAutoExpandLevel(30);
parentViewer.setContentProvider(new ReverseAdapterFactoryContentProvider(adapterFactory));
parentViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
createContextMenuFor(parentViewer);
int pageIndex = addPage(viewerPane.getControl());
setPageText(pageIndex, getString("_UI_ParentPage_label"));
}
// This is the page for the list viewer
//
{
ViewerPane viewerPane = new ViewerPane(getSite().getPage(), systemadaptationEditor.this) {
@Override
public Viewer createViewer(Composite composite) {
return new ListViewer(composite);
}
@Override
public void requestActivation() {
super.requestActivation();
setCurrentViewerPane(this);
}
};
viewerPane.createControl(getContainer());
listViewer = (ListViewer) viewerPane.getViewer();
listViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));
listViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
createContextMenuFor(listViewer);
int pageIndex = addPage(viewerPane.getControl());
setPageText(pageIndex, getString("_UI_ListPage_label"));
}
// This is the page for the tree viewer
//
{
ViewerPane viewerPane = new ViewerPane(getSite().getPage(), systemadaptationEditor.this) {
@Override
public Viewer createViewer(Composite composite) {
return new TreeViewer(composite);
}
@Override
public void requestActivation() {
super.requestActivation();
setCurrentViewerPane(this);
}
};
viewerPane.createControl(getContainer());
treeViewer = (TreeViewer) viewerPane.getViewer();
treeViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));
treeViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
new AdapterFactoryTreeEditor(treeViewer.getTree(), adapterFactory);
createContextMenuFor(treeViewer);
int pageIndex = addPage(viewerPane.getControl());
setPageText(pageIndex, getString("_UI_TreePage_label"));
}
// This is the page for the table viewer.
//
{
ViewerPane viewerPane = new ViewerPane(getSite().getPage(), systemadaptationEditor.this) {
@Override
public Viewer createViewer(Composite composite) {
return new TableViewer(composite);
}
@Override
public void requestActivation() {
super.requestActivation();
setCurrentViewerPane(this);
}
};
viewerPane.createControl(getContainer());
tableViewer = (TableViewer) viewerPane.getViewer();
Table table = tableViewer.getTable();
TableLayout layout = new TableLayout();
table.setLayout(layout);
table.setHeaderVisible(true);
table.setLinesVisible(true);
TableColumn objectColumn = new TableColumn(table, SWT.NONE);
layout.addColumnData(new ColumnWeightData(3, 100, true));
objectColumn.setText(getString("_UI_ObjectColumn_label"));
objectColumn.setResizable(true);
TableColumn selfColumn = new TableColumn(table, SWT.NONE);
layout.addColumnData(new ColumnWeightData(2, 100, true));
selfColumn.setText(getString("_UI_SelfColumn_label"));
selfColumn.setResizable(true);
tableViewer.setColumnProperties(new String[] { "a", "b" });
tableViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));
tableViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
createContextMenuFor(tableViewer);
int pageIndex = addPage(viewerPane.getControl());
setPageText(pageIndex, getString("_UI_TablePage_label"));
}
// This is the page for the table tree viewer.
//
{
ViewerPane viewerPane = new ViewerPane(getSite().getPage(), systemadaptationEditor.this) {
@Override
public Viewer createViewer(Composite composite) {
return new TreeViewer(composite);
}
@Override
public void requestActivation() {
super.requestActivation();
setCurrentViewerPane(this);
}
};
viewerPane.createControl(getContainer());
treeViewerWithColumns = (TreeViewer) viewerPane.getViewer();
Tree tree = treeViewerWithColumns.getTree();
tree.setLayoutData(new FillLayout());
tree.setHeaderVisible(true);
tree.setLinesVisible(true);
TreeColumn objectColumn = new TreeColumn(tree, SWT.NONE);
objectColumn.setText(getString("_UI_ObjectColumn_label"));
objectColumn.setResizable(true);
objectColumn.setWidth(250);
TreeColumn selfColumn = new TreeColumn(tree, SWT.NONE);
selfColumn.setText(getString("_UI_SelfColumn_label"));
selfColumn.setResizable(true);
selfColumn.setWidth(200);
treeViewerWithColumns.setColumnProperties(new String[] { "a", "b" });
treeViewerWithColumns.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));
treeViewerWithColumns.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
createContextMenuFor(treeViewerWithColumns);
int pageIndex = addPage(viewerPane.getControl());
setPageText(pageIndex, getString("_UI_TreeWithColumnsPage_label"));
}
getSite().getShell().getDisplay().asyncExec(new Runnable() {
public void run() {
setActivePage(0);
}
});
}
// Ensures that this editor will only display the page's tab
// area if there are more than one page
//
getContainer().addControlListener(new ControlAdapter() {
boolean guard = false;
@Override
public void controlResized(ControlEvent event) {
if (!guard) {
guard = true;
hideTabs();
guard = false;
}
}
});
getSite().getShell().getDisplay().asyncExec(new Runnable() {
public void run() {
updateProblemIndication();
}
});
}
use of org.eclipse.swt.events.ControlEvent in project translationstudio8 by heartsome.
the class QAResultViewPart method createTable.
public void createTable() {
table = new KTable(parent, SWT.FULL_SELECTION | SWT.V_SCROLL | SWT.H_SCROLL | SWTX.FILL_WITH_LASTCOL | SWT.WRAP);
tableModel = new KtableModel();
table.setModel(tableModel);
table.setLayoutData(new GridData(GridData.FILL_BOTH));
table.setColorRightBorder(Display.getCurrent().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
table.setColorLeftBorder(Display.getCurrent().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
table.setColorTopBorder(Display.getCurrent().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
table.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
table.addMouseListener(new MouseAdapter() {
@Override
public void mouseDoubleClick(MouseEvent e) {
locationRow();
}
});
table.addKeyListener(new KeyAdapter() {
public void keyPressed(KeyEvent e) {
if (e.keyCode == QAConstant.QA_CENTERKEY_1 || e.keyCode == QAConstant.QA_CENTERKEY_2) {
locationRow();
}
}
});
table.addCellResizeListener(new KTableCellResizeListener() {
public void rowResized(int arg0, int arg1) {
tableModel.textRenderer.clearRowHeiMap();
table.redraw();
}
public void columnResized(int arg0, int arg1) {
tableModel.textRenderer.clearRowHeiMap();
table.redraw();
}
});
table.addControlListener(new ControlAdapter() {
@Override
public void controlResized(ControlEvent e) {
tableModel.textRenderer.clearRowHeiMap();
table.redraw();
}
});
table.addMouseWheelListener(new MouseWheelListener() {
public void mouseScrolled(MouseEvent e) {
tableModel.textRenderer.clearRowHeiMap();
table.redraw();
}
});
createPropMenu();
}
use of org.eclipse.swt.events.ControlEvent in project translationstudio8 by heartsome.
the class TerminologyViewPart method createPartControl.
/**
* 创建控件。
* @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
*/
@Override
public void createPartControl(Composite parent) {
this.parent = parent;
createAction();
GridLayout parentGl = new GridLayout(1, false);
parentGl.marginWidth = 0;
parentGl.marginHeight = 0;
parent.setLayout(parentGl);
final Composite contentPanel = new Composite(parent, SWT.NONE);
GridLayout secondPageCompositeGl = new GridLayout(1, false);
secondPageCompositeGl.marginBottom = -1;
secondPageCompositeGl.marginLeft = -1;
secondPageCompositeGl.marginRight = -1;
secondPageCompositeGl.marginTop = -1;
secondPageCompositeGl.marginWidth = 0;
secondPageCompositeGl.marginHeight = 0;
contentPanel.setLayout(secondPageCompositeGl);
contentPanel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
contentPanel.setLayout(secondPageCompositeGl);
contentPanel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
// firstPageComposite = new Composite(contentPanel, SWT.NONE);
// firstPageComposite.setLayout(new GridLayout(1, false));
// secondPageComposite = new Composite(contentPanel, SWT.NONE);
// GridLayout secondPageCompositeGl = new GridLayout(1, false);
// secondPageCompositeGl.marginBottom = -1;
// secondPageCompositeGl.marginLeft = -1;
// secondPageCompositeGl.marginRight = -1;
// secondPageCompositeGl.marginTop = -1;
// secondPageCompositeGl.marginWidth = 0;
// secondPageCompositeGl.marginHeight = 0;
// secondPageComposite.setLayout(secondPageCompositeGl);
// secondPageComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
gridTable = new Grid(contentPanel, SWT.BORDER | SWT.V_SCROLL);
gridTable.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
gridTable.setHeaderVisible(true);
gridTable.setAutoHeight(true);
gridTable.setRowsResizeable(true);
gridTable.setData("selectedBgColor", selectedBgColor);
final GridColumn idItem = new GridColumn(gridTable, SWT.NONE);
idItem.setText(Messages.getString("view.TerminologyViewPart.idItem"));
idColumnCellRenderer.setFont(JFaceResources.getFont(Constants.MATCH_VIEWER_TEXT_FONT));
idColumnCellRenderer.setVerticalAlignment(SWT.CENTER);
idItem.setCellRenderer(idColumnCellRenderer);
idItem.setWordWrap(true);
srcTableColumn = new GridColumn(gridTable, SWT.NONE);
srcTableColumn.setText(Messages.getString("view.TerminologyViewPart.srcTableColumn"));
srcColumnCellRenderer.setFont(JFaceResources.getFont(Constants.MATCH_VIEWER_TEXT_FONT));
srcTableColumn.setCellRenderer(srcColumnCellRenderer);
srcTableColumn.setWordWrap(true);
tgtTableColumn = new GridColumn(gridTable, SWT.NONE);
tgtTableColumn.setText(Messages.getString("view.TerminologyViewPart.tgtTableColumn"));
tgtColumnCellRenderer.setFont(JFaceResources.getFont(Constants.MATCH_VIEWER_TEXT_FONT));
tgtTableColumn.setCellRenderer(tgtColumnCellRenderer);
tgtTableColumn.setWordWrap(true);
final GridColumn propertyColumn = new GridColumn(gridTable, SWT.NONE);
propertyColumn.setText(Messages.getString("view.TerminologyViewPart.propertyColumn"));
propColumnCellRenderer.setFont(JFaceResources.getFont(Constants.MATCH_VIEWER_TEXT_FONT));
propertyColumn.setCellRenderer(propColumnCellRenderer);
propertyColumn.setWordWrap(true);
copyEnable = new GridCopyEnable(gridTable);
srcColumnCellRenderer.setCopyEnable(copyEnable);
tgtColumnCellRenderer.setCopyEnable(copyEnable);
// 设置列宽按比例
contentPanel.addControlListener(new ControlAdapter() {
public void controlResized(ControlEvent e) {
Rectangle area = contentPanel.getClientArea();
Point preferredSize = gridTable.computeSize(SWT.DEFAULT, SWT.DEFAULT);
// - 2 * gridTable.getBorderWidth();
int width = area.width;
if (preferredSize.y > area.height + gridTable.getHeaderHeight()) {
Point vBarSize = gridTable.getVerticalBar().getSize();
width -= vBarSize.x;
}
gridTable.setSize(area.width, area.height);
width -= 45;
idItem.setWidth(45);
srcTableColumn.setWidth((int) (width * 0.4));
tgtTableColumn.setWidth((int) (width * 0.4));
propertyColumn.setWidth((int) (width * 0.2));
}
});
Composite statusComposite = new Composite(contentPanel, SWT.NONE);
GridLayout statusComptGridLayout = new GridLayout(2, false);
statusComptGridLayout.marginBottom = -1;
statusComptGridLayout.marginLeft = -1;
statusComptGridLayout.marginRight = -1;
statusComptGridLayout.marginTop = -1;
statusComptGridLayout.marginWidth = 0;
statusComptGridLayout.marginHeight = 0;
statusComposite.setLayout(statusComptGridLayout);
statusComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
tipLabel = new CLabel(statusComposite, SWT.NONE);
tipLabel.setAlignment(SWT.LEFT);
CLabel label = new CLabel(statusComposite, SWT.None);
GridData gd = new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1);
gd.heightHint = 20;
label.setLayoutData(gd);
gridTable.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
selectItem();
}
});
gridTable.addListener(SWT.MouseDoubleClick, new Listener() {
public void handleEvent(Event event) {
firstAction.run();
}
});
initHookMenu();
}
use of org.eclipse.swt.events.ControlEvent in project dbeaver by serge-rider.
the class DataTransferPagePipes method createControl.
@Override
public void createControl(Composite parent) {
initializeDialogUnits(parent);
Composite composite = new Composite(parent, SWT.NULL);
composite.setLayout(new GridLayout());
composite.setLayoutData(new GridData(GridData.FILL_BOTH));
consumersTable = new TableViewer(composite, SWT.BORDER | SWT.SINGLE | SWT.FULL_SELECTION);
consumersTable.getTable().setLayoutData(new GridData(GridData.FILL_BOTH));
consumersTable.getTable().setLinesVisible(true);
consumersTable.setContentProvider(new IStructuredContentProvider() {
@Override
public void dispose() {
}
@Override
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
}
@Override
public Object[] getElements(Object inputElement) {
if (inputElement instanceof Collection) {
return ((Collection<?>) inputElement).toArray();
}
return new Object[0];
}
});
CellLabelProvider labelProvider = new CellLabelProvider() {
@Override
public void update(ViewerCell cell) {
TransferTarget element = (TransferTarget) cell.getElement();
if (cell.getColumnIndex() == 0) {
if (element.processor != null) {
cell.setImage(DBeaverIcons.getImage(element.processor.getIcon()));
cell.setText(element.processor.getName());
} else {
cell.setImage(DBeaverIcons.getImage(element.consumer.getIcon()));
cell.setText(element.consumer.getName());
}
} else {
if (element.processor != null) {
cell.setText(element.processor.getDescription());
} else {
cell.setText(element.consumer.getDescription());
}
}
}
};
{
TableViewerColumn columnName = new TableViewerColumn(consumersTable, SWT.LEFT);
columnName.setLabelProvider(labelProvider);
columnName.getColumn().setText(CoreMessages.data_transfer_wizard_init_column_exported);
TableViewerColumn columnDesc = new TableViewerColumn(consumersTable, SWT.LEFT);
columnDesc.setLabelProvider(labelProvider);
columnDesc.getColumn().setText(CoreMessages.data_transfer_wizard_init_column_description);
}
loadConsumers();
consumersTable.getTable().addSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent e) {
final IStructuredSelection selection = (IStructuredSelection) consumersTable.getSelection();
TransferTarget target;
if (!selection.isEmpty()) {
target = (TransferTarget) selection.getFirstElement();
} else {
target = null;
}
if (target == null) {
getWizard().getSettings().selectConsumer(null, null);
} else {
getWizard().getSettings().selectConsumer(target.consumer, target.processor);
}
updatePageCompletion();
}
@Override
public void widgetDefaultSelected(SelectionEvent e) {
widgetSelected(e);
if (isPageComplete()) {
getWizard().getContainer().showPage(getWizard().getNextPage(DataTransferPagePipes.this));
}
}
});
consumersTable.getTable().addControlListener(new ControlAdapter() {
@Override
public void controlResized(ControlEvent e) {
UIUtils.packColumns(consumersTable.getTable());
UIUtils.maxTableColumnsWidth(consumersTable.getTable());
consumersTable.getTable().removeControlListener(this);
}
});
setControl(composite);
DataTransferNodeDescriptor consumer = getWizard().getSettings().getConsumer();
DataTransferProcessorDescriptor processor = getWizard().getSettings().getProcessor();
if (consumer != null) {
Collection<TransferTarget> targets = (Collection<TransferTarget>) consumersTable.getInput();
for (TransferTarget target : targets) {
if (target.consumer == consumer && target.processor == processor) {
consumersTable.setSelection(new StructuredSelection(target));
break;
}
}
}
updatePageCompletion();
}
use of org.eclipse.swt.events.ControlEvent in project cubrid-manager by CUBRID.
the class ShardEnvStatusView method createPartControl.
/**
* Create the page content
*
* @param parent
* the parent composite
*/
public void createPartControl(Composite parent) {
composite = new Composite(parent, SWT.NONE);
composite.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
composite.setLayout(new FillLayout());
createTable();
// makeActions();
composite.addControlListener(new ControlAdapter() {
public void controlResized(ControlEvent event) {
updateTableLayout();
}
});
new StatusUpdate().start();
}
Aggregations