Example usage for org.eclipse.jface.dialogs IMessageProvider WARNING

List of usage examples for org.eclipse.jface.dialogs IMessageProvider WARNING

Introduction

In this page you can find the example usage for org.eclipse.jface.dialogs IMessageProvider WARNING.

Prototype

int WARNING

To view the source code for org.eclipse.jface.dialogs IMessageProvider WARNING.

Click Source Link

Document

Constant for a warning message (value 2).

Usage

From source file:ca.mcgill.cs.swevo.qualyzer.dialogs.MemoDeleteDialog.java

License:Open Source License

@Override
public void create() {
    super.create();
    setTitle(Messages.getString("dialogs.MemoDeleteDialog.deleteMemo")); //$NON-NLS-1$
    if (fIsPlural) {
        setMessage(Messages.getString("dialogs.MemoDeleteDialog.warning_plural"), //$NON-NLS-1$
                IMessageProvider.WARNING);
    } else {//from   w  w  w.  j  a  v  a2 s.c  om
        setMessage(Messages.getString("dialogs.MemoDeleteDialog.warning"), //$NON-NLS-1$
                IMessageProvider.WARNING);
    }
}

From source file:ca.mcgill.cs.swevo.qualyzer.dialogs.RenameProjectDialog.java

License:Open Source License

@Override
public void create() {
    super.create();
    setTitle(Messages.getString("dialogs.RenameProjectDialog.renameProject")); //$NON-NLS-1$
    setMessage(Messages.getString("dialogs.RenameProjectDialog.warning"), IMessageProvider.WARNING); //$NON-NLS-1$
}

From source file:ca.mcgill.cs.swevo.qualyzer.dialogs.TranscriptDeleteDialog.java

License:Open Source License

@Override
public void create() {
    super.create();
    setTitle(Messages.getString("dialogs.TranscriptDeleteDialog.deleteTrancript")); //$NON-NLS-1$
    if (fIsPlural) {
        setMessage(Messages.getString("dialogs.TranscriptDeleteDialog.warning_plural"), //$NON-NLS-1$
                IMessageProvider.WARNING);
    } else {/*from   w  w  w  .  j a v a 2  s. c  om*/
        setMessage(Messages.getString("dialogs.TranscriptDeleteDialog.warning"), //$NON-NLS-1$
                IMessageProvider.WARNING);
    }

}

From source file:ca.mcgill.cs.swevo.qualyzer.dialogs.TranscriptPropertiesDialog.java

License:Open Source License

/**
 * Opens the file chooser for the audio file.
 * @return/*ww w .  ja  v  a 2 s .c  o  m*/
 */
private SelectionAdapter createSelectionAdapter() {
    return new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent event) {
            FileDialog dialog = new FileDialog(getShell());
            dialog.setFilterExtensions(new String[] { "*.mp3;*.wav" }); //$NON-NLS-1$
            dialog.setFilterNames(
                    new String[] { Messages.getString("dialogs.TranscriptPropertiesDialog.audioExt") }); //$NON-NLS-1$

            fAudioPath = dialog.open();
            if (fAudioPath != null) {
                setMessage(Messages.getString("dialogs.TranscriptPropertiesDialog.warning1") + //$NON-NLS-1$
                Messages.getString("dialogs.TranscriptPropertiesDialog.warning2"), //$NON-NLS-1$
                        IMessageProvider.WARNING);
                fAudioLabel.setText(fAudioPath);
            }
        }

    };
}

From source file:cn.dockerfoundry.ide.eclipse.server.ui.internal.actions.EditorAction.java

License:Open Source License

protected void setMessageInPage(IStatus status) {
    String message = status.getMessage();
    int providerStatus = IMessageProvider.NONE;
    switch (status.getSeverity()) {
    case IStatus.INFO:
        providerStatus = IMessageProvider.INFORMATION;
        break;//from  ww  w  .j a  v  a2  s  .  co m
    case IStatus.WARNING:
        providerStatus = IMessageProvider.WARNING;
        break;
    }

    editorPage.setMessage(message, providerStatus);
}

