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

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

Introduction

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

Prototype

String CLOSE_LABEL

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

Click Source Link

Document

The label for close buttons.

Usage

From source file:ca.uwinnipeg.proximity.desktop.AboutDialog.java

/**
 * Create contents of the button bar.// ww w . j  a va  2s  .co  m
 * @param parent
 */
@Override
protected void createButtonsForButtonBar(Composite parent) {
    // TODO: setup buttons properly
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CLOSE_LABEL, true);

    //    Button btnCredits = createButton(
    //        parent, 
    //        IDialogConstants.CLOSE_ID, 
    //        IDialogConstants.CLOSE_LABEL, 
    //        false);
    //    btnCredits.setText("Credits");
    //    
    //    Button btnLicence = createButton(
    //        parent, 
    //        IDialogConstants.CLOSE_ID, 
    //        IDialogConstants.CLOSE_LABEL, 
    //        false);
    //    btnLicence.setText("Licence");
}

From source file:com.agynamix.platform.frontend.dialogs.InputTextDialog.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(Composite parent) {
    createButton(parent, IDialogConstants.OK_ID, IDialogConstants.CLOSE_LABEL, true);
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
    //    super.createButtonsForButtonBar(parent);
}

From source file:com.agynamix.platform.frontend.dialogs.SimpleInformationViewerDialog.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(Composite parent) {
    createButton(parent, IDialogConstants.OK_ID, IDialogConstants.CLOSE_LABEL, true);
    //    super.createButtonsForButtonBar(parent);
}

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);/*from w  w  w  . j a  v a  2 s  .c  o  m*/
    mFindPrevious.setEnabled(false);
}

From source file:com.android.ide.eclipse.adt.AdtPlugin.java

License:Open Source License

/**
 * Checks the location of the SDK in the prefs is valid.
 * If it is not, display a warning dialog to the user and try to display
 * some useful link to fix the situation (setup the preferences, perform an
 * update, etc.)//w w  w .j a  v a  2  s  .co m
 *
 * @return True if the SDK location points to an SDK.
 *  If false, the user has already been presented with a modal dialog explaining that.
 */
public boolean checkSdkLocationAndId() {
    String sdkLocation = AdtPrefs.getPrefs().getOsSdkFolder();

    return checkSdkLocationAndId(sdkLocation, new CheckSdkErrorHandler() {
        private String mTitle = "Android SDK";

        /**
         * Handle an error, which is the case where the check did not find any SDK.
         * This returns false to {@link AdtPlugin#checkSdkLocationAndId()}.
         */
        @Override
        public boolean handleError(Solution solution, String message) {
            displayMessage(solution, message, MessageDialog.ERROR);
            return false;
        }

        /**
         * Handle an warning, which is the case where the check found an SDK
         * but it might need to be repaired or is missing an expected component.
         *
         * This returns true to {@link AdtPlugin#checkSdkLocationAndId()}.
         */
        @Override
        public boolean handleWarning(Solution solution, String message) {
            displayMessage(solution, message, MessageDialog.WARNING);
            return true;
        }

        private void displayMessage(final Solution solution, final String message, final int dialogImageType) {
            final Display disp = getDisplay();
            disp.asyncExec(new Runnable() {
                @Override
                public void run() {
                    Shell shell = disp.getActiveShell();
                    if (shell == null) {
                        shell = AdtPlugin.getShell();
                    }
                    if (shell == null) {
                        return;
                    }

                    String customLabel = null;
                    switch (solution) {
                    case OPEN_ANDROID_PREFS:
                        customLabel = "Open Preferences";
                        break;
                    case OPEN_P2_UPDATE:
                        customLabel = "Check for Updates";
                        break;
                    case OPEN_SDK_MANAGER:
                        customLabel = "Open SDK Manager";
                        break;
                    }

                    String btnLabels[] = new String[customLabel == null ? 1 : 2];
                    btnLabels[0] = customLabel;
                    btnLabels[btnLabels.length - 1] = IDialogConstants.CLOSE_LABEL;

                    MessageDialog dialog = new MessageDialog(shell, // parent
                            mTitle, null, // dialogTitleImage
                            message, dialogImageType, btnLabels, btnLabels.length - 1);
                    int index = dialog.open();

                    if (customLabel != null && index == 0) {
                        switch (solution) {
                        case OPEN_ANDROID_PREFS:
                            openAndroidPrefs();
                            break;
                        case OPEN_P2_UPDATE:
                            openP2Update();
                            break;
                        case OPEN_SDK_MANAGER:
                            openSdkManager();
                            break;
                        }
                    }
                }
            });
        }

        private void openSdkManager() {
            // Open the standalone external SDK Manager since we know
            // that ADT on Windows is bound to be locking some SDK folders.
            //
            // Also when this is invoked because SdkManagerAction.run() fails, this
            // test will fail and we'll fallback on using the internal one.
            if (SdkManagerAction.openExternalSdkManager()) {
                return;
            }

            // Otherwise open the regular SDK Manager bundled within ADT
            if (!SdkManagerAction.openAdtSdkManager()) {
                // We failed because the SDK location is undefined. In this case
                // let's open the preferences instead.
                openAndroidPrefs();
            }
        }

        private void openP2Update() {
            Display disp = getDisplay();
            if (disp == null) {
                return;
            }
            disp.asyncExec(new Runnable() {
                @Override
                public void run() {
                    String cmdId = "org.eclipse.equinox.p2.ui.sdk.update"; //$NON-NLS-1$
                    IWorkbench wb = PlatformUI.getWorkbench();
                    if (wb == null) {
                        return;
                    }

                    ICommandService cs = (ICommandService) wb.getService(ICommandService.class);
                    IHandlerService is = (IHandlerService) wb.getService(IHandlerService.class);
                    if (cs == null || is == null) {
                        return;
                    }

                    Command cmd = cs.getCommand(cmdId);
                    if (cmd != null && cmd.isDefined()) {
                        try {
                            is.executeCommand(cmdId, null/*event*/);
                        } catch (Exception ignore) {
                            AdtPlugin.log(ignore, "Failed to execute command %s", cmdId);
                        }
                    }
                }
            });
        }

        private void openAndroidPrefs() {
            PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(getDisplay().getActiveShell(),
                    "com.android.ide.eclipse.preferences.main", //$NON-NLS-1$ preferencePageId
                    null, // displayedIds
                    null); // data
            dialog.open();
        }
    });
}

From source file:com.android.ide.eclipse.auidt.AdtPlugin.java

License:Open Source License

/**
 * Checks the location of the SDK is valid and if it is, grab the SDK API version
 * from the SDK.//  ww w.ja  v a  2s  .  co m
 * @return false if the location is not correct.
 */
