List of usage examples for org.eclipse.jface.viewers ICheckable addCheckStateListener
public void addCheckStateListener(ICheckStateListener listener);
From source file:com.microsoft.tfs.client.common.ui.framework.helper.CheckedElements.java
License:Open Source License
public CheckedElements(final ICheckable checkable) { this.checkable = checkable; checkable.addCheckStateListener(new CheckStateListener()); }
From source file:com.nokia.carbide.cpp.internal.project.ui.editors.common.ControlHandler.java
License:Open Source License
protected ControlHandler(final Control control, final StructuredViewer viewer, IValidator validator, boolean caseSensitive) { Check.checkState(getHandlerForControl(control) == null); this.control = control; this.viewer = viewer; this.validator = validator; this.viewerCaseSensitive = caseSensitive; swtListener = new Listener() { public void handleEvent(Event event) { switch (event.type) { case SWT.Modify: if (!updatingControl) { textModified();//from w w w .j a v a 2s. c om } break; case SWT.Selection: if (!updatingControl) { controlSelected(); } break; case SWT.Dispose: control.setData(DATA_KEY, null); break; case SWT.FocusIn: controlFocused(); break; } } }; control.addListener(SWT.Modify, swtListener); control.addListener(SWT.Selection, swtListener); control.addListener(SWT.Dispose, swtListener); control.addListener(SWT.FocusIn, swtListener); if (viewer instanceof ICheckable) { checkStateListener = new ICheckStateListener() { public void checkStateChanged(CheckStateChangedEvent event) { ControlHandler.this.checkStateChanged(event.getElement(), event.getChecked()); } }; ICheckable checkable = (ICheckable) viewer; checkable.addCheckStateListener(checkStateListener); } control.setData(DATA_KEY, this); Check.checkState(getHandlerForControl(control) == this); }
From source file:com.nokia.carbide.cpp.uiq.ui.vieweditor.ControlHandlerCommands.java
License:Open Source License
protected ControlHandlerCommands(final Control control, final StructuredViewer viewer, IValidator validator, boolean caseSensitive) { Check.checkState(getHandlerForControl(control) == null); this.control = control; this.viewer = viewer; this.validator = validator; this.viewerCaseSensitive = caseSensitive; swtListener = new Listener() { public void handleEvent(Event event) { switch (event.type) { case SWT.Modify: if (!updatingControl) { textModified();// w w w. j a va 2 s. co m } break; case SWT.Selection: if (!updatingControl) { controlSelected(); } break; case SWT.Dispose: control.setData(DATA_KEY, null); break; case SWT.FocusIn: controlFocused(); break; } } }; control.addListener(SWT.Modify, swtListener); control.addListener(SWT.Selection, swtListener); control.addListener(SWT.Dispose, swtListener); control.addListener(SWT.FocusIn, swtListener); if (viewer instanceof ICheckable) { checkStateListener = new ICheckStateListener() { public void checkStateChanged(CheckStateChangedEvent event) { ControlHandlerCommands.this.checkStateChanged(event.getElement(), event.getChecked()); } }; ICheckable checkable = (ICheckable) viewer; checkable.addCheckStateListener(checkStateListener); } control.setData(DATA_KEY, this); Check.checkState(getHandlerForControl(control) == this); }
From source file:org.eclipse.e4.tools.ui.designer.wizards.part.PropertiesContentProvider.java
License:Open Source License
private void adapt() { if (listener == null) { listener = new ICheckStateListener() { public void checkStateChanged(CheckStateChangedEvent event) { recordAll();/*from w w w.j a v a 2 s . co m*/ } }; } if (viewer instanceof ICheckable) { ICheckable checkable = (ICheckable) viewer; checkable.removeCheckStateListener(listener); checkable.addCheckStateListener(listener); } }
From source file:org.eclipse.ptp.internal.rm.jaxb.control.ui.model.ViewerUpdateModel.java
License:Open Source License
/** * @param name//from w ww. j a v a 2s . c o m * An arbitrary name given to the viewer; the viewer string output (produced from the pattern template) will be * stored in the environment as the value of this name, and thus can be referenced by other widget models. * @param initialAllChecked * default setting for all is checked; else all unchecked * @param handler * the handler for notifying other widgets to refresh their values * @param viewer * the checkable viewer the object models * @param template * JAXB data element defining a pattern by which to process the name-value pairs associated with the items of the * viewer into a single output string */ public ViewerUpdateModel(String name, boolean initialAllChecked, IUpdateHandler handler, ICheckable viewer, TemplateType template) { super(name, handler); this.viewer = viewer; this.columnViewer = (ColumnViewer) viewer; this.initialAllChecked = initialAllChecked; String s = null; if (template == null) { pattern = null; } else { pattern = template.getPattern(); s = template.getSeparator(); } separator = s == null ? JAXBControlUIConstants.ZEROSTR : s; checked = new StringBuffer(); templatedValue = new StringBuffer(); viewer.addCheckStateListener(this); }
From source file:org.eclipse.ptp.rm.jaxb.control.ui.model.ViewerUpdateModel.java
License:Open Source License
/** * @param name//from ww w . j a va2 s . c o m * An arbitrary name given to the viewer; the viewer string * output (produced from the pattern template) will be stored in * the environment as the value of this name, and thus can be * referenced by other widget models. * @param initialAllChecked * default setting for all is checked; else all unchecked * @param handler * the handler for notifying other widgets to refresh their * values * @param viewer * the checkable viewer the object models * @param template * JAXB data element defining a pattern by which to process the * name-value pairs associated with the items of the viewer into * a single output string */ public ViewerUpdateModel(String name, boolean initialAllChecked, ValueUpdateHandler handler, ICheckable viewer, TemplateType template) { super(name, handler); this.viewer = viewer; this.columnViewer = (ColumnViewer) viewer; this.initialAllChecked = initialAllChecked; String s = null; if (template == null) { pattern = null; } else { pattern = template.getPattern(); s = template.getSeparator(); } separator = s == null ? JAXBControlUIConstants.ZEROSTR : s; checked = new StringBuffer(); templatedValue = new StringBuffer(); viewer.addCheckStateListener(this); }