From source file:cn.dockerfoundry.ide.eclipse.server.ui.internal.editor.DockerFoundryApplicationsEditorPage.java

License:Open Source License

protected void setMessageInPage(IStatus status) {
    String message = status.getMessage();
    int providerStatus = IMessageProvider.NONE;
    switch (status.getSeverity()) {
    case IStatus.INFO:
        providerStatus = IMessageProvider.INFORMATION;
        break;//from  w  w w.  jav  a  2 s.  c  o  m
    case IStatus.WARNING:
        providerStatus = IMessageProvider.WARNING;
        break;
    }

    setMessage(message, providerStatus);
}

From source file:cn.ieclipse.pde.signer.wizard.SignJarPage.java

License:Apache License

protected void onDestPackageChanged() {
    if (getDestPackage().length() == 0 || getDestPackage().equals(getSourcePackage())) {
        setMessage("The dest package is same as source package or none, it will overwrite source package",
                IMessageProvider.WARNING);
    } else {/*from  w  ww.j  a v  a 2  s.  c  o  m*/
        setMessage(null);
    }
}

From source file:com.abstratt.graphviz.ui.GraphVizPreferencePage.java

License:Open Source License

public void dotBrowserChanged(String newText) {
    setErrorMessage(null);/*from   w w  w  .j a  v a2  s .c  o  m*/
    setMessage(null);
    if (newText == null) {
        newText = dotBrowser.getText();
    }
    if (specifyDotButton.getSelection()) {
        if (newText.length() == 0) {
            setErrorMessage("Please enter a path.");
            setValid(false);
            return;
        }
        File dotFile = new File(newText);
        String fileName = dotFile.getName();
        int extensionPos;
        while ((extensionPos = fileName.lastIndexOf('.')) > 0)
            fileName = fileName.substring(0, extensionPos);
        if (!dotFile.exists()) {
            setErrorMessage(newText + " doesn't exist");
            setValid(false);
            return;
        } else if (dotFile.isDirectory()) {
            setErrorMessage(newText + " is a directory");
            setValid(false);
            return;
        } else if (!GraphVizActivator.isExecutable(dotFile))
            setMessage(newText + " is not executable!", IMessageProvider.WARNING);
        else if (!GraphVizActivator.DOT_FILE_NAME.equalsIgnoreCase(fileName))
            setMessage("The file name should be " + GraphVizActivator.DOT_FILE_NAME, IMessageProvider.WARNING);
    }
    setValid(true);
}

From source file:com.android.ide.eclipse.adt.internal.welcome.WelcomeWizardPage.java

License:Open Source License

