use of org.eclipse.jface.viewers.ICheckStateListener in project tmdm-studio-se by Talend.
the class DataProcessRuleDialog method initTableViewer.
private void initTableViewer() {
tableViewer.setLabelProvider(new TableLabelProvider());
tableViewer.setContentProvider(new ArrayContentProvider());
tableViewer.setCheckStateProvider(new ICheckStateProvider() {
public boolean isGrayed(Object element) {
return false;
}
public boolean isChecked(Object element) {
if (element instanceof DataEntityUnit) {
return ((DataEntityUnit) element).isSelected();
}
return false;
}
});
tableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
enableButtons();
}
});
tableViewer.addCheckStateListener(new ICheckStateListener() {
public void checkStateChanged(CheckStateChangedEvent event) {
DataEntityUnit unit = (DataEntityUnit) event.getElement();
unit.setSelected(event.getChecked());
updateSelectAllBun();
updateOKButton();
}
});
//
tableViewer.setInput(rule.getEntityUnits());
}
use of org.eclipse.jface.viewers.ICheckStateListener in project tmdm-studio-se by Talend.
the class RepositoryViewFilterDialog method createDialogArea.
/**
* Create contents of the dialog.
*
* @param parent
*/
@Override
protected Control createDialogArea(Composite parent) {
Composite container = (Composite) super.createDialogArea(parent);
GridLayout gl_container = new GridLayout(1, false);
gl_container.marginRight = 5;
container.setLayout(gl_container);
Group nameGroup = new Group(container, SWT.NONE);
nameGroup.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
GridLayout gl_nameGroup = new GridLayout(1, false);
nameGroup.setLayout(gl_nameGroup);
nameGroup.setText(Messages.RepositoryViewFilterDialog_groupNamePattern);
enableNameFilterBun = new Button(nameGroup, SWT.CHECK);
enableNameFilterBun.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
namePatternTxt.setEnabled(enableNameFilterBun.getSelection());
}
});
enableNameFilterBun.setText(Messages.RepositoryViewFilterDialog_enableNameFilter);
namePatternTxt = new Text(nameGroup, SWT.BORDER);
namePatternTxt.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
namePatternTxt.setSize(440, 18);
objectgroup = new Group(container, SWT.NONE);
objectgroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
objectgroup.setText(Messages.RepositoryViewFilterDialog_groupServerObject);
objectgroup.setLayout(new GridLayout(1, false));
enableServerObjFilterBun = new Button(objectgroup, SWT.CHECK);
enableServerObjFilterBun.setSize(183, 16);
enableServerObjFilterBun.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
enableServerObjFilterComposite(enableServerObjFilterBun.getSelection());
}
});
enableServerObjFilterBun.setText(Messages.RepositoryViewFilterDialog_enableServerObjFilter);
serverObjViewer = CheckboxTableViewer.newCheckList(objectgroup, SWT.BORDER | SWT.FULL_SELECTION);
table = serverObjViewer.getTable();
table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
table.setSize(441, 121);
enableAllBun = new Button(objectgroup, SWT.CHECK);
enableAllBun.setSize(171, 16);
enableAllBun.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
boolean selected = enableAllBun.getSelection();
enableAllBun.setSelection(selected);
serverObjViewer.setAllChecked(selected);
if (selected)
enabledConfigs.addAll(allConfigs);
else
enabledConfigs.clear();
}
});
enableAllBun.setText(Messages.RepositoryViewFilterDialog_enableAllServerObject);
//
serverObjViewer.addCheckStateListener(new ICheckStateListener() {
public void checkStateChanged(CheckStateChangedEvent event) {
IRepositoryViewObject config = (IRepositoryViewObject) event.getElement();
if (event.getChecked())
enabledConfigs.add(config);
else
enabledConfigs.remove(config);
solveProcTriCase();
enableAllBun.setSelection(enabledConfigs.size() == allConfigs.size());
}
});
serverObjViewer.setLabelProvider(new MDMRepositoryLabelProvider());
serverObjViewer.setContentProvider(new ArrayContentProvider());
Group lastServerGroup = new Group(container, SWT.NONE);
lastServerGroup.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
lastServerGroup.setLayout(new GridLayout(3, false));
lastServerGroup.setText(Messages.RepositoryViewFilterDialog_groupLastServer);
enableLastServerFilterBun = new Button(lastServerGroup, SWT.CHECK);
enableLastServerFilterBun.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1));
enableLastServerFilterBun.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
enableLastServerFilterComposite(enableLastServerFilterBun.getSelection());
}
});
enableLastServerFilterBun.setText(Messages.RepositoryViewFilterDialog_enableLastServerFilter);
enableLastServerFilterBun.setSelection(false);
new Label(lastServerGroup, SWT.NONE);
lastServerLabel = new Label(lastServerGroup, SWT.NONE);
lastServerLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
lastServerLabel.setText(Messages.RepositoryViewFilterDialog_lblLastServer);
serverNameTxt = new Text(lastServerGroup, SWT.BORDER | SWT.READ_ONLY);
serverNameTxt.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
selServerBun = new Button(lastServerGroup, SWT.NONE);
selServerBun.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
SelectServerDefDialog dlg = new SelectServerDefDialog(getShell());
if (dlg.open() == IDialogConstants.OK_ID) {
MDMServerDef def = dlg.getSelectedServerDef();
serverNameTxt.setText(def.getName());
}
}
});
selServerBun.setText(Messages.RepositoryViewFilterDialog_btnSelectServer);
//
getShell().setText(Messages.RepositoryViewFilterDialog_title);
//
initServerObjectFilter();
return container;
}
use of org.eclipse.jface.viewers.ICheckStateListener in project webtools.sourceediting by eclipse.
the class OutlineCustomFiltersDialog method createCheckBoxList.
private void createCheckBoxList(Composite parent) {
// Filler
new Label(parent, SWT.NONE);
Label info = new Label(parent, SWT.LEFT);
info.setText(OutlineFilterMessages.CustomFiltersDialog_filterList_label);
fCheckBoxList = CheckboxTableViewer.newCheckList(parent, SWT.BORDER);
GridData data = new GridData(GridData.FILL_BOTH);
data.heightHint = fCheckBoxList.getTable().getItemHeight() * 10;
fCheckBoxList.getTable().setLayoutData(data);
fCheckBoxList.setLabelProvider(createLabelPrivder());
fCheckBoxList.setContentProvider(new ArrayContentProvider());
Arrays.sort(fBuiltInFilters);
fCheckBoxList.setInput(fBuiltInFilters);
setInitialSelections(getEnabledFilterDescriptors());
List initialSelection = getInitialElementSelections();
if (initialSelection != null && !initialSelection.isEmpty())
checkInitialSelections();
// Description
info = new Label(parent, SWT.LEFT);
info.setText(OutlineFilterMessages.CustomFiltersDialog_description_label);
final Text description = new Text(parent, SWT.LEFT | SWT.WRAP | SWT.MULTI | SWT.READ_ONLY | SWT.BORDER | SWT.V_SCROLL);
data = new GridData(GridData.FILL_HORIZONTAL);
data.heightHint = convertHeightInCharsToPixels(3);
description.setLayoutData(data);
fCheckBoxList.addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
ISelection selection = event.getSelection();
if (selection instanceof IStructuredSelection) {
Object selectedElement = ((IStructuredSelection) selection).getFirstElement();
if (selectedElement instanceof OutlineFilterDescriptor)
description.setText(((OutlineFilterDescriptor) selectedElement).getDescription());
}
}
});
fCheckBoxList.addCheckStateListener(new ICheckStateListener() {
/*
* @see org.eclipse.jface.viewers.ICheckStateListener#checkStateChanged(org.eclipse.jface.viewers.CheckStateChangedEvent)
*/
public void checkStateChanged(CheckStateChangedEvent event) {
Object element = event.getElement();
if (element instanceof OutlineFilterDescriptor) {
// renew if already touched
if (fFilterDescriptorChangeHistory.contains(element))
fFilterDescriptorChangeHistory.remove(element);
fFilterDescriptorChangeHistory.push(element);
}
}
});
addSelectionButtons(parent);
}
use of org.eclipse.jface.viewers.ICheckStateListener in project webtools.sourceediting by eclipse.
the class CodeAssistCyclingConfigurationBlock method createDefaultPageViewer.
private void createDefaultPageViewer(Composite composite) {
fDefaultPageViewer = CheckboxTableViewer.newCheckList(composite, SWT.SINGLE | SWT.BORDER);
Table table = fDefaultPageViewer.getTable();
table.setHeaderVisible(true);
table.setLinesVisible(false);
table.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, false, false, 1, 1));
TableColumn nameColumn = new TableColumn(table, SWT.NONE);
nameColumn.setText(SSEUIMessages.CodeAssistAdvancedConfigurationBlock_default_table_category_column_title);
nameColumn.setResizable(false);
fDefaultPageViewer.addCheckStateListener(new ICheckStateListener() {
public void checkStateChanged(CheckStateChangedEvent event) {
boolean checked = event.getChecked();
ModelElement element = (ModelElement) event.getElement();
element.setShouldDisplayOnDefaultPage(checked);
}
});
fDefaultPageViewer.setContentProvider(new ArrayContentProvider());
DefaultPageTableLabelProvider labelProvider = new DefaultPageTableLabelProvider();
fDefaultPageViewer.setLabelProvider(labelProvider);
fDefaultPageViewer.setInput(fModel.defaultPageElements);
fDefaultPageViewer.setComparator(new ModelViewerComparator(fCategoryDefaultPageComparator));
final int ICON_AND_CHECKBOX_WITH = 50;
final int HEADER_MARGIN = 20;
int minNameWidth = computeWidth(table, nameColumn.getText()) + HEADER_MARGIN;
for (int i = 0; i < fModel.defaultPageElements.size(); i++) {
minNameWidth = Math.max(minNameWidth, computeWidth(table, labelProvider.getColumnText(fModel.defaultPageElements.get(i), 0)) + ICON_AND_CHECKBOX_WITH);
}
nameColumn.setWidth(minNameWidth);
table.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
handleDefaultPageTableSelection();
}
});
}
use of org.eclipse.jface.viewers.ICheckStateListener in project webtools.servertools by eclipse.
the class OverviewEditorPart method createPublishSection.
protected void createPublishSection(Composite rightColumnComp, FormToolkit toolkit) {
Section section = toolkit.createSection(rightColumnComp, ExpandableComposite.TWISTIE | ExpandableComposite.TITLE_BAR | Section.DESCRIPTION);
section.setText(Messages.serverEditorOverviewPublishSection);
section.setDescription(Messages.serverEditorOverviewPublishDescription);
section.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL));
Composite composite = toolkit.createComposite(section);
GridLayout layout = new GridLayout();
layout.numColumns = 2;
layout.marginHeight = 5;
layout.marginWidth = 10;
layout.verticalSpacing = 5;
layout.horizontalSpacing = 15;
composite.setLayout(layout);
composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL));
IWorkbenchHelpSystem whs = PlatformUI.getWorkbench().getHelpSystem();
whs.setHelp(composite, ContextIds.EDITOR_OVERVIEW_PAGE);
toolkit.paintBordersFor(composite);
section.setClient(composite);
// auto-publish
if (server != null) {
final Server svr = (Server) server;
int publishSetting = svr.getAutoPublishSetting();
GridData data = new GridData(GridData.FILL_HORIZONTAL);
autoPublishDisable = toolkit.createButton(composite, Messages.serverEditorOverviewAutoPublishDisable, SWT.RADIO);
data = new GridData(GridData.FILL_HORIZONTAL);
data.horizontalSpan = 2;
autoPublishDisable.setLayoutData(data);
autoPublishDisable.setSelection(publishSetting == Server.AUTO_PUBLISH_DISABLE);
whs.setHelp(autoPublishDisable, ContextIds.EDITOR_AUTOPUBLISH_DISABLE);
autoPublishEnableResource = toolkit.createButton(composite, Messages.serverEditorOverviewAutoPublishEnabledResource, SWT.RADIO);
autoPublishEnableResource.setSelection(publishSetting == Server.AUTO_PUBLISH_RESOURCE);
data = new GridData(GridData.FILL_HORIZONTAL);
data.horizontalSpan = 2;
autoPublishEnableResource.setLayoutData(data);
whs.setHelp(autoPublishEnableResource, ContextIds.EDITOR_AUTOPUBLISH_ENABLE);
autoPublishEnableBuild = toolkit.createButton(composite, Messages.serverEditorOverviewAutoPublishEnabledBuild, SWT.RADIO);
autoPublishEnableBuild.setSelection(publishSetting == Server.AUTO_PUBLISH_BUILD);
data = new GridData(GridData.FILL_HORIZONTAL);
data.horizontalSpan = 2;
autoPublishEnableBuild.setLayoutData(data);
whs.setHelp(autoPublishEnableBuild, ContextIds.EDITOR_AUTOPUBLISH_BUILD);
final Label autoPublishTimeLabel = createLabel(toolkit, composite, Messages.serverEditorOverviewAutoPublishEnabledInterval);
data = new GridData();
data.horizontalIndent = 20;
autoPublishTimeLabel.setLayoutData(data);
autoPublishTimeLabel.setEnabled(!autoPublishDisable.getSelection());
autoPublishTime = new Spinner(composite, SWT.BORDER);
autoPublishTime.setMinimum(0);
autoPublishTime.setIncrement(5);
autoPublishTime.setMaximum(MAX_SPINNER_TIME);
autoPublishTime.setSelection(svr.getAutoPublishTime());
data = new GridData(GridData.HORIZONTAL_ALIGN_END);
data.widthHint = SWT.DEFAULT;
autoPublishTime.setLayoutData(data);
autoPublishTime.setEnabled(!autoPublishDisable.getSelection());
SWTUtil.setSpinnerTooltip(autoPublishTime);
whs.setHelp(autoPublishTime, ContextIds.EDITOR_AUTOPUBLISH_INTERVAL);
autoPublishEnableResource.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
if (updating || !autoPublishEnableResource.getSelection())
return;
updating = true;
execute(new SetServerAutoPublishDefaultCommand(getServer(), Server.AUTO_PUBLISH_RESOURCE));
updating = false;
autoPublishTimeLabel.setEnabled(!autoPublishDisable.getSelection());
autoPublishTime.setEnabled(!autoPublishDisable.getSelection());
validate();
}
});
autoPublishEnableBuild.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
if (updating || !autoPublishEnableBuild.getSelection())
return;
updating = true;
execute(new SetServerAutoPublishDefaultCommand(getServer(), Server.AUTO_PUBLISH_BUILD));
updating = false;
autoPublishTimeLabel.setEnabled(!autoPublishDisable.getSelection());
autoPublishTime.setEnabled(!autoPublishDisable.getSelection());
validate();
}
});
autoPublishDisable.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
if (updating || !autoPublishDisable.getSelection())
return;
updating = true;
execute(new SetServerAutoPublishDefaultCommand(getServer(), Server.AUTO_PUBLISH_DISABLE));
updating = false;
autoPublishTimeLabel.setEnabled(!autoPublishDisable.getSelection());
autoPublishTime.setEnabled(!autoPublishDisable.getSelection());
validate();
}
});
autoPublishTime.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
if (updating)
return;
updating = true;
execute(new SetServerAutoPublishTimeCommand(getServer(), autoPublishTime.getSelection()));
SWTUtil.setSpinnerTooltip(autoPublishTime);
updating = false;
validate();
}
});
// publishers
Publisher[] pubs = ((Server) server).getAllPublishers();
if (pubs != null && pubs.length > 0) {
Label label = toolkit.createLabel(composite, Messages.serverEditorOverviewPublishers);
data = new GridData(GridData.FILL_HORIZONTAL);
data.horizontalSpan = 2;
label.setLayoutData(data);
publishersTable = toolkit.createTable(composite, SWT.V_SCROLL | SWT.H_SCROLL | SWT.FULL_SELECTION | SWT.CHECK);
publishersTable.setHeaderVisible(false);
publishersTable.setLinesVisible(false);
whs.setHelp(publishersTable, ContextIds.EDITOR_PUBLISHTASKS_CONFIGURATION);
data = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL);
data.horizontalSpan = 2;
data.heightHint = 80;
publishersTable.setLayoutData(data);
publishersViewer = new CheckboxTableViewer(publishersTable);
publishersViewer.setColumnProperties(new String[] { "name" });
publishersViewer.setContentProvider(new PublisherContentProvider(pubs));
publishersViewer.setLabelProvider(new PublishLabelProvider());
publishersViewer.setInput("root");
Publisher[] pubs2 = ((Server) server).getEnabledPublishers();
for (Publisher p : pubs2) publishersViewer.setChecked(p, true);
publishersViewer.addCheckStateListener(new ICheckStateListener() {
public void checkStateChanged(CheckStateChangedEvent event) {
Object element = event.getElement();
if (element == null || !(element instanceof Publisher))
return;
if (updating)
return;
updating = true;
execute(new SetPublisherEnablementCommand(getServer(), (Publisher) element, event.getChecked()));
updating = false;
}
});
}
}
}
Aggregations