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

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

Introduction

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

Prototype

int CLOSE_ID

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

Click Source Link

Document

Button id for a "Close" button (value 12).

Usage

From source file:com.android.ddmuilib.FindDialog.java

License:Apache License

@Override
protected void createButtonsForButtonBar(Composite parent) {
    createButton(parent, IDialogConstants.CLOSE_ID, IDialogConstants.CLOSE_LABEL, false);

    mFindNext = createButton(parent, FIND_NEXT_ID, "Find Next", mDefaultButtonId == FIND_NEXT_ID);
    mFindPrevious = createButton(parent, FIND_PREVIOUS_ID, "Find Previous", mDefaultButtonId != FIND_NEXT_ID);
    mFindNext.setEnabled(false);//  w  w w.j  av a  2  s .c  om
    mFindPrevious.setEnabled(false);
}

From source file:com.android.ddmuilib.FindDialog.java

License:Apache License

@Override
protected void buttonPressed(int buttonId) {
    if (buttonId == IDialogConstants.CLOSE_ID) {
        close();/*from  w w w.  j  av a  2  s.  co  m*/
        return;
    }

    if (buttonId == FIND_PREVIOUS_ID || buttonId == FIND_NEXT_ID) {
        if (mTarget != null) {
            String searchText = mSearchText.getText();
            boolean newSearch = !searchText.equals(mPreviousSearchText);
            mPreviousSearchText = searchText;
            boolean searchForward = buttonId == FIND_NEXT_ID;

            boolean hasMatches = mTarget.findAndSelect(searchText, newSearch, searchForward);
            if (!hasMatches) {
                mStatusLabel.setText("String not found");
                mStatusLabel.pack();
            } else {
                mStatusLabel.setText("");
            }
        }
    }
}

From source file:com.astra.ses.spell.gui.dialogs.ConnectionDialog.java

License:Open Source License

/***************************************************************************
 * Create the button bar buttons.// w  ww . jav  a  2  s  .co m
 * 
 * @param parent
 *            The Button Bar.
 **************************************************************************/
protected void createButtonsForButtonBar(Composite parent) {
    createButton(parent, IDialogConstants.CLOSE_ID, IDialogConstants.CLOSE_LABEL, true);
}

From source file:com.astra.ses.spell.gui.dialogs.ConnectionDialog.java

License:Open Source License

/***************************************************************************
 * Called when one of the buttons of the button bar is pressed.
 * //from  w ww. j  a v  a2  s.co  m
 * @param buttonId
 *            The button identifier.
 **************************************************************************/
protected void buttonPressed(int buttonId) {
    switch (buttonId) {
    case IDialogConstants.CLOSE_ID:
        close();
    }
}

From source file:com.astra.ses.spell.gui.presentation.code.dialogs.SearchDialog.java

License:Open Source License

/***************************************************************************
 * Create the button bar buttons./*from   w w  w  .  ja v a  2  s.  com*/
 * 
 * @param parent
 *            The Button Bar.
 **************************************************************************/
protected void createButtonsForButtonBar(Composite parent) {
    createButton(parent, BTN_FIND_CODE, BTN_FIND_TITLE, true);
    createButton(parent, BTN_FIND_PREV_CODE, BTN_FIND_PREV_TITLE, false);
    createButton(parent, BTN_FIND_NEXT_CODE, BTN_FIND_NEXT_TITLE, false);
    createButton(parent, BTN_CLEAR_CLOSE_CODE, BTN_CLEAR_CLOSE_TITLE, false);
    createButton(parent, IDialogConstants.CLOSE_ID, IDialogConstants.CLOSE_LABEL, false);
    getButton(BTN_FIND_NEXT_CODE).setEnabled(false);
    getButton(BTN_FIND_PREV_CODE).setEnabled(false);
    getButton(BTN_CLEAR_CLOSE_CODE).setEnabled(false);
}

From source file:com.astra.ses.spell.gui.presentation.code.dialogs.SearchDialog.java

License:Open Source License

/***************************************************************************
 * Called when one of the buttons of the button bar is pressed.
 * /*ww  w .j av a 2 s.c  o  m*/
 * @param buttonId
 *            The button identifier.
 **************************************************************************/
