Example usage for org.eclipse.jface.dialogs IDialogConstants HIDE_DETAILS_LABEL

List of usage examples for org.eclipse.jface.dialogs IDialogConstants HIDE_DETAILS_LABEL

Introduction

In this page you can find the example usage for org.eclipse.jface.dialogs IDialogConstants HIDE_DETAILS_LABEL.

Prototype

String HIDE_DETAILS_LABEL

To view the source code for org.eclipse.jface.dialogs IDialogConstants HIDE_DETAILS_LABEL.

Click Source Link

Document

The label for hide details buttons.

Usage

From source file:org.eclipse.oomph.ui.ErrorDialog.java

License:Open Source License

private void toggleDetailsArea() {
    Point windowSize = getShell().getSize();
    Point oldSize = getContents().computeSize(SWT.DEFAULT, SWT.DEFAULT);

    if (text != null) {
        text.dispose();/*from ww w .j  a  v  a 2  s  .  com*/
        text = null;
        getButton(detailsButtonID).setText(IDialogConstants.SHOW_DETAILS_LABEL);
    } else {
        createDropDownText((Composite) getContents());
        getButton(detailsButtonID).setText(IDialogConstants.HIDE_DETAILS_LABEL);
    }

    Point newSize = getContents().computeSize(SWT.DEFAULT, SWT.DEFAULT);
    getShell().setSize(new Point(windowSize.x, windowSize.y + newSize.y - oldSize.y));
}

From source file:org.eclipse.sirius.common.ui.tools.api.dialog.SiriusMessageDialogWithToggle.java

License:Open Source License

/**
 * Attempt to find a standard JFace button id that matches the specified
 * button label. If no match can be found, use the default id provided.
 * //w w  w.  j a va2s  . c  o m
 * Overridden to investigate the provided buttons.
 * 
 * @param buttonLabel
 *            the button label whose id is sought
 * @param defaultId
 *            the id to use for the button if there is no standard id
 * @return the id for the specified button label
 */
// CHECKSTYLE:OFF
private int mapButtonLabelToButtonID(String buttonLabel, int defaultId) {
    // CHECKSTYLE:OON
    // Not pretty but does the job...
    if (IDialogConstants.OK_LABEL.equals(buttonLabel)) {
        return IDialogConstants.OK_ID;
    }

    if (IDialogConstants.YES_LABEL.equals(buttonLabel)) {
        return IDialogConstants.YES_ID;
    }

    if (IDialogConstants.NO_LABEL.equals(buttonLabel)) {
        return IDialogConstants.NO_ID;
    }

    if (IDialogConstants.CANCEL_LABEL.equals(buttonLabel)) {
        return IDialogConstants.CANCEL_ID;
    }

    if (IDialogConstants.YES_TO_ALL_LABEL.equals(buttonLabel)) {
        return IDialogConstants.YES_TO_ALL_ID;
    }

    if (IDialogConstants.SKIP_LABEL.equals(buttonLabel)) {
        return IDialogConstants.SKIP_ID;
    }

    if (IDialogConstants.STOP_LABEL.equals(buttonLabel)) {
        return IDialogConstants.STOP_ID;
    }

    if (IDialogConstants.ABORT_LABEL.equals(buttonLabel)) {
        return IDialogConstants.ABORT_ID;
    }

    if (IDialogConstants.RETRY_LABEL.equals(buttonLabel)) {
        return IDialogConstants.RETRY_ID;
    }

    if (IDialogConstants.IGNORE_LABEL.equals(buttonLabel)) {
        return IDialogConstants.IGNORE_ID;
    }

    if (IDialogConstants.PROCEED_LABEL.equals(buttonLabel)) {
        return IDialogConstants.PROCEED_ID;
    }

    if (IDialogConstants.OPEN_LABEL.equals(buttonLabel)) {
        return IDialogConstants.OPEN_ID;
    }

    if (IDialogConstants.CLOSE_LABEL.equals(buttonLabel)) {
        return IDialogConstants.CLOSE_ID;
    }

    if (IDialogConstants.BACK_LABEL.equals(buttonLabel)) {
        return IDialogConstants.BACK_ID;
    }

    if (IDialogConstants.NEXT_LABEL.equals(buttonLabel)) {
        return IDialogConstants.NEXT_ID;
    }

    if (IDialogConstants.FINISH_LABEL.equals(buttonLabel)) {
        return IDialogConstants.FINISH_ID;
    }

    if (IDialogConstants.HELP_LABEL.equals(buttonLabel)) {
        return IDialogConstants.HELP_ID;
    }

    if (IDialogConstants.NO_TO_ALL_LABEL.equals(buttonLabel)) {
        return IDialogConstants.NO_TO_ALL_ID;
    }

    if (IDialogConstants.SHOW_DETAILS_LABEL.equals(buttonLabel)) {
        return IDialogConstants.DETAILS_ID;
    }

    if (IDialogConstants.HIDE_DETAILS_LABEL.equals(buttonLabel)) {
        return IDialogConstants.DETAILS_ID;
    }

    for (String providedButton : buttonsMap.keySet()) {
        if (providedButton.equals(buttonLabel)) {
            return buttonsMap.get(providedButton);
        }
    }

    // No XXX_LABEL in IDialogConstants for these. Unlikely
    // they would be used in a message dialog though.
    // public int SELECT_ALL_ID = 18;
    // public int DESELECT_ALL_ID = 19;
    // public int SELECT_TYPES_ID = 20;

    return defaultId;
}