private void validatePage() {
    String error = null;/* w  w w. j  a v  a2 s . c  om*/
    String warning = null;

    if (isCreateNew()) {
        // Make sure that the target installation directory is empty or doesn't exist
        // (and that it can be created)
        String path = mNewDirText.getText().trim();
        if (path.length() == 0) {
            error = "Please enter a new directory to install the SDK into";
        } else {
            File file = new File(path);
            if (file.exists()) {
                if (file.isDirectory()) {
                    if (!file.canWrite()) {
                        error = "Missing write permission in target directory";
                    }
                    File[] children = file.listFiles();
                    if (children != null && children.length > 0) {
                        warning = "The directory is not empty";
                    }
                } else {
                    error = "The target must be a directory";
                }
            } else {
                File parent = file.getParentFile();
                if (parent == null || !parent.exists()) {
                    error = "The parent directory does not exist";
                } else if (!parent.canWrite()) {
                    error = "No write permission in parent directory";
                }
            }
        }

        if (error == null && !mInstallLatestCheckbox.getSelection() && !mInstallCommonCheckbox.getSelection()) {
            error = "You must choose at least one Android version to install";
        }
    } else {
        // Make sure that the existing installation directory exists and is valid
        String path = mExistingDirText.getText().trim();
        if (path.length() == 0) {
            error = "Please enter an existing SDK installation directory";
        } else {
            File file = new File(path);
            if (!file.exists()) {
                error = "The chosen installation directory does not exist";
            } else {
                final AtomicReference<String> errorReference = new AtomicReference<String>();
                final AtomicReference<String> warningReference = new AtomicReference<String>();
                AdtPlugin.getDefault().checkSdkLocationAndId(path, new AdtPlugin.CheckSdkErrorHandler() {
                    @Override
                    public boolean handleError(CheckSdkErrorHandler.Solution solution, String message) {
                        message = message.replaceAll("\n", " "); //$NON-NLS-1$ //$NON-NLS-2$
                        errorReference.set(message);
                        return false; // Apply/OK must be disabled
                    }

                    @Override
                    public boolean handleWarning(CheckSdkErrorHandler.Solution solution, String message) {
                        message = message.replaceAll("\n", " "); //$NON-NLS-1$ //$NON-NLS-2$
                        warningReference.set(message);
                        return true; // Apply/OK must be enabled
                    }
                });
                error = errorReference.get();
                if (warning == null) {
                    warning = warningReference.get();
                }
            }
        }
    }

    setPageComplete(error == null);
    if (error != null) {
        setMessage(error, IMessageProvider.ERROR);
    } else if (warning != null) {
        setMessage(warning, IMessageProvider.WARNING);
    } else {
        setErrorMessage(null);
        setMessage(null);
    }
}

From source file:com.android.ide.eclipse.adt.internal.wizards.newproject.ApplicationInfoPage.java

License:Open Source License

private void validatePage() {
    IStatus status = validatePackage(mValues.packageName);
    if (status == null || status.getSeverity() != IStatus.ERROR) {
        IStatus validActivity = validateActivity();
        if (validActivity != null) {
            status = validActivity;/*from   ww w  .j a v a 2 s  . co m*/
        }
    }
    if (status == null || status.getSeverity() != IStatus.ERROR) {
        IStatus validMinSdk = validateMinSdk();
        if (validMinSdk != null) {
            status = validMinSdk;
        }
    }

    if (status == null || status.getSeverity() != IStatus.ERROR) {
        IStatus validSourceFolder = validateSourceFolder();
        if (validSourceFolder != null) {
            status = validSourceFolder;
        }
    }

    // If creating a test project to go along with the main project, also validate
    // the additional test project parameters
    if (status == null || status.getSeverity() != IStatus.ERROR) {
        if (mValues.createPairProject) {
            IStatus validTestProject = ProjectNamePage.validateProjectName(mValues.testProjectName);
            if (validTestProject != null) {
                status = validTestProject;
            }

            if (status == null || status.getSeverity() != IStatus.ERROR) {
                IStatus validTestLocation = validateTestProjectLocation();
                if (validTestLocation != null) {
                    status = validTestLocation;
                }
            }

            if (status == null || status.getSeverity() != IStatus.ERROR) {
                IStatus validTestPackage = validatePackage(mValues.testPackageName);
                if (validTestPackage != null) {
                    status = new Status(validTestPackage.getSeverity(), AdtPlugin.PLUGIN_ID,
                            validTestPackage.getMessage() + " (in test package)");
                }
            }

            if (status == null || status.getSeverity() != IStatus.ERROR) {
                if (mValues.projectName.equals(mValues.testProjectName)) {
                    status = new Status(IStatus.ERROR, AdtPlugin.PLUGIN_ID,
                            "The main project name and the test project name must be different.");
                }
            }
        }
    }

    // -- update UI & enable finish if there's no error
    setPageComplete(status == null || status.getSeverity() != IStatus.ERROR);
    if (status != null) {
        setMessage(status.getMessage(),
                status.getSeverity() == IStatus.ERROR ? IMessageProvider.ERROR : IMessageProvider.WARNING);
    } else {
        setErrorMessage(null);
        setMessage(null);
    }
}