protected void buttonPressed(int buttonId) {
    switch (buttonId) {
    case BTN_FIND_CODE:
        String toSearch = m_text.getText();
        if (toSearch.isEmpty()) {
            MessageDialog.openError(getShell(), "Cannot search", "Musty provide a search string");
        } else {
            m_occurrences = m_viewer.searchString(toSearch);
            setMessage(m_occurrences + " occurrences found.");
            getButton(BTN_FIND_NEXT_CODE).setEnabled((m_occurrences > 0));
            getButton(BTN_FIND_PREV_CODE).setEnabled((m_occurrences > 0));
            getButton(BTN_CLEAR_CLOSE_CODE).setEnabled((m_occurrences > 0));
            m_lastSearch = toSearch;
        }
        break;
    case BTN_FIND_NEXT_CODE:
        if (!m_viewer.searchNext()) {
            setMessage("No more occurrences");
        } else {
            setMessage(m_occurrences + " occurrences found.");
        }
        break;
    case BTN_FIND_PREV_CODE:
        if (!m_viewer.searchPrevious()) {
            setMessage("At first occurrence");
        } else {
            setMessage(m_occurrences + " occurrences found.");
        }
        break;
    case BTN_CLEAR_CLOSE_CODE:
        m_viewer.clearMatches();
        // Fall thru
    case IDialogConstants.CLOSE_ID:
        close();
        break;
    }
}

From source file:com.bluexml.side.application.ui.action.ApplicationDialog.java

License:Open Source License

/**
 * Create contents of the button bar/*  w ww  .ja va  2s.co  m*/
 * 
 * @param parent
 */
@Override
protected void createButtonsForButtonBar(Composite parent) {
    createButton(parent, GEN_ID, Activator.Messages.getString("ApplicationDialog.90"), false); //$NON-NLS-1$
    createButton(parent, APPLY_ID, Activator.Messages.getString("ApplicationDialog.91"), false); //$NON-NLS-1$
    createButton(parent, IDialogConstants.CLOSE_ID, Activator.Messages.getString("ApplicationDialog.92"), //$NON-NLS-1$
            false);
}

From source file:com.bluexml.side.application.ui.action.ApplicationDialog.java

License:Open Source License

/**
 * Action for Close, Save and Launch//from w  w  w .  j  a v  a2 s. c om
 */
protected void buttonPressed(int buttonId) {
    // fix lot of trouble change focus to fire lostFocus event,
    // this close editor for parameters, logText, detinationText
    buttonBar.setFocus();
    if (generatorParameterCellModifier != null) {
        // only for some OS that do not unselect cell Editor before fire
        // this event, so we record changes manually
        //         generatorParameterCellModifier.applyDirtyValue();
    }
    if (buttonId == IDialogConstants.CLOSE_ID) {
        if (applicationModified) {
            int result = showConfirmation(Activator.Messages.getString("ApplicationDialog.93"), //$NON-NLS-1$
                    Activator.Messages.getString("ApplicationDialog.94")); //$NON-NLS-1$
            if (result == SWT.YES) {
                saveData();
            }
        }
        getShell().close();
        close();
    }
    if (buttonId == APPLY_ID) {
        Display.getCurrent().getActiveShell().setCursor(new Cursor(Display.getCurrent(), SWT.CURSOR_WAIT));
        saveData();
        Display.getCurrent().getActiveShell().setCursor(new Cursor(Display.getCurrent(), SWT.CURSOR_ARROW));
    }
    if (buttonId == GEN_ID) {
        if (applicationModified) {
            int result = showConfirmation(Activator.Messages.getString("ApplicationDialog.95"), //$NON-NLS-1$
                    Activator.Messages.getString("ApplicationDialog.96")); //$NON-NLS-1$
            if (result == SWT.YES) {
                saveData();
            }
        }

        // create local variable to be able to close (and dispose) ApplicationDialog instance before launching GenerationPopup
        Configuration conf = getCurrentConfiguration();
        Shell shell = getParentShell();
        Application applicationModel = ApplicationDialog.application;
        IFile applicationFile = this.model;
        //         final GeneratePopUp generationPopUp = new GeneratePopUp(shell, conf);
        final GeneratePopUp generationPopUp = new GeneratePopUp(shell, applicationFile, applicationModel, conf);
        ApplicationDialog.this.close();
        generationPopUp.launch();
        //         GeneratePopUp.launch(conf, generationPopUp, application_, model_);

        return;
    }

    super.buttonPressed(buttonId);
}

From source file:com.byterefinery.rmbench.dialogs.ConnectionDialog.java

License:Open Source License

protected void createButtonsForButtonBar(Composite parent) {
    createButton(parent, IDialogConstants.CLOSE_ID, IDialogConstants.CLOSE_LABEL, true);
}

From source file:com.byterefinery.rmbench.dialogs.ConnectionDialog.java

License:Open Source License

protected void buttonPressed(int buttonId) {
    if (buttonId == IDialogConstants.CLOSE_ID)
        close();
}