use of org.eclipse.jface.viewers.ICheckStateListener in project cubrid-manager by CUBRID.
the class ImportExportConnectionDialog method createTable.
private void createTable(Composite composite) {
hostListView = CheckboxTableViewer.newCheckList(composite, SWT.V_SCROLL | SWT.MULTI | SWT.BORDER | SWT.H_SCROLL | SWT.FULL_SELECTION);
hostListView.addCheckStateListener(new ICheckStateListener() {
public void checkStateChanged(CheckStateChangedEvent event) {
if (isExport) {
valid();
}
}
});
final GridData gdColumnsTable = new GridData(SWT.FILL, SWT.FILL, true, true);
gdColumnsTable.horizontalSpan = 3;
gdColumnsTable.heightHint = 189;
hostListView.getTable().setLayoutData(gdColumnsTable);
hostListView.getTable().setLinesVisible(true);
hostListView.getTable().setHeaderVisible(true);
final TableColumn hostName = new TableColumn(hostListView.getTable(), SWT.NONE);
hostName.setAlignment(SWT.LEFT);
hostName.setWidth(WIDTH_NAME);
hostName.setText(Messages.columnHeaderServerInfo);
if (isExport) {
hostName.setImage(CommonUIPlugin.getImage("icons/checked_green.png"));
} else {
hostName.setImage(CommonUIPlugin.getImage("icons/unchecked.gif"));
}
hostName.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event event) {
selectAll = !selectAll;
hostListView.setAllChecked(selectAll);
Image image = selectAll ? CommonUIPlugin.getImage("icons/checked_green.png") : CommonUIPlugin.getImage("icons/unchecked.gif");
hostName.setImage(image);
hostListView.refresh();
if (isExport) {
valid();
}
}
});
final TableColumn hostAddress = new TableColumn(hostListView.getTable(), SWT.NONE);
hostAddress.setAlignment(SWT.CENTER);
hostAddress.setWidth(WIDTH_ADDRESS);
hostAddress.setText(Messages.columnHeaderServerAddress);
final TableColumn hostPort = new TableColumn(hostListView.getTable(), SWT.NONE);
hostPort.setAlignment(SWT.CENTER);
hostPort.setWidth(WIDTH_PORT);
hostPort.setText(Messages.columnHeaderServerPort);
final TableColumn jdbcVer = new TableColumn(hostListView.getTable(), SWT.NONE);
jdbcVer.setAlignment(SWT.CENTER);
jdbcVer.setWidth(WIDTH_JDBC);
jdbcVer.setText(Messages.columnHeaderServerJdbcVersion);
final TableColumn hostUser = new TableColumn(hostListView.getTable(), SWT.NONE);
hostUser.setAlignment(SWT.CENTER);
hostUser.setWidth(WIDTH_USER);
hostUser.setText(Messages.columnHeaderServerUserName);
// final TableColumn savedPass = new TableColumn(hostListView.getTable(), SWT.NONE);
// savedPass.setAlignment(SWT.CENTER);
// savedPass.setWidth(WIDTH_SAVEPASS);
// savedPass.setText(Messages.columnHeaderServerAutoSave);
hostListView.setContentProvider(new ServerInfoTableViewerContentProvider());
hostListView.setLabelProvider(new ServerInfoTableViewerLabelProvider());
if (isExport) {
initExportTableData();
}
}
use of org.eclipse.jface.viewers.ICheckStateListener in project cubrid-manager by CUBRID.
the class LoadDatabaseDialog method createDbUnloadInfoTable.
/**
*
* Create database unload information table
*
* @param parent the parent composite
*/
private void createDbUnloadInfoTable(Composite parent) {
final String[] columnNameArr = new String[] { Messages.tblColumnLoadType, Messages.tblColumnPath, Messages.tblColumnDate };
tableViewer = (CheckboxTableViewer) CommonUITool.createCheckBoxTableViewer(parent, new TableViewerSorter(), columnNameArr, CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 3, 1, -1, 100));
tableViewer.addCheckStateListener(new ICheckStateListener() {
@SuppressWarnings("unchecked")
public void checkStateChanged(CheckStateChangedEvent event) {
Map<String, String> map = (Map<String, String>) event.getElement();
String checkedType = map.get("0");
String checkedPath = map.get("1");
String checkedDate = map.get("2");
if (event.getChecked()) {
for (int i = 0, n = unloadInfoTable.getItemCount(); i < n; i++) {
if (unloadInfoTable.getItem(i).getChecked()) {
String type = unloadInfoTable.getItem(i).getText(0);
String path = unloadInfoTable.getItem(i).getText(1);
String date = unloadInfoTable.getItem(i).getText(2);
if (checkedType.equals(type) && checkedPath.equals(path) && checkedDate.equals(date)) {
continue;
}
if (checkedType.equals(type)) {
unloadInfoTable.getItem(i).setChecked(false);
}
}
}
}
valid();
}
});
unloadInfoTable = tableViewer.getTable();
}
use of org.eclipse.jface.viewers.ICheckStateListener in project translationstudio8 by heartsome.
the class WizardExportResourcesPage2 method createResourcesGroup.
/**
* Creates the checkbox tree and list for selecting resources.
* @param parent
* the parent control
*/
protected final void createResourcesGroup(Composite parent) {
// create the input element, which has the root resource
// as its only child
List input = new ArrayList();
IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
for (int i = 0; i < projects.length; i++) {
if (projects[i].isOpen()) {
input.add(projects[i]);
}
}
this.resourceGroup = new ResourceTreeAndListGroup(parent, input, getResourceProvider(IResource.FOLDER | IResource.PROJECT), WorkbenchLabelProvider.getDecoratingWorkbenchLabelProvider(), getResourceProvider(IResource.FILE), WorkbenchLabelProvider.getDecoratingWorkbenchLabelProvider(), SWT.NONE, DialogUtil.inRegularFontMode(parent));
ICheckStateListener listener = new ICheckStateListener() {
public void checkStateChanged(CheckStateChangedEvent event) {
updateWidgetEnablements();
}
};
this.resourceGroup.addCheckStateListener(listener);
}
use of org.eclipse.jface.viewers.ICheckStateListener in project eclipse.platform.text by eclipse.
the class MatchFilterSelectionDialog method createMatchFilterControls.
private void createMatchFilterControls(Composite parent) {
// Create list viewer
Label l = new Label(parent, SWT.NONE);
l.setFont(parent.getFont());
l.setText(SearchMessages.MatchFilterSelectionDialog_filter_description);
Table table = new Table(parent, SWT.CHECK | SWT.BORDER);
table.setFont(parent.getFont());
fListViewer = new CheckboxTableViewer(table);
GridData data = new GridData(GridData.FILL_BOTH);
data.minimumHeight = convertHeightInCharsToPixels(8);
table.setLayoutData(data);
class ListenerAndLabelProvider extends LabelProvider implements ISelectionChangedListener, ICheckStateListener {
@Override
public void selectionChanged(SelectionChangedEvent event) {
performFilterListSelectionChanged();
}
@Override
public void checkStateChanged(CheckStateChangedEvent event) {
performFilterListCheckStateChanged();
}
@Override
public String getText(Object element) {
return ((MatchFilter) element).getName();
}
}
ListenerAndLabelProvider listenerAndLP = new ListenerAndLabelProvider();
fListViewer.setLabelProvider(listenerAndLP);
fListViewer.setContentProvider(new ArrayContentProvider());
fListViewer.addSelectionChangedListener(listenerAndLP);
fListViewer.addCheckStateListener(listenerAndLP);
fListViewer.setInput(fAllFilters);
fListViewer.setCheckedElements(fEnabledFilters);
l = new Label(parent, SWT.NONE);
l.setFont(parent.getFont());
l.setText(SearchMessages.MatchFilterSelectionDialog_description_label);
fDescription = new Text(parent, SWT.LEFT | SWT.WRAP | SWT.MULTI | SWT.READ_ONLY | SWT.BORDER | SWT.V_SCROLL);
fDescription.setFont(parent.getFont());
data = new GridData(GridData.FILL_HORIZONTAL);
data.heightHint = convertHeightInCharsToPixels(3);
fDescription.setLayoutData(data);
}
use of org.eclipse.jface.viewers.ICheckStateListener in project eclipse.platform.text by eclipse.
the class TemplatePreferencePage method createContents.
@Override
protected Control createContents(Composite ancestor) {
Composite parent = new Composite(ancestor, SWT.NONE);
GridLayout layout = new GridLayout();
layout.numColumns = 2;
layout.marginHeight = 0;
layout.marginWidth = 0;
parent.setLayout(layout);
Composite innerParent = new Composite(parent, SWT.NONE);
GridLayout innerLayout = new GridLayout();
innerLayout.numColumns = 2;
innerLayout.marginHeight = 0;
innerLayout.marginWidth = 0;
innerParent.setLayout(innerLayout);
GridData gd = new GridData(GridData.FILL_BOTH);
gd.horizontalSpan = 2;
innerParent.setLayoutData(gd);
Composite tableComposite = new Composite(innerParent, SWT.NONE);
GridData data = new GridData(GridData.FILL_BOTH);
data.widthHint = 360;
data.heightHint = convertHeightInCharsToPixels(10);
tableComposite.setLayoutData(data);
ColumnLayout columnLayout = new ColumnLayout();
tableComposite.setLayout(columnLayout);
Table table = new Table(tableComposite, SWT.CHECK | SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL);
table.setHeaderVisible(true);
table.setLinesVisible(true);
GC gc = new GC(getShell());
gc.setFont(JFaceResources.getDialogFont());
TemplateViewerComparator viewerComparator = new TemplateViewerComparator();
TableColumn column1 = new TableColumn(table, SWT.NONE);
column1.setText(TemplatesMessages.TemplatePreferencePage_column_name);
int minWidth = computeMinimumColumnWidth(gc, TemplatesMessages.TemplatePreferencePage_column_name);
columnLayout.addColumnData(new ColumnWeightData(2, minWidth, true));
column1.addSelectionListener(new TemplateColumnSelectionAdapter(column1, 0, viewerComparator));
TableColumn column2 = new TableColumn(table, SWT.NONE);
column2.setText(TemplatesMessages.TemplatePreferencePage_column_context);
minWidth = computeMinimumContextColumnWidth(gc);
columnLayout.addColumnData(new ColumnWeightData(1, minWidth, true));
column2.addSelectionListener(new TemplateColumnSelectionAdapter(column2, 1, viewerComparator));
TableColumn column3 = new TableColumn(table, SWT.NONE);
column3.setText(TemplatesMessages.TemplatePreferencePage_column_description);
minWidth = computeMinimumColumnWidth(gc, TemplatesMessages.TemplatePreferencePage_column_description);
columnLayout.addColumnData(new ColumnWeightData(3, minWidth, true));
column3.addSelectionListener(new TemplateColumnSelectionAdapter(column3, 2, viewerComparator));
TableColumn column4 = new TableColumn(table, SWT.NONE);
column4.setAlignment(SWT.CENTER);
column4.setText(TemplatesMessages.TemplatePreferencePage_column_autoinsert);
minWidth = computeMinimumColumnWidth(gc, TemplatesMessages.TemplatePreferencePage_column_autoinsert);
minWidth = Math.max(minWidth, computeMinimumColumnWidth(gc, TemplatesMessages.TemplatePreferencePage_on));
columnLayout.addColumnData(new ColumnPixelData(minWidth, false, false));
column4.addSelectionListener(new TemplateColumnSelectionAdapter(column4, 3, viewerComparator));
gc.dispose();
fTableViewer = new CheckboxTableViewer(table);
fTableViewer.setLabelProvider(new TemplateLabelProvider());
fTableViewer.setContentProvider(new TemplateContentProvider());
fTableViewer.setComparator(viewerComparator);
// Specify default sorting
table.setSortColumn(column1);
table.setSortDirection(viewerComparator.getDirection());
fTableViewer.addDoubleClickListener(new IDoubleClickListener() {
@Override
public void doubleClick(DoubleClickEvent e) {
edit();
}
});
fTableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent e) {
selectionChanged1();
}
});
fTableViewer.addCheckStateListener(new ICheckStateListener() {
@Override
public void checkStateChanged(CheckStateChangedEvent event) {
TemplatePersistenceData d = (TemplatePersistenceData) event.getElement();
d.setEnabled(event.getChecked());
}
});
BidiUtils.applyTextDirection(fTableViewer.getControl(), BidiUtils.BTD_DEFAULT);
Composite buttons = new Composite(innerParent, SWT.NONE);
buttons.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING));
layout = new GridLayout();
layout.marginHeight = 0;
layout.marginWidth = 0;
buttons.setLayout(layout);
fAddButton = new Button(buttons, SWT.PUSH);
fAddButton.setText(TemplatesMessages.TemplatePreferencePage_new);
fAddButton.setLayoutData(getButtonGridData(fAddButton));
fAddButton.addListener(SWT.Selection, new Listener() {
@Override
public void handleEvent(Event e) {
add();
}
});
fEditButton = new Button(buttons, SWT.PUSH);
fEditButton.setText(TemplatesMessages.TemplatePreferencePage_edit);
fEditButton.setLayoutData(getButtonGridData(fEditButton));
fEditButton.addListener(SWT.Selection, new Listener() {
@Override
public void handleEvent(Event e) {
edit();
}
});
fRemoveButton = new Button(buttons, SWT.PUSH);
fRemoveButton.setText(TemplatesMessages.TemplatePreferencePage_remove);
fRemoveButton.setLayoutData(getButtonGridData(fRemoveButton));
fRemoveButton.addListener(SWT.Selection, new Listener() {
@Override
public void handleEvent(Event e) {
remove();
}
});
createSeparator(buttons);
fRestoreButton = new Button(buttons, SWT.PUSH);
fRestoreButton.setText(TemplatesMessages.TemplatePreferencePage_restore);
fRestoreButton.setLayoutData(getButtonGridData(fRestoreButton));
fRestoreButton.addListener(SWT.Selection, new Listener() {
@Override
public void handleEvent(Event e) {
restoreDeleted();
}
});
fRevertButton = new Button(buttons, SWT.PUSH);
fRevertButton.setText(TemplatesMessages.TemplatePreferencePage_revert);
fRevertButton.setLayoutData(getButtonGridData(fRevertButton));
fRevertButton.addListener(SWT.Selection, new Listener() {
@Override
public void handleEvent(Event e) {
revert();
}
});
createSeparator(buttons);
fImportButton = new Button(buttons, SWT.PUSH);
fImportButton.setText(TemplatesMessages.TemplatePreferencePage_import);
fImportButton.setLayoutData(getButtonGridData(fImportButton));
fImportButton.addListener(SWT.Selection, new Listener() {
@Override
public void handleEvent(Event e) {
import_();
}
});
fExportButton = new Button(buttons, SWT.PUSH);
fExportButton.setText(TemplatesMessages.TemplatePreferencePage_export);
fExportButton.setLayoutData(getButtonGridData(fExportButton));
fExportButton.addListener(SWT.Selection, new Listener() {
@Override
public void handleEvent(Event e) {
export();
}
});
fPatternViewer = doCreateViewer(parent);
if (isShowFormatterSetting()) {
fFormatButton = new Button(parent, SWT.CHECK);
fFormatButton.setText(TemplatesMessages.TemplatePreferencePage_use_code_formatter);
GridData gd1 = new GridData();
gd1.horizontalSpan = 2;
fFormatButton.setLayoutData(gd1);
fFormatButton.setSelection(getPreferenceStore().getBoolean(getFormatterPreferenceKey()));
}
fTableViewer.setInput(fTemplateStore);
fTableViewer.setAllChecked(false);
fTableViewer.setCheckedElements(getEnabledTemplates());
updateButtons();
Dialog.applyDialogFont(parent);
innerParent.layout();
return parent;
}
Aggregations