use of org.eclipse.jface.viewers.CheckStateChangedEvent in project erlide_eclipse by erlang.
the class ErlangMainTab method createProjectsGroup.
/**
* @param comp
*/
private void createProjectsGroup(final Composite comp) {
final Group projectsGroup = SWTUtil.createGroup(comp, "Projects", 2, GridData.FILL_HORIZONTAL);
projectsTable = CheckboxTableViewer.newCheckList(projectsGroup, SWT.HIDE_SELECTION | SWT.BORDER);
projectsTable.setLabelProvider(new ProjectsLabelProvider());
projectsTable.setContentProvider(new ProjectsContentProvider());
final Table table_1 = projectsTable.getTable();
final GridData gd_table_1 = new GridData(SWT.LEFT, SWT.FILL, true, true);
gd_table_1.widthHint = 287;
gd_table_1.heightHint = 126;
gd_table_1.minimumHeight = 108;
gd_table_1.minimumWidth = 256;
table_1.setLayoutData(gd_table_1);
projectsTable.addCheckStateListener(new ICheckStateListener() {
@Override
@SuppressWarnings("synthetic-access")
public void checkStateChanged(final CheckStateChangedEvent event) {
updateLaunchConfigurationDialog();
}
});
}
use of org.eclipse.jface.viewers.CheckStateChangedEvent in project erlide_eclipse by erlang.
the class RuntimePreferencePage method createMyControl.
private Control createMyControl(final Composite ancestor) {
final Composite parent = new Composite(ancestor, SWT.NULL);
GridLayout layout = new GridLayout();
layout.numColumns = 2;
layout.marginHeight = 0;
layout.marginWidth = 0;
parent.setLayout(layout);
final Font font = ancestor.getFont();
parent.setFont(font);
GridData data;
final Composite composite = new Composite(parent, SWT.NONE);
composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
final GridLayout gridLayout = new GridLayout();
gridLayout.numColumns = 2;
composite.setLayout(gridLayout);
final Label erlideLabel = new Label(composite, SWT.NONE);
erlideLabel.setToolTipText("The erlide runtime is used for IDE purposes, not for running project code. " + "It is the most recent stable version that is installed.");
final String erlideName = erlideRuntime == null ? "none" : erlideRuntime.getName();
erlideLabel.setText(RuntimePreferenceMessages.RuntimePreferencePage_erlideLabel_text + " " + erlideName);
new Label(composite, SWT.NONE);
new Label(parent, SWT.NONE);
final Label tableLabel = new Label(parent, SWT.NONE);
tableLabel.setText("Installed runtimes:");
data = new GridData();
data.horizontalSpan = 2;
tableLabel.setLayoutData(data);
tableLabel.setFont(font);
final Table table = new Table(parent, SWT.CHECK | SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION);
table.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(final SelectionEvent e) {
if (e.detail == SWT.CHECK) {
final RuntimeInfo ri = (RuntimeInfo) e.item.getData();
defaultRuntime = ri;
}
}
});
data = new GridData(SWT.FILL, SWT.FILL, true, true);
data.widthHint = 403;
table.setLayoutData(data);
table.setFont(font);
table.setHeaderVisible(true);
table.setLinesVisible(true);
final TableLayout tableLayout = new TableLayout();
table.setLayout(tableLayout);
final TableColumn column1 = new TableColumn(table, SWT.NULL);
column1.setWidth(80);
column1.setText(RuntimePreferenceMessages.name);
column1.setResizable(true);
column1.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(final SelectionEvent e) {
sortByName();
}
});
final TableColumn column2 = new TableColumn(table, SWT.NULL);
column2.setWidth(150);
column2.setText("Directory");
column2.setResizable(true);
column2.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(final SelectionEvent e) {
sortByDirectory();
}
});
final TableColumn column3 = new TableColumn(table, SWT.NULL);
column3.setWidth(80);
column3.setText("Version");
column3.setResizable(false);
fRuntimeList = new CheckboxTableViewer(table);
fRuntimeList.setLabelProvider(new RuntimeLabelProvider());
fRuntimeList.setContentProvider(new RuntimeContentProvider());
fRuntimeList.setInput(runtimes);
if (defaultRuntime == null || defaultRuntime == RuntimeInfo.NO_RUNTIME_INFO) {
defaultRuntime = RuntimeCore.getRuntimeInfoCatalog().getDefaultRuntime();
}
if (defaultRuntime != null) {
fRuntimeList.setCheckedElements(new Object[] { defaultRuntime });
}
// by default, sort by name
sortByName();
fRuntimeList.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(final SelectionChangedEvent evt) {
enableButtons();
}
});
fRuntimeList.addCheckStateListener(new ICheckStateListener() {
@Override
public void checkStateChanged(final CheckStateChangedEvent event) {
if (event.getChecked()) {
setCheckedRuntime((RuntimeInfo) event.getElement());
} else {
setCheckedRuntime(null);
}
}
});
fRuntimeList.addDoubleClickListener(new IDoubleClickListener() {
@Override
public void doubleClick(final DoubleClickEvent e) {
if (!fRuntimeList.getSelection().isEmpty()) {
editRuntime();
}
}
});
table.addKeyListener(new KeyAdapter() {
@Override
public void keyPressed(final KeyEvent event) {
if (event.character == SWT.DEL && event.stateMask == 0) {
removeSelectedRuntimes();
}
}
});
final Composite buttons = new Composite(parent, SWT.NULL);
buttons.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING));
layout = new GridLayout();
layout.marginHeight = 0;
layout.marginWidth = 0;
buttons.setLayout(layout);
buttons.setFont(font);
fAddButton = createPushButton(buttons, RuntimePreferenceMessages.add);
fAddButton.addListener(SWT.Selection, new Listener() {
@Override
public void handleEvent(final Event evt) {
addRuntime();
}
});
fEditButton = createPushButton(buttons, RuntimePreferenceMessages.edit);
fEditButton.addListener(SWT.Selection, new Listener() {
@Override
public void handleEvent(final Event evt) {
editRuntime();
}
});
fDuplicateButton = createPushButton(buttons, RuntimePreferenceMessages.duplicate);
fDuplicateButton.addListener(SWT.Selection, new Listener() {
@Override
public void handleEvent(final Event evt) {
duplicateRuntime();
}
});
fRemoveButton = createPushButton(buttons, RuntimePreferenceMessages.remove);
fRemoveButton.addListener(SWT.Selection, new Listener() {
@Override
public void handleEvent(final Event evt) {
removeSelectedRuntimes();
}
});
fDetectButton = createPushButton(buttons, RuntimePreferenceMessages.detect);
fDetectButton.addListener(SWT.Selection, new Listener() {
@Override
public void handleEvent(final Event evt) {
detectRuntimes();
}
});
configureTableResizing(parent, buttons, table, column1, column2, column3);
enableButtons();
return parent;
}
use of org.eclipse.jface.viewers.CheckStateChangedEvent in project tmdm-studio-se by Talend.
the class RepositoryViewObjectCheckedWidget method initWidget.
private void initWidget() {
//
setLayout(new GridLayout());
treeViewer = new ContainerCheckedTreeViewer(this, SWT.BORDER | SWT.FULL_SELECTION);
Tree tree = getTree();
tree.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
installColumns();
treeViewer.setContentProvider(new ContentProvider());
treeViewer.getTree().addListener(SWT.PaintItem, new Listener() {
public void handleEvent(Event event) {
TreeItem item = (TreeItem) event.item;
Object data = item.getData();
if (data != null && lockedViewObjs.contains(data)) {
String text = item.getText(event.index);
Point point = event.gc.textExtent(text);
int y = event.y + point.y / 2 + 2;
int x = event.x + 20;
event.gc.drawLine(x, y, x + point.x, y);
event.gc.drawText(Messages.RepositoryViewObjectCheckedWidget_lock, x + point.x + 2, event.y + 2);
}
}
});
treeViewer.addCheckStateListener(new ICheckStateListener() {
private void checkSubElement(IRepositoryViewObject viewObj) {
if (viewObj instanceof FolderRepositoryObject) {
Item item = viewObj.getProperty().getItem();
List<IRepositoryViewObject> children = RepositoryResourceUtil.findViewObjects(viewObj.getRepositoryObjectType(), item, true, true);
if (children != null) {
for (IRepositoryViewObject child : children) {
checkSubElement(child);
}
}
} else {
if (lockedViewObjs.contains(viewObj)) {
treeViewer.setChecked(viewObj, false);
}
}
}
public void checkStateChanged(CheckStateChangedEvent event) {
Object element = event.getElement();
if (element instanceof IRepositoryViewObject) {
checkSubElement((IRepositoryViewObject) element);
}
}
});
if (adapter != null) {
treeViewer.addCheckStateListener(new ICheckStateListener() {
public void checkStateChanged(CheckStateChangedEvent event) {
updateSeverityCount();
}
});
}
treeViewer.addFilter(new ViewerFilter() {
private boolean containVisibleElement(FolderRepositoryObject parent) {
Item item = parent.getProperty().getItem();
List<IRepositoryViewObject> children = RepositoryResourceUtil.findViewObjects(parent.getRepositoryObjectType(), item, true, true);
boolean result = false;
for (IRepositoryViewObject viewObj : children) {
if (viewObj instanceof FolderRepositoryObject) {
boolean r = containVisibleElement((FolderRepositoryObject) viewObj);
if (r) {
result = true;
}
} else if (viewObj instanceof IRepositoryViewObject) {
if (isVisibleViewObj(viewObj)) {
updateServerDef(viewObj);
// updateLockedObject(viewObj);
result = true;
}
}
}
return result;
}
@Override
public boolean select(Viewer viewer, Object parentElement, Object element) {
if (reconciliation) {
return true;
} else {
if (element instanceof FolderRepositoryObject) {
return containVisibleElement((FolderRepositoryObject) element);
} else {
IRepositoryViewObject viewObj = (IRepositoryViewObject) element;
return isVisibleViewObj(viewObj);
}
}
}
});
// show time
final Button showTimestampBun = new Button(this, SWT.CHECK);
showTimestampBun.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
showTimeStampColumns(showTimestampBun.getSelection());
}
});
showTimestampBun.setText(Messages.ConsistencyConflict_showTimeStampColumn);
//
treeViewer.setInput(input);
selectAll(true);
treeViewer.expandAll();
if (adapter != null) {
adapter.initSeverityControl(this);
}
updateSeverityCount();
}
use of org.eclipse.jface.viewers.CheckStateChangedEvent in project jbosstools-hibernate by jbosstools.
the class ExporterSettingsTab method createOldExporterTable.
// currently unused functionality
@SuppressWarnings("unused")
private void createOldExporterTable(Composite parent) {
Composite exporterOptions = createComposite(parent, HibernateConsoleMessages.ExporterSettingsTab_exporters);
GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
gd.minimumHeight = 100;
exporterOptions.setLayoutData(gd);
exporterOptions.setLayout(new GridLayout(2, false));
Table table = new Table(exporterOptions, SWT.CHECK | SWT.BORDER | SWT.V_SCROLL);
// setExporterTable(new CheckboxTableViewer( table ));
getExporterTable().setContentProvider(new ExporterContentProvider());
getExporterTable().setLabelProvider(new ExporterLabelProvider());
// exporterTable.getControl().setLayoutData(
// new GridData( SWT.FILL, SWT.FILL, true, true ) );
// $NON-NLS-1$
getExporterTable().setColumnProperties(new String[] { "", HibernateConsoleMessages.ExporterSettingsTab_description });
getExporterTable().addCheckStateListener(new ICheckStateListener() {
public void checkStateChanged(CheckStateChangedEvent event) {
ExporterFactory factory = (ExporterFactory) event.getElement();
if (!event.getChecked() && selectedExporters.contains(factory)) {
selectedExporters.remove(factory);
} else if (event.getChecked() && !selectedExporters.contains(factory)) {
selectedExporters.add(factory);
}
dialogChanged();
}
});
gd = new GridData(SWT.FILL, SWT.FILL, true, true);
gd.verticalSpan = 2;
gd.horizontalSpan = 1;
table.setLayoutData(gd);
selectAll = new Button(exporterOptions, SWT.PUSH);
selectAll.setText(HibernateConsoleMessages.ExporterSettingsTab_select_all);
selectAll.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
getExporterTable().setAllChecked(true);
dialogChanged();
}
});
gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_BEGINNING);
gd.horizontalIndent = 5;
selectAll.setLayoutData(gd);
deselectAll = new Button(exporterOptions, SWT.PUSH);
deselectAll.setText(HibernateConsoleMessages.ExporterSettingsTab_deselect_all);
deselectAll.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
getExporterTable().setAllChecked(false);
dialogChanged();
}
});
gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_BEGINNING);
gd.horizontalIndent = 5;
deselectAll.setLayoutData(gd);
}
use of org.eclipse.jface.viewers.CheckStateChangedEvent in project eclipse-cs by checkstyle.
the class ComplexFileSetsEditor method createContents.
/**
* {@inheritDoc}
*/
@Override
public Control createContents(Composite parent) throws CheckstylePluginException {
mComposite = parent;
Group composite = new Group(parent, SWT.NONE);
composite.setText(Messages.ComplexFileSetsEditor_titleAdvancedFilesetEditor);
GridLayout layout = new GridLayout();
layout.numColumns = 2;
composite.setLayout(layout);
//
// Create the table of file sets.
//
Table table = new Table(composite, SWT.CHECK | SWT.BORDER | SWT.FULL_SELECTION);
GridData data = new GridData(GridData.FILL_BOTH);
table.setLayoutData(data);
table.setHeaderVisible(true);
table.setLinesVisible(true);
TableLayout tableLayout = new TableLayout();
table.setLayout(tableLayout);
TableColumn column1 = new TableColumn(table, SWT.NONE);
column1.setText(Messages.ComplexFileSetsEditor_colEnabled);
column1.setResizable(false);
TableColumn column2 = new TableColumn(table, SWT.NONE);
column2.setText(Messages.ComplexFileSetsEditor_colFilesetName);
TableColumn column3 = new TableColumn(table, SWT.NONE);
column3.setText(Messages.ComplexFileSetsEditor_colConfiguration);
tableLayout.addColumnData(new ColumnWeightData(20));
tableLayout.addColumnData(new ColumnWeightData(40));
tableLayout.addColumnData(new ColumnWeightData(40));
mViewer = new CheckboxTableViewer(table);
mViewer.setLabelProvider(new FileSetLabelProvider());
mViewer.setContentProvider(new ArrayContentProvider());
mViewer.setComparator(new FileSetViewerSorter());
mViewer.setInput(mFileSets);
//
for (FileSet fileSet : mFileSets) {
mViewer.setChecked(fileSet, fileSet.isEnabled());
}
mViewer.addDoubleClickListener(new IDoubleClickListener() {
@Override
public void doubleClick(DoubleClickEvent e) {
editFileSet();
}
});
mViewer.addCheckStateListener(new ICheckStateListener() {
@Override
public void checkStateChanged(CheckStateChangedEvent event) {
changeEnabledState(event);
}
});
//
// Build the buttons.
//
Composite buttons = new Composite(composite, SWT.NULL);
buttons.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING));
layout = new GridLayout();
layout.marginHeight = 0;
layout.marginWidth = 0;
buttons.setLayout(layout);
mAddButton = createPushButton(buttons, Messages.ComplexFileSetsEditor_btnAdd);
mAddButton.addListener(SWT.Selection, new Listener() {
@Override
public void handleEvent(Event evt) {
addFileSet();
}
});
mEditButton = createPushButton(buttons, Messages.ComplexFileSetsEditor_btnEdit);
mEditButton.addListener(SWT.Selection, new Listener() {
@Override
public void handleEvent(Event evt) {
editFileSet();
}
});
mRemoveButton = createPushButton(buttons, Messages.ComplexFileSetsEditor_btnRemove);
mRemoveButton.addListener(SWT.Selection, new Listener() {
@Override
public void handleEvent(Event evt) {
removeFileSet();
}
});
return composite;
}
Aggregations