use of org.eclipse.jface.viewers.ICheckStateListener in project eclipse.platform.text by eclipse.
the class SelectResourcesDialog method createDialogArea.
@Override
protected Control createDialogArea(Composite parent) {
Composite composite = (Composite) super.createDialogArea(parent);
Label label = new Label(composite, SWT.LEFT);
label.setText(fInstruction);
label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
fResourceGroup = new SelectResourcesBlock(composite, ResourcesPlugin.getWorkspace().getRoot(), getResourceProvider(IResource.FOLDER | IResource.PROJECT), WorkbenchLabelProvider.getDecoratingWorkbenchLabelProvider(), getResourceProvider(IResource.FILE), WorkbenchLabelProvider.getDecoratingWorkbenchLabelProvider(), SWT.NONE, useHeightHint(parent));
fResourceGroup.addCheckStateListener(new ICheckStateListener() {
@Override
public void checkStateChanged(CheckStateChangedEvent event) {
updateSelectionCount();
}
});
fCountIndication = new Label(composite, SWT.LEFT);
fCountIndication.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
createSelectionButtonGroup(composite);
setInitialSelection();
return composite;
}
use of org.eclipse.jface.viewers.ICheckStateListener in project erlide_eclipse by erlang.
the class ErlangWizardResourceImportPage method createFileSelectionGroup.
/**
* Create the import source selection widget
*/
protected void createFileSelectionGroup(final Composite parent) {
// Just create with a dummy root.
selectionGroup = new ResourceTreeAndListGroup(parent, // $NON-NLS-1$
new FileSystemElement("Dummy", null, true), getFolderProvider(), new WorkbenchLabelProvider(), getFileProvider(), new WorkbenchLabelProvider(), SWT.NONE, DialogUtil.inRegularFontMode(parent));
final ICheckStateListener listener = new ICheckStateListener() {
@Override
public void checkStateChanged(final CheckStateChangedEvent event) {
updateWidgetEnablements();
}
};
final WorkbenchViewerComparator comparator = new WorkbenchViewerComparator();
selectionGroup.setTreeComparator(comparator);
selectionGroup.setListComparator(comparator);
selectionGroup.addCheckStateListener(listener);
}
use of org.eclipse.jface.viewers.ICheckStateListener 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.ICheckStateListener 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.ICheckStateListener 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();
}
Aggregations