From source file:org.eclipse.team.internal.ui.dialogs.DetailsDialog.java

License:Open Source License

protected String getDetailsButtonLabelHide() {
    return IDialogConstants.HIDE_DETAILS_LABEL;
}

From source file:org.eclipse.ui.internal.part.StatusPart.java

License:Open Source License

private void updateDetailsText() {
    if (details != null) {
        details.dispose();//from w w  w.ja  v  a 2  s . c  o m
        details = null;
    }

    if (showingDetails) {
        detailsButton.setText(IDialogConstants.HIDE_DETAILS_LABEL);
        Text detailsText = new Text(detailsArea,
                SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI | SWT.READ_ONLY | SWT.LEFT_TO_RIGHT);
        detailsText.setText(getDetails(reason));
        detailsText.setBackground(detailsText.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
        details = detailsText;
        detailsArea.layout(true);
    } else {
        detailsButton.setText(IDialogConstants.SHOW_DETAILS_LABEL);
    }
}

From source file:org.eclipse.ui.internal.statushandlers.InternalDialog.java

License:Open Source License

/**
 * Toggles the unfolding of the details area. This is triggered by the
 * user pressing the details button./*from   w w  w.  j a  v  a 2  s.c om*/
 * 
 */
private boolean toggleDetailsArea() {
    boolean opened = false;
    Point windowSize = getShell().getSize();
    if (detailsManager.isOpen()) {
        detailsManager.close();
        getButton(IDialogConstants.DETAILS_ID).setText(IDialogConstants.SHOW_DETAILS_LABEL);
        opened = false;
    } else {
        detailsManager.createDetailsArea(dialogArea, getCurrentStatusAdapter());
        getButton(IDialogConstants.DETAILS_ID).setText(IDialogConstants.HIDE_DETAILS_LABEL);
        opened = true;
    }

    GridData listAreaGridData = (GridData) listArea.getLayoutData();
    // if there is only one status to display,
    // make sure that the list area is as small as possible
    if (!isMulti()) {
        listAreaGridData.heightHint = 0;
    }
    // allow listArea to grab space depending if details
    // are opened or not
    if (opened) {
        listAreaGridData.grabExcessVerticalSpace = false;
    } else {
        listAreaGridData.grabExcessVerticalSpace = true;
    }
    listArea.setLayoutData(listAreaGridData);

    Point newSize = getShell().computeSize(SWT.DEFAULT, SWT.DEFAULT);
    int diffY = newSize.y - windowSize.y;
    // increase the dialog height if details were opened and such
    // increase is necessary
    // decrease the dialog height if details were closed and empty space
    // appeared
    if ((opened && diffY > 0) || (!opened && diffY < 0)) {
        getShell().setSize(new Point(windowSize.x, windowSize.y + (diffY)));
    }
    dialogArea.layout();
    return opened;
}

From source file:org.eclipse.ui.tests.statushandlers.StatusDialogManagerTest.java

License:Open Source License

/**
 * Tests if details can be closed and opened 2 times tests if correct status
 * adapter is passed to details//  w ww . j  a v  a  2  s  .co m
 */
public void testDetails1() {
    StatusAdapter statusAdapter = createStatusAdapter(MESSAGE_1);
    final StatusAdapter[] passed = new StatusAdapter[] { null };
    final Composite[] details = new Composite[] { null };
    setupDetails(passed, details);
    wsdm.addStatusAdapter(statusAdapter, false);
    for (int i = 0; i < 2; i++) {
        passed[0] = null;
        Point sizeBefore = StatusDialogUtil.getStatusShell().getSize();
        Button detailsButton = StatusDialogUtil.getDetailsButton();
        assertNotNull(detailsButton);
        assertTrue(detailsButton.isEnabled());
        assertEquals(IDialogConstants.SHOW_DETAILS_LABEL, detailsButton.getText());

        selectWidget(detailsButton);

        Point sizeAfter = StatusDialogUtil.getStatusShell().getSize();
        assertEquals(statusAdapter, passed[0]);
        assertTrue(sizeAfter.y > sizeBefore.y);
        assertEquals(IDialogConstants.HIDE_DETAILS_LABEL, detailsButton.getText());
        assertNotNull(details[0]);
        assertFalse(details[0].isDisposed());

        selectWidget(detailsButton);

        Point sizeAfterAfter = StatusDialogUtil.getStatusShell().getSize();
        assertTrue(sizeAfterAfter.y < sizeAfter.y);
        assertEquals(IDialogConstants.SHOW_DETAILS_LABEL, detailsButton.getText());
        assertTrue(details[0].isDisposed());
    }
}

From source file:org.eclipse.wst.command.internal.env.ui.dialog.MessageDialog.java

License:Open Source License

/**
 * Toggles the unfolding of the details area. This is triggered by the user
 * pressing the details button./*from w w  w. j a v  a2  s.  c  o  m*/
 */
private void toggleDetailsArea() {
    Point windowSize = getShell().getSize();
    int newHeight = -1;

    if (detailsCreated) {
        details.dispose();
        detailsCreated = false;
        detailsButton.setText(IDialogConstants.SHOW_DETAILS_LABEL);

        // Without the following computeSize call the setSize call below throws an array out of bounds exception.
        // Very weird.
        getContents().computeSize(SWT.DEFAULT, SWT.DEFAULT);

        newHeight = savedSize.y;
    } else {
        if (savedSize == null)
            savedSize = windowSize;

        details = createDropDownDetails((Composite) getContents());
        detailsButton.setText(IDialogConstants.HIDE_DETAILS_LABEL);
        newHeight = getContents().computeSize(SWT.DEFAULT, SWT.DEFAULT).y;
        newHeight = newHeight < 250 ? 250 : newHeight;
    }

    newHeight = newHeight > 400 ? 400 : newHeight;

    getShell().setSize(new Point(windowSize.x, newHeight));
    parent.layout();
}

From source file:org.eclipse.wst.common.frameworks.internal.dialog.ui.MessageDialog.java

License:Open Source License

/**
 * Toggles the unfolding of the details area. This is triggered by the user
 * pressing the details button./*from   w w w  . j ava  2s  .  co m*/
 */
private void toggleDetailsArea() {
    Point windowSize = getShell().getSize();
    int newHeight = -1;

    if (detailsCreated) {
        details.dispose();
        detailsCreated = false;
        detailsButton.setText(IDialogConstants.SHOW_DETAILS_LABEL);

        // Without the following computeSize call the setSize call below throws an array out of bounds exception.
        // Very weird.
        getContents().computeSize(SWT.DEFAULT, SWT.DEFAULT);

        newHeight = savedSize.y;
    } else {
        if (savedSize == null)
            savedSize = windowSize;

        details = createDropDownDetails((Composite) getContents());
        detailsButton.setText(IDialogConstants.HIDE_DETAILS_LABEL);
        newHeight = getContents().computeSize(SWT.DEFAULT, SWT.DEFAULT).y;
    }

    newHeight = newHeight > 400 ? 400 : newHeight;

    getShell().setSize(new Point(windowSize.x, newHeight));
}

From source file:org.eclipse.zest.custom.sequence.widgets.internal.ErrorComposite.java

License:Open Source License

/**
 * /*w w w  . java 2  s. c om*/
 */
private void updateDetails() {
    if (!showingDetails) {
        detailsButton.setText(IDialogConstants.SHOW_DETAILS_LABEL);
        if (details != null && !details.isDisposed()) {
            details.dispose();
            details = null;
        }
    } else {
        detailsButton.setText(IDialogConstants.HIDE_DETAILS_LABEL);
        if (details == null || details.isDisposed()) {
            details = new Text(detailsPage, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
            details.setEditable(false);
        }
        details.setText(getDetailsText());
        detailsPage.layout();
    }
    layout(true, true);
}

From source file:org.jboss.tools.common.model.ui.dialog.ErrorDialog.java

License:Open Source License

private void toggleDetailsArea() {
    Point windowSize = getShell().getSize();
    Point oldSize = getShell().computeSize(SWT.DEFAULT, SWT.DEFAULT);

    if (dropDownCreated) {
        dropDown.dispose();//w ww.  jav  a 2 s  . c  om
        dropDownCreated = false;
        detailsButton.setText(IDialogConstants.SHOW_DETAILS_LABEL);
    } else {
        dropDown = createDropDownControl((Composite) getContents());
        detailsButton.setText(IDialogConstants.HIDE_DETAILS_LABEL);
    }

    Point newSize = getShell().computeSize(SWT.DEFAULT, SWT.DEFAULT);

    getShell().setSize(new Point(windowSize.x, windowSize.y + (newSize.y - oldSize.y)));

}