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

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

Introduction

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

Prototype

String SHOW_DETAILS_LABEL

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

Click Source Link

Document

The label for show details buttons.

Usage

From source file:org.eclipse.ui.internal.ide.IDEWorkbenchErrorHandler.java

License:Open Source License

private FatalErrorDialog openInternalQuestionDialog(Shell parent, String title, String message,
        Throwable detail, int defaultIndex) {
    String[] labels;/*from   ww  w  . ja  v a  2 s  . c  om*/
    if (detail == null) {
        labels = new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL };
    } else {
        labels = new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL,
                IDialogConstants.SHOW_DETAILS_LABEL };
    }

    FatalErrorDialog dialog = new FatalErrorDialog(parent, title, null, // accept
            // the
            // default
            // window
            // icon
            message, detail, MessageDialog.QUESTION, labels, defaultIndex);
    if (detail != null) {
        dialog.setDetailButton(2);
    }
    return dialog;
}

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

License:Open Source License

private void updateDetailsText() {
    if (details != null) {
        details.dispose();//from  www  .  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  2s. c  o m*/
 * 
 */
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.internal.statushandlers.InternalDialog.java

License:Open Source License

/**
 * This method creates buttons that are placed on button bar.
 *//*from  w ww . ja v  a2 s .c  om*/
protected void createButtonsForButtonBar(Composite parent) {
    IAction gotoAction = getGotoAction();
    String text = null;
    if (gotoAction != null) {
        text = gotoAction.getText();
    }
    Button button = createButton(parent, GOTO_ACTION_ID, text == null ? "" : text, //$NON-NLS-1$
            false);
    if (text == null)
        hideButton(button, true);

    createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);

    createButton(parent, IDialogConstants.DETAILS_ID, IDialogConstants.SHOW_DETAILS_LABEL, false);
}

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//from   w w w .  j  a va  2  s  . c  o  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.ui.tests.statushandlers.StatusDialogManagerTest.java

License:Open Source License

public void testBug288770_1() {
    wsdm.addStatusAdapter(createStatusAdapter(MESSAGE_1), false);
    wsdm.addStatusAdapter(createStatusAdapter(MESSAGE_2), false);
    assertTrue("Details should be closed initially",
            StatusDialogUtil.getDetailsButton().getText().equals(IDialogConstants.SHOW_DETAILS_LABEL));
    assertTrue("The list should be visible", StatusDialogUtil.getTable() != null);
    selectWidget(StatusDialogUtil.getDetailsButton());
    int height = StatusDialogUtil.getTable().getSize().y;
    // resize the dialog
    Shell statusShell = StatusDialogUtil.getStatusShell();
    Point shellSize = statusShell.getSize();
    statusShell.setSize(shellSize.x, shellSize.y + 100);
    statusShell.layout(true);/* w w  w.j a  v  a  2  s  . co m*/
    int newHeight = StatusDialogUtil.getTable().getSize().y;
    assertEquals("All height should be consumed by details", height, newHeight);
}

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

License:Open Source License

public void testBug288770_2() {
    wsdm.addStatusAdapter(createStatusAdapter(MESSAGE_1), false);
    assertTrue("Details should be closed initially",
            StatusDialogUtil.getDetailsButton().getText().equals(IDialogConstants.SHOW_DETAILS_LABEL));
    selectWidget(StatusDialogUtil.getDetailsButton());
    wsdm.addStatusAdapter(createStatusAdapter(MESSAGE_2), false);
    assertTrue("The list should be visible", StatusDialogUtil.getTable() != null);
    int height = StatusDialogUtil.getTable().getSize().y;
    // resize the dialog
    Shell statusShell = StatusDialogUtil.getStatusShell();
    Point shellSize = statusShell.getSize();
    statusShell.setSize(shellSize.x, shellSize.y + 100);
    statusShell.layout(true);/*ww w  .  j  a  va  2 s  .  c  o  m*/
    int newHeight = StatusDialogUtil.getTable().getSize().y;
    assertEquals("All height should be consumed by details", height, newHeight);
}

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

License:Open Source License

public void testBug288770_3() {
    wsdm.addStatusAdapter(createStatusAdapter(MESSAGE_1), false);
    assertTrue("Details should be closed initially",
            StatusDialogUtil.getDetailsButton().getText().equals(IDialogConstants.SHOW_DETAILS_LABEL));
    wsdm.addStatusAdapter(createStatusAdapter(MESSAGE_2), false);
    assertTrue("The list should be visible", StatusDialogUtil.getTable() != null);
    int height = StatusDialogUtil.getTable().getSize().y;
    // resize the dialog
    Shell statusShell = StatusDialogUtil.getStatusShell();
    Point shellSize = statusShell.getSize();
    statusShell.setSize(shellSize.x, shellSize.y + 100);
    statusShell.layout(true);//from  w ww .j  a  v a 2s .co  m
    int newHeight = StatusDialogUtil.getTable().getSize().y;
    assertTrue("List should resize when details are closed", height < newHeight);
}

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

License:Open Source License

public void testBug288770_4() {
    wsdm.addStatusAdapter(createStatusAdapter(MESSAGE_1), false);
    assertTrue("Details should be closed initially",
            StatusDialogUtil.getDetailsButton().getText().equals(IDialogConstants.SHOW_DETAILS_LABEL));
    wsdm.addStatusAdapter(createStatusAdapter(MESSAGE_2), false);
    selectWidget(StatusDialogUtil.getDetailsButton());
    selectWidget(StatusDialogUtil.getDetailsButton());
    assertTrue("Details should be closed",
            StatusDialogUtil.getDetailsButton().getText().equals(IDialogConstants.SHOW_DETAILS_LABEL));
    assertTrue("The list should be visible", StatusDialogUtil.getTable() != null);
    int height = StatusDialogUtil.getTable().getSize().y;
    // resize the dialog
    Shell statusShell = StatusDialogUtil.getStatusShell();
    Point shellSize = statusShell.getSize();
    statusShell.setSize(shellSize.x, shellSize.y + 100);
    statusShell.layout(true);/*from  w ww.ja v a2s . com*/
    int newHeight = StatusDialogUtil.getTable().getSize().y;
    assertTrue("List should resize when details are closed", height < newHeight);
}

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

License:Open Source License

protected void createButtonsForButtonBar(Composite parent) {
    // create OK and Details buttons
    createButton(parent, StatusDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
    if (status.isMultiStatus() || status.getException() != null) {
        detailsButton = createButton(parent, StatusDialogConstants.DETAILS_ID,
                IDialogConstants.SHOW_DETAILS_LABEL, false);
    }//from ww w.  j av a2s  .com
}