List of usage examples for org.eclipse.jface.util Assert isNotNull
public static void isNotNull(Object object)
null. From source file:at.spardat.xma.guidesign.presentation.dialog.formdata.AttachCenterGroup.java
License:Open Source License
/** * set data of the corresponding XMAForAttachment to the GUI widgets * @param group that is set (left, top, right, bottom) * @param formAttach holds the actual values *///from w w w. j a v a 2 s. c o m public void setControls(Object _formAttach) { formAttach = (XMAFormAttachment) _formAttach; if (formAttach != null) { //some values in the attach group widget exists butAttach.setSelection(true); texOffset.setText(Integer.toString(formAttach.getQntOffset())); if (formAttach.getAttachElement() != null && !formAttach.isDirty() && //formattach contains danglig ref's to widgets isWidgetAttachable()) { //attachment is a widget attachment butWidgetAttach.setSelection(true); Assert.isNotNull(formAttach.getCodAttachSide()); AttachSide attside = AttachSide.getInstance(); if (formAttach.getCodAttachSide().equals(AttachSideType.CENTER_LITERAL)) { setState(CENTRAL_ATTACHABLE); cmbAttach.setText(attside.getAttachSide(formAttach.getCodAttachSide())); } else { setState(WIDGET_ATTACHABLE); cmbAttach.setText(cmbAttach.getItem(attside.getCmbAttachDefaultValue())); } cmbSide.setText(attside.getAttachSide(formAttach.getCodAttachSide())); if (formAttach.getAttachElement() != null && attachableWidgets.getAttachedWidgetString(formAttach.getAttachElement()) != null) { cmbWidget.setText(attachableWidgets.getAttachedWidgetString(formAttach.getAttachElement())); } } else if (formAttach.getAttachElement() == null) { //attachment is a parent attachment setState(PARENT_ATTACHABLE); butParentAttach.setSelection(true); Assert.isTrue(formAttach.getQntDenominator() >= formAttach.getQntNominator()); MyFractionNum fract = new MyFractionNum(formAttach.getQntNominator(), formAttach.getQntDenominator()); texAttach.setText(fract.getFractionasFloatString()); } else { // in this case attachment is a NON_WIDGET_ATTACHABLE setState(PARENT_ATTACHABLE); } } else { // no attachment available setState(EMPTY); texOffset.setText("0"); } gray(); }
From source file:at.spardat.xma.guidesign.presentation.dialog.formdata.AttachNonEditableGroup.java
License:Open Source License
/** * set data of the corresponding XMAForAttachment to the GUI widgets * @param group that is set (left, top, right, bottom) * @param formAttach holds the actual values *//*from w ww .j a va 2 s .c om*/ public void setControls(Object _formAttach) { formAttach = (XMAFormAttachment) _formAttach; if (formAttach != null) { //some values in the attach group widget exists butAttach.setSelection(true); texOffset.setText(Integer.toString(formAttach.getQntOffset())); if (formAttach.getAttachElement() != null && !formAttach.isDirty() && //formattach contains danglig ref's to widgets isWidgetAttachable()) { //attachment is a widget attachment butWidgetAttach.setSelection(true); Assert.isNotNull(formAttach.getCodAttachSide()); setState(WIDGET_ATTACHABLE); cmbSide.setText(AttachSide.getInstance().getAttachSide(formAttach.getCodAttachSide())); if (formAttach.getAttachElement() != null && attachableWidgets.getAttachedWidgetString(formAttach.getAttachElement()) != null) { cmbWidget.setText(attachableWidgets.getAttachedWidgetString(formAttach.getAttachElement())); } } else if (formAttach.getAttachElement() == null) { //attachment is a parent attachment setState(PARENT_ATTACHABLE); butParentAttach.setSelection(true); Assert.isTrue(formAttach.getQntDenominator() >= formAttach.getQntNominator()); MyFractionNum fract = new MyFractionNum(formAttach.getQntNominator(), formAttach.getQntDenominator()); texAttach.setText(fract.getFractionasFloatString()); } else { // in this case attachment is a NON_WIDGET_ATTACHABLE setState(PARENT_ATTACHABLE); } } else { // no attachment available setState(EMPTY); texOffset.setText("0"); } gray(); }
From source file:at.spardat.xma.guidesign.presentation.dialog.multiwidformdata.AttachCenterGroup.java
License:Open Source License
/** * set data of the corresponding XMAForAttachment to the GUI widgets * @param group that is set (left, top, right, bottom) * @param formAttach holds the actual values */// ww w .j a va2 s . co m public void setControls(Object _formAttach) { formAttach = (MultiXMAFormAttachmentAdapter) _formAttach; if (!formAttach.onlyNullAttachMapped()) { //some values in the attach group widget exists butAttach.setSelection(true); AttachSide attside = MultiAttachSide.getInstance(); texOffset.setText(formAttach.getQntOffsetStr()); if (formAttach.getAttachElement() != null && !formAttach.isDirty() && //formattach contains danglig ref's to widgets isWidgetAttachable()) { //attachment is a widget attachment butWidgetAttach.setSelection(true); Assert.isNotNull(formAttach.getCodAttachSide()); if (formAttach.getCodAttachSide().equals(MultiXMAFormAttachmentAdapter.MULTI_ATT_SIDE) || formAttach.getCodAttachSide().equals(AttachSideType.CENTER_LITERAL)) { setState(CENTRAL_ATTACHABLE); cmbAttach.setText(attside.getAttachSide(formAttach.getCodAttachSide())); } else { setState(WIDGET_ATTACHABLE); cmbAttach.setText(cmbAttach.getItem(attside.getCmbAttachDefaultValue())); } cmbSide.setText(attside.getAttachSide(formAttach.getCodAttachSide())); if (formAttach.getAttachElement() != null && attachableWidgets.getAttachedWidgetString(formAttach.getAttachElement()) != null) { cmbWidget.setText(attachableWidgets.getAttachedWidgetString(formAttach.getAttachElement())); } } else if (formAttach.getAttachElement() == null) { //attachment is a parent attachment setState(PARENT_ATTACHABLE); butParentAttach.setSelection(true); texAttach.setText(formAttach.getParentPercent()); } else { // in this case attachment is a NON_WIDGET_ATTACHABLE setState(PARENT_ATTACHABLE); } } else { // no attachment available setState(EMPTY); texOffset.setText("0"); } gray(); }
From source file:at.spardat.xma.guidesign.presentation.dialog.multiwidformdata.AttachNonEditableGroup.java
License:Open Source License
/** * set data of the corresponding XMAForAttachment to the GUI widgets * @param group that is set (left, top, right, bottom) * @param formAttach holds the actual values *//*from w w w. j a v a 2s.c o m*/ public void setControls(Object _formAttach) { formAttach = (MultiXMAFormAttachmentAdapter) _formAttach; if (!formAttach.onlyNullAttachMapped()) { //some values in the attach group widget exists butAttach.setSelection(true); texOffset.setText(formAttach.getQntOffsetStr()); if (formAttach.getAttachElement() != null && !formAttach.isDirty() && //formattach contains danglig ref's to widgets isWidgetAttachable()) { //attachment is a widget attachment butWidgetAttach.setSelection(true); Assert.isNotNull(formAttach.getCodAttachSide()); setState(WIDGET_ATTACHABLE); cmbSide.setText(MultiAttachSide.getInstance().getAttachSide(formAttach.getCodAttachSide())); if (formAttach.getAttachElement() != null && attachableWidgets.getAttachedWidgetString(formAttach.getAttachElement()) != null) { cmbWidget.setText(attachableWidgets.getAttachedWidgetString(formAttach.getAttachElement())); } } else if (formAttach.getAttachElement() == null) { //attachment is a parent attachment setState(PARENT_ATTACHABLE); butParentAttach.setSelection(true); texAttach.setText(formAttach.getParentPercent()); } else { // in this case attachment is a NON_WIDGET_ATTACHABLE setState(PARENT_ATTACHABLE); } } else { // no attachment available setState(EMPTY); texOffset.setText("0"); } gray(); }
From source file:at.spardat.xma.guidesign.presentation.UIPreviewer.java
License:Open Source License
/** * create the formdata of the widgets in the adjacent control table. * *///from w ww . j ava 2s. c o m private void setFormData() { Collection contColl = adjControls.values(); if (!contColl.isEmpty()) { Iterator i = contColl.iterator(); while (i.hasNext()) { Control c = (Control) i.next(); XMAWidget w = (XMAWidget) c.getData(); Assert.isNotNull(w); w.createLayoutInfo(c, adjControls); } } //debug(getControlsAsString(adjControls)); }
From source file:at.spardat.xma.guidesign.presentation.UIPreviewer.java
License:Open Source License
private String getControlsAsString(MyHashlist controls) { StringBuffer result = new StringBuffer(1024); Collection contColl = controls.values(); if (!contColl.isEmpty()) { Iterator i = contColl.iterator(); int j = 0; while (i.hasNext()) { Control cont = (Control) i.next(); Assert.isNotNull(cont); if (cont.getData() instanceof XMAComposite) result.append("----------------- Composite ---------------\n"); result.append("control "); result.append(new Integer(j++).toString()); result.append(" "); result.append(cont.getData().toString()); result.append("\n"); FormData data = (FormData) cont.getLayoutData(); if (data != null) { result.append("fdata: "); result.append(data.toString()); result.append("\n"); if (data.top != null) { result.append("topAttach: "); result.append(data.top.toString()); result.append("\n"); }/*from w w w . j a va 2s .co m*/ if (data.bottom != null) { result.append("bottomAttach: "); result.append(data.bottom.toString()); result.append("\n"); } if (data.left != null) { result.append("leftAttach: "); result.append(data.left.toString()); result.append("\n"); } if (data.right != null) { result.append("rightAttach: "); result.append(data.right.toString()); result.append("\n"); } } } } return result.toString(); }
From source file:au.gov.ansto.bragg.kakadu.ui.widget.CheckboxTableTreeViewer.java
License:Open Source License
public boolean setChecked(Object element, boolean state) { Assert.isNotNull(element); Widget widget = findItem(element);/* ww w .j ava 2 s . c o m*/ if (widget != null && widget instanceof TableTreeItem) { TableTreeItem tableTreeItem = (TableTreeItem) widget; setChecked(tableTreeItem, state); return true; } return false; }
From source file:au.gov.ansto.bragg.kakadu.ui.widget.CheckboxTableTreeViewer.java
License:Open Source License
/** * Sets the grayed state for the given element in this viewer. * * @param element the element/*from w w w .ja v a 2 s .c o m*/ * @param state <code>true</code> if the item should be grayed, * and <code>false</code> if it should be ungrayed * @return <code>true</code> if the gray state could be set, * and <code>false</code> otherwise */ public boolean setGrayed(Object element, boolean state) { Assert.isNotNull(element); Widget widget = internalExpand(element, false); if (widget instanceof TableTreeItem) { ((TableTreeItem) widget).setGrayed(state); return true; } return false; }
From source file:au.gov.ansto.bragg.kakadu.ui.widget.CheckboxTableTreeViewer.java
License:Open Source License
/** * Check and gray the selection rather than calling both * setGrayed and setChecked as an optimization. * @param element the item being checked * @param state a boolean indicating selection or deselection * @return boolean indicating success or failure. */// w w w . java2 s . c o m public boolean setGrayChecked(Object element, boolean state) { Assert.isNotNull(element); Widget widget = internalExpand(element, false); if (widget instanceof TableTreeItem) { TableTreeItem item = (TableTreeItem) widget; setChecked(item, state); item.setGrayed(state); return true; } return false; }
From source file:coloredide.utils.EditorUtility.java
License:Open Source License
/** * Note: This is an inlined version of//from w w w . j ava 2 s . c o m * {@link JavaUI#getEditorInputJavaElement(IEditorInput)}, which is not * available in 3.1. */ public static IJavaElement javaUIgetEditorInputJavaElement(IEditorInput editorInput) { Assert.isNotNull(editorInput); IJavaElement je = JavaUI.getWorkingCopyManager().getWorkingCopy(editorInput); if (je != null) return je; /* * This needs works, see * https://bugs.eclipse.org/bugs/show_bug.cgi?id=120340 */ return (IJavaElement) editorInput.getAdapter(IJavaElement.class); }