use of org.eclipse.jface.viewers.CheckboxTableViewer 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;
}
});
}
}
}
use of org.eclipse.jface.viewers.CheckboxTableViewer in project tdq-studio-se by Talend.
the class TwoPartCheckSelectionDialog method createSecondPart.
// protected void checkElementChecked() {
// }
protected CheckboxTableViewer createSecondPart(Composite parent) {
CheckboxTableViewer viewer = CheckboxTableViewer.newCheckList(parent, SWT.MULTI | SWT.BORDER);
viewer.setLabelProvider(this.sLabelProvider);
viewer.setContentProvider(this.sContentProvider);
viewer.addSelectionChangedListener(this);
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).applyTo(viewer.getTable());
return viewer;
}
use of org.eclipse.jface.viewers.CheckboxTableViewer in project archi-modelrepository-plugin by archi-contribs.
the class ConflictsDialog method createTableControl.
private void createTableControl(Composite parent) {
Composite tableComp = new Composite(parent, SWT.BORDER);
TableColumnLayout tableLayout = new TableColumnLayout();
tableComp.setLayout(tableLayout);
tableComp.setLayoutData(new GridData(GridData.FILL_BOTH));
Table table = new Table(tableComp, SWT.MULTI | SWT.FULL_SELECTION | SWT.CHECK);
table.setHeaderVisible(true);
fTableViewer = new CheckboxTableViewer(table);
fTableViewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH));
fTableViewer.getTable().setLinesVisible(true);
fTableViewer.setComparator(new ViewerComparator());
// Columns
TableViewerColumn column1 = new TableViewerColumn(fTableViewer, SWT.NONE, 0);
column1.getColumn().setText(Messages.ConflictsDialog_5);
tableLayout.setColumnData(column1.getColumn(), new ColumnWeightData(100, true));
// Content Provider
fTableViewer.setContentProvider(new IStructuredContentProvider() {
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
}
public void dispose() {
}
public Object[] getElements(Object inputElement) {
MergeResult result = fHandler.getMergeResult();
return result.getConflicts().keySet().toArray();
}
});
fTableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
String path = (String) ((StructuredSelection) event.getSelection()).getFirstElement();
try {
fFileViewerOurs.setText(fHandler.getArchiRepository().getFileContents(path, IGraficoConstants.HEAD));
fFileViewerTheirs.setText(fHandler.getArchiRepository().getFileContents(path, IGraficoConstants.ORIGIN_MASTER));
fFileViewerDiff.setText(fHandler.getArchiRepository().getWorkingTreeFileContents(path));
} catch (IOException ex) {
ex.printStackTrace();
}
}
});
// Label Provider
fTableViewer.setLabelProvider(new LabelProvider());
// Start the table
// anything will do //$NON-NLS-1$
fTableViewer.setInput("");
}
use of org.eclipse.jface.viewers.CheckboxTableViewer in project jbosstools-hibernate by jbosstools.
the class UpDownListComposite method createTable.
/**
* This method initializes table
*/
private void createTable() {
GridData gridData1 = new org.eclipse.swt.layout.GridData();
gridData1.horizontalAlignment = org.eclipse.swt.layout.GridData.FILL;
gridData1.grabExcessHorizontalSpace = true;
gridData1.grabExcessVerticalSpace = true;
gridData1.verticalAlignment = org.eclipse.swt.layout.GridData.FILL;
gridData1.heightHint = 20;
gridData1.widthHint = 20;
table = new Table(group, SWT.FULL_SELECTION | SWT.BORDER | SWT.MULTI | (checkboxInTable ? SWT.CHECK : SWT.NONE));
table.setHeaderVisible(false);
table.setLayoutData(gridData1);
table.setLinesVisible(false);
createColumns(table);
table.addSelectionListener(new SelectionListener() {
public void widgetDefaultSelected(SelectionEvent e) {
handleTableSelectionChanged();
}
public void widgetSelected(SelectionEvent e) {
handleTableSelectionChanged();
}
});
tableView = checkboxInTable ? new CheckboxTableViewer(table) : new TableViewer(table);
if (provider != null)
tableView.setLabelProvider(provider);
if (contentProvider != null)
tableView.setContentProvider(contentProvider);
}
use of org.eclipse.jface.viewers.CheckboxTableViewer in project portfolio by buchen.
the class FilePickerDialog method createDialogArea.
@Override
protected Control createDialogArea(Composite parent) {
Composite composite = (Composite) super.createDialogArea(parent);
Composite container = new Composite(composite, SWT.None);
GridDataFactory.fillDefaults().grab(true, true).hint(400, 300).applyTo(container);
GridLayoutFactory.fillDefaults().numColumns(1).applyTo(container);
Label label = new Label(container, SWT.None);
label.setText(Messages.SaveHandlerTitle);
GridDataFactory.fillDefaults().grab(true, false).applyTo(label);
Composite tableArea = new Composite(container, SWT.NONE);
GridDataFactory.fillDefaults().grab(false, true).applyTo(tableArea);
tableArea.setLayout(new FillLayout());
TableColumnLayout layout = new TableColumnLayout();
tableArea.setLayout(layout);
Table table = new Table(tableArea, SWT.BORDER | SWT.CHECK | SWT.MULTI);
tableViewer = new CheckboxTableViewer(table);
table.setHeaderVisible(false);
table.setLinesVisible(false);
TableViewerColumn column = new TableViewerColumn(tableViewer, SWT.None);
layout.setColumnData(column.getColumn(), new ColumnWeightData(100));
tableViewer.setLabelProvider(labelProvider);
tableViewer.setContentProvider(ArrayContentProvider.getInstance());
tableViewer.setInput(elements);
tableViewer.setCheckedElements(elements);
tableViewer.setComparator(new ViewerComparator());
hookListener();
return composite;
}
Aggregations