Example usage for org.eclipse.jface.util Assert isTrue

List of usage examples for org.eclipse.jface.util Assert isTrue

Introduction

In this page you can find the example usage for org.eclipse.jface.util Assert isTrue.

Prototype

public static boolean isTrue(boolean expression) 

Source Link

Document

Asserts that the given boolean is true.

Usage

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  va2  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 w w .  j a v a2s. 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());
            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.MultiXMAFormAttachmentAdapter.java

License:Open Source License

/**
 *
 * @return the fraction of qntnominator and denominator as percent value
 * @author s1462/*from w  w w.  ja v a2 s .  c om*/
 */
public String getParentPercent() {
    if (qntNominatorMultiSet || qntDenominatorMultiSet) {
        return MULTI_STR;
    } else {
        Assert.isTrue(attach.getQntDenominator() >= attach.getQntNominator());
        MyFractionNum fract = new MyFractionNum(attach.getQntNominator(), attach.getQntDenominator());
        return fract.getFractionasFloatString();
    }
}

From source file:at.spardat.xma.guidesign.presentation.preferences.RadioGroupFieldEditor.java

License:Open Source License

/**
 * Creates a radio group field editor./*from  ww  w . j  a  va 2s .  c om*/
 * <p>
 * Example usage:
 * <pre>
 *      RadioGroupFieldEditor editor= new RadioGroupFieldEditor(
 *         "GeneralPage.DoubleClick", resName, 1,
 *         new String[][] {
 *            {"Open Browser", "open"},
 *            {"Expand Tree", "expand"}
 *         },
 *          parent,
 *          true);
 * </pre>
 * </p>
 *
 * @param name the name of the preference this field editor works on
 * @param labelText the label text of the field editor
 * @param numColumns the number of columns for the radio button presentation
 * @param labelAndValues list of radio button [label, value] entries;
 *  the value is returned when the radio button is selected
 * @param parent the parent of the field editor's control
 * @param useGroup whether to use a Group control to contain the radio buttons
 */
public RadioGroupFieldEditor(String name, String labelText, int numColumns, String[][] labelAndValues,
        Composite parent, boolean useGroup) {
    init(name, labelText);
    Assert.isTrue(checkArray(labelAndValues));
    this.labelsAndValues = labelAndValues;
    this.numColumns = numColumns;
    this.useGroup = useGroup;
    createControl(parent);
}

From source file:at.spardat.xma.guidesign.presentation.UIPreviewer.java

License:Open Source License

/**
 * Copied from TreeViewer!!!//  w  w  w  .  ja  v  a  2 s.c  o m
 * The tree viewer implementation of this <code>Viewer</code> framework
 * method ensures that the given label provider is an instance
 * of <code>ILabelProvider</code>.
 */
public void setLabelProvider(IBaseLabelProvider labelProvider) {
    Assert.isTrue(labelProvider instanceof ILabelProvider);
    super.setLabelProvider(labelProvider);
}

From source file:ca.uwaterloo.gp.fmp.presentation.MultiLineTableCellEditor.java

License:Open Source License

/**
 * The <code>TextCellEditor</code> implementation of
 * this <code>CellEditor</code> framework method accepts
 * a text string (type <code>String</code>).
 *
 * @param value a text string (type <code>String</code>)
 *///from   w w w . j  a v  a  2  s  .  co  m
protected void doSetValue(Object value) {
    Assert.isTrue(text != null && (value instanceof String));
    text.removeModifyListener(getModifyListener());
    text.setText((String) value);
    text.addModifyListener(getModifyListener());
    if (text.getText().indexOf("\r") >= 0 || text.getText().indexOf("\n") >= 0) {
        performSizeChange();
    }
}

From source file:com.agynamix.platform.frontend.preferences.PasswordFieldEditor.java

License:Open Source License

/**
 * Sets the strategy for validating the text.
 * <p>/*from  w w w .j  a  va 2  s  .  c  o  m*/
 * Calling this method has no effect after <code>createPartControl</code>
 * is called. Thus this method is really only useful for subclasses to call
 * in their constructor. However, it has public visibility for backward
 * compatibility.
 * </p>
 * 
 * @param value
 *            either <code>VALIDATE_ON_KEY_STROKE</code> to perform on the
 *            fly checking (the default), or
 *            <code>VALIDATE_ON_FOCUS_LOST</code> to perform validation
 *            only after the text has been typed in
 */
public void setValidateStrategy(int value) {
    Assert.isTrue(value == VALIDATE_ON_FOCUS_LOST || value == VALIDATE_ON_KEY_STROKE);
    validateStrategy = value;
}

From source file:com.architexa.org.eclipse.gef.CompoundSnapToHelper.java

License:Open Source License

/**
 * Constructs a compound snap to helper which will delegate to the provided array of
 * helpers.  The first helper in the array has highest priority and will be given the
 * first opportunity to perform snapping.
 * @since 3.0//from   w ww. java2s .  com
 * @param delegates an array of helpers
 */
public CompoundSnapToHelper(SnapToHelper delegates[]) {
    Assert.isTrue(delegates.length != 0);
    this.delegates = delegates;
}

From source file:com.architexa.org.eclipse.gef.editparts.ZoomManager.java

License:Open Source License

/**
 * @deprecated Use {@link #getScalableFigure()} instead.
 * Returns the pane.//from ww  w  .  j  a  va 2 s  .  c om
 * @return the pane
 */
public ScalableFreeformLayeredPane getPane() {
    Assert.isTrue(pane instanceof ScalableFreeformLayeredPane);
    return (ScalableFreeformLayeredPane) pane;
}

From source file:com.architexa.org.eclipse.gef.palette.ToolEntry.java

License:Open Source License

/**
 * Sets the type of tool to be created.  This provides clients with a method of specifying
 * a different type of tool to be created without having to sub-class.  The provided class
 * should have a default constructor for this to work successfully.
 * @param toolClass the type of tool to be created by this entry
 * @since 3.1/*w  w w .  ja v a 2s  .c  o m*/
 */
public void setToolClass(Class toolClass) {
    if (toolClass != null)
        Assert.isTrue(Tool.class.isAssignableFrom(toolClass));
    this.toolClass = toolClass;
}