private boolean checkSdkLocationAndId() {
    String sdkLocation = AdtPrefs.getPrefs().getOsSdkFolder();
    if (sdkLocation == null || sdkLocation.length() == 0) {
        return false;
    }

    return checkSdkLocationAndId(sdkLocation, new CheckSdkErrorHandler() {
        private String mTitle = "Android SDK Verification";

        @Override
        public boolean handleError(Solution solution, String message) {
            displayMessage(solution, message, MessageDialog.ERROR);
            return false;
        }

        @Override
        public boolean handleWarning(Solution solution, String message) {
            displayMessage(solution, message, MessageDialog.WARNING);
            return true;
        }

        private void displayMessage(final Solution solution, final String message, final int dialogImageType) {
            final Display disp = getDisplay();
            disp.asyncExec(new Runnable() {
                @Override
                public void run() {
                    Shell shell = disp.getActiveShell();
                    if (shell == null) {
                        return;
                    }

                    String customLabel = null;
                    switch (solution) {
                    case OPEN_ANDROID_PREFS:
                        customLabel = "Open Preferences";
                        break;
                    case OPEN_P2_UPDATE:
                        customLabel = "Check for Updates";
                        break;
                    case OPEN_SDK_MANAGER:
                        customLabel = "Open SDK Manager";
                        break;
                    }

                    String btnLabels[] = new String[customLabel == null ? 1 : 2];
                    btnLabels[0] = customLabel;
                    btnLabels[btnLabels.length - 1] = IDialogConstants.CLOSE_LABEL;

                    MessageDialog dialog = new MessageDialog(shell, // parent
                            mTitle, null, // dialogTitleImage
                            message, dialogImageType, btnLabels, btnLabels.length - 1);
                    int index = dialog.open();

                    if (customLabel != null && index == 0) {
                        switch (solution) {
                        case OPEN_ANDROID_PREFS:
                            openAndroidPrefs();
                            break;
                        case OPEN_P2_UPDATE:
                            openP2Update();
                            break;
                        case OPEN_SDK_MANAGER:
                            openSdkManager();
                            break;
                        }
                    }
                }
            });
        }

        private void openSdkManager() {
            // Windows only: open the standalone external SDK Manager since we know
            // that ADT on Windows is bound to be locking some SDK folders.
            if (SdkConstants.CURRENT_PLATFORM == SdkConstants.PLATFORM_WINDOWS) {
                if (SdkManagerAction.openExternalSdkManager()) {
                    return;
                }
            }

            // Otherwise open the regular SDK Manager bundled within ADT
            if (!SdkManagerAction.openAdtSdkManager()) {
                // We failed because the SDK location is undefined. In this case
                // let's open the preferences instead.
                openAndroidPrefs();
            }
        }

        private void openP2Update() {
            Display disp = getDisplay();
            if (disp == null) {
                return;
            }
            disp.asyncExec(new Runnable() {
                @Override
                public void run() {
                    String cmdId = "org.eclipse.equinox.p2.ui.sdk.update"; //$NON-NLS-1$
                    IWorkbench wb = PlatformUI.getWorkbench();
                    if (wb == null) {
                        return;
                    }

                    ICommandService cs = (ICommandService) wb.getService(ICommandService.class);
                    IHandlerService is = (IHandlerService) wb.getService(IHandlerService.class);
                    if (cs == null || is == null) {
                        return;
                    }

                    Command cmd = cs.getCommand(cmdId);
                    if (cmd != null && cmd.isDefined()) {
                        try {
                            is.executeCommand(cmdId, null/*event*/);
                        } catch (Exception ignore) {
                            AdtPlugin.log(ignore, "Failed to execute command %s", cmdId);
                        }
                    }
                }
            });
        }

        private void openAndroidPrefs() {
            PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(getDisplay().getActiveShell(),
                    "com.android.ide.eclipse.preferences.main", //$NON-NLS-1$ preferencePageId
                    null, // displayedIds
                    null); // data
            dialog.open();
        }
    });
}

From source file:com.aptana.terminal.internal.TerminalCloseHelper.java

License:Open Source License

public static boolean canCloseTerminal(IShellProvider shellProvider, LocalTerminalConnector terminalConnector) {
    List<String> processes = terminalConnector.getRunningProcesses();
    if (processes.size() < 2) {
        return true;
    }/*from   w  ww.j  a  va2 s. c o  m*/

    int closeId = 1;
    MessageDialog dialog = new MessageDialog(shellProvider.getShell(), Messages.TerminalCloseHelper_DialogTitle,
            null, Messages.TerminalCloseHelper_DialogMessage + processes.toString(), MessageDialog.QUESTION,
            new String[] { IDialogConstants.CANCEL_LABEL, IDialogConstants.CLOSE_LABEL }, closeId);
    return dialog.open() == closeId;
}

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

License:Open Source License

/***************************************************************************
 * Create the button bar buttons./*  w ww  .  ja v a 2  s.  com*/
 * 
 * @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.presentation.code.dialogs.SearchDialog.java

License:Open Source License

/***************************************************************************
 * Create the button bar buttons.//from   ww  w.j a v a 2s  .  c  o m
 * 
 * @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.byterefinery.rmbench.dialogs.ConnectionDialog.java

License:Open Source License

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