Example usage for org.eclipse.jface.preference PreferenceDialog setMessage

List of usage examples for org.eclipse.jface.preference PreferenceDialog setMessage

Introduction

In this page you can find the example usage for org.eclipse.jface.preference PreferenceDialog setMessage.

Prototype

public void setMessage(String newMessage, int newType) 

Source Link

Document

Sets the message for this dialog with an indication of what type of message it is.

Usage

From source file:org.eclipse.ptp.rdt.ui.wizards.IndexFileLocationWidget.java

License:Open Source License

private void validateIndexLoc() {
    String path = text.getText();
    IRemoteFileSubSystem remoteFileSubSystem = RemoteFileUtility.getFileSubSystem(host);

    // display the message in the property dialog if possible
    Composite parent = text.getParent();
    PreferenceDialog dialog = null;
    while (parent != null && !(parent instanceof Shell))
        parent = parent.getParent();//from www. ja v  a2  s .com
    if (parent instanceof Shell) {
        if (parent.getData() instanceof PreferenceDialog) {
            dialog = (PreferenceDialog) parent.getData();
            dialog.setMessage(null, IMessageProvider.NONE);
        }
    }

    try {
        IRemoteFile currentRemoteFolder = remoteFileSubSystem.getRemoteFileObject(path,
                new NullProgressMonitor());

        if (currentRemoteFolder == null || !currentRemoteFolder.canWrite()) {
            if (dialog != null)
                dialog.setMessage(Messages.getString("InvalidIndexLocationLabel"), IMessageProvider.ERROR); //$NON-NLS-1$
            else
                // just display a dialog
                MessageDialog.openWarning(getShell(), Messages.getString("InvalidIndexLocationTitle"), //$NON-NLS-1$
                        Messages.getString("InvalidIndexLocationLabel")); //$NON-NLS-1$
        }

    } catch (SystemMessageException e1) {
        e1.printStackTrace();
    }
}