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

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

Introduction

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

Prototype

int NONE

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

Click Source Link

Document

Constant for a regular message (value 0).

Usage

From source file:com.siteview.mde.internal.ui.editor.validation.AbstractControlValidator.java

License:Open Source License

public static int getMessageType(IStatus status) {
    int severity = status.getSeverity();
    // Translate severity to the equivalent message provider type
    if (severity == IStatus.OK) {
        return IMessageProvider.NONE;
    } else if (severity == IStatus.ERROR) {
        return IMessageProvider.ERROR;
    } else if (severity == IStatus.WARNING) {
        return IMessageProvider.WARNING;
    } else if (severity == IStatus.INFO) {
        return IMessageProvider.INFORMATION;
    }/*from   w w  w. ja  v a 2 s .  c  o m*/
    // IStatus.CANCEL
    return IMessageProvider.NONE;
}

From source file:com.siteview.mde.internal.ui.editor.validation.AbstractControlValidator.java

License:Open Source License

public static int getMessageType(IProject project, String compilerFlagId) {
    int severity = CompilerFlags.getFlag(project, compilerFlagId);
    // Translate severity to the equivalent message provider type
    if (severity == CompilerFlags.IGNORE) {
        return IMessageProvider.NONE;
    } else if (severity == CompilerFlags.ERROR) {
        return IMessageProvider.ERROR;
    } else {//from w w w .j a  v a  2s  .  c om
        // CompilerFlags.WARNING
        return IMessageProvider.WARNING;
    }
}

From source file:com.siteview.mde.internal.ui.editor.validation.ControlValidationUtility.java

License:Open Source License

public static boolean validateTranslatableField(String value, IValidatorMessageHandler validator,
        IMonitorModelBase model, IProject project) {

    // Check the compiler flag and translate it into a message type
    int messageType = AbstractControlValidator.getMessageType(project, CompilerFlags.P_NOT_EXTERNALIZED);
    // If the message type is none, no validation is required
    // Same as IGNORE
    if (messageType == IMessageProvider.NONE) {
        return true;
    }/* w  ww .  j  a  v a 2  s . c om*/

    // Check to see if the name has been externalized
    if (value.startsWith("%") == false) { //$NON-NLS-1$
        validator.addMessage(MDEUIMessages.ControlValidationUtility_errorMsgValueNotExternalized, messageType);
        return false;
    }

    // Check to see if the key is in the plugin's property file
    if (model instanceof AbstractNLModel) {
        NLResourceHelper helper = ((AbstractNLModel) model).getNLResourceHelper();
        if ((helper == null) || (helper.resourceExists(value) == false)) {
            validator.addMessage(MDEUIMessages.ControlValidationUtility_errorMsgKeyNotFound, messageType);
            return false;
        }
    }
    return true;
}

From source file:com.siteview.mde.internal.ui.editor.validation.ControlValidationUtility.java

License:Open Source License

public static boolean validateActivatorField(String value, IValidatorMessageHandler validator,
        IProject project) {/* ww  w  .  j  av  a 2  s.c  o m*/

    // Check the compiler flag and translate it into a message type
    int messageType = AbstractControlValidator.getMessageType(project, CompilerFlags.P_UNKNOWN_CLASS);
    // If the message type is none, no validation is required
    // Same as IGNORE
    if (messageType == IMessageProvider.NONE) {
        return true;
    }

    // Check to see if the class is on the plug-in classpath
    try {
        if (project.hasNature(JavaCore.NATURE_ID)) {
            IJavaProject javaProject = JavaCore.create(project);
            // Look for this activator in the project's classpath
            if (!PDEJavaHelper.isOnClasspath(value, javaProject)) {
                validator.addMessage(MDEUIMessages.ControlValidationUtility_errorMsgNotOnClasspath,
                        messageType);
                return false;
            }
        }
    } catch (CoreException ce) {
        // Ignore
    }

    return true;
}

From source file:com.siteview.mde.internal.ui.editor.validation.ControlValidationUtility.java

License:Open Source License

public static boolean validateFragmentHostPluginField(String value, IValidatorMessageHandler validator,
        IProject project) {/* w  w w . j  a v a  2 s.com*/

    // Check the compiler flag and translate it into a message type
    // If the message type is none, it is the same as IGNORE
    int reqAttMessageType = AbstractControlValidator.getMessageType(project, CompilerFlags.P_NO_REQUIRED_ATT);
    // Check to see if the host plug-in was defined
    if ((reqAttMessageType != IMessageProvider.NONE)
            && validateRequiredField(value, validator, reqAttMessageType) == false) {
        return false;
    }
    // Check the compiler flag and translate it into a message type
    int unresImpMessageType = AbstractControlValidator.getMessageType(project,
            CompilerFlags.P_UNRESOLVED_IMPORTS);
    // If the message type is none, no validation is required
    // Same as IGNORE      
    if (unresImpMessageType == IMessageProvider.NONE) {
        return true;
    }
    // Check to see if the host plugin is defined, enabled and not a 
    // fragment itself
    IMonitorModelBase hostModel = MonitorRegistry.findModel(value);
    if ((hostModel == null) || (hostModel instanceof IFragmentModel) || (hostModel.isEnabled() == false)) {
        validator.addMessage(MDEUIMessages.ControlValidationUtility_errorMsgPluginUnresolved,
                unresImpMessageType);
        return false;
    }

    return true;
}

From source file:com.sonatype.buildserver.eclipse.ui.job.view.SummaryPage.java

License:Open Source License

public void setJob(HudsonJob job) {
    this.job = job;
    if (!initialized) {
        return;/*from  w w  w.  ja  v  a2 s .c om*/
    }
    form.setText(job.getJobName());
    form.getForm().setMessage(null, IMessageProvider.NONE);
    form.setImage(HudsonImages.getHealthImage(job));

    if (tableViewer.getInput() == null) {
        tableViewer.setInput(job);
    }

    lnkJobName.setText(NLS.bind(Messages.SummaryPage_job_link, job.getJobName()));

    lnkServerLocation.setText(NLS.bind(Messages.SummaryPage_build_on, job.getServerName()));
    lnkServerLocation.setToolTipText(NLS.bind(Messages.SummaryPage_build_on_tooltip, job.getServerName()));
    ProjectDTO details = job.getJobDetails();
    if (details != null && !(details instanceof ErrorJob)) {
        if (details.isQueued()) {
            form.setText(job.getJobName() + " [New build queued]");
        }

        markAsVisible(lblEnable, true);
        lblEnable.setText(details.isEnabled() ? Messages.SummaryPage_enabled : Messages.SummaryPage_disabled);
        if (details.isBlocked()) {
            lblBlocked.setText(Messages.SummaryPage_blocked + details.getBlockedReason() + "\" "); //$NON-NLS-2$
            markAsVisible(lblBlocked, true);
        } else {
            markAsVisible(lblBlocked, false);
        }
        markAsVisible(lblType, true);
        lblType.setText(getTypeStrings(details));
        form.setToolTipText(details.getHealth().getDescription());
        lnkJobName.setToolTipText(NLS.bind(Messages.SummaryPage_job_tooltip, details.getUrl()));
        String desc = details.getDescription();
        if (desc == null || desc.trim().length() == 0) {
            desc = Messages.SummaryPage_no_description;
        }
        markAsVisible(txtDescription, true);
        txtDescription.setText(HudsonUtils.stripHtml(desc));
        // only force last build if no build is selected in table,
        // useful on refreshes/updates when user has some context selected
        if (tableViewer.getSelection().isEmpty()) {
            setBuild(details.getLastBuild());
        }
        if (HudsonUtils.isMatrixType(details)) {
            markAsVisible(sctnConfigurations, true);
            loadConfigurations();
            composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1));
            txtDescription.setLayoutData(createTxtDescriptionData(2));
        } else {
            markAsVisible(sctnConfigurations, false);
            composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 3, 1));
            txtDescription.setLayoutData(createTxtDescriptionData(3));
        }
        if (HudsonUtils.isMatrixConfig(details)) {
            markAsVisible(mghprlnkParent, true);
        } else {
            markAsVisible(mghprlnkParent, false);
        }

        // System.out.println("type=" + details.getType());
        // System.out.println("job name=" + details.getLastBuild().getJobName());
        // System.out.println("id=" + details.getLastBuild().getId());
        // System.out.println("url=" + details.getLastBuild().getUrl());
        //
        //
    } else {
        if (details instanceof ErrorJob) {
            ErrorJob ej = (ErrorJob) details;
            form.getForm().setMessage(ej.getErrorMessage(), IMessageProvider.ERROR);
        }
        markAsVisible(lblType, false);
        markAsVisible(lblBlocked, false);
        markAsVisible(lblEnable, false);
        markAsVisible(txtDescription, false);
        markAsVisible(sctnConfigurations, false);
        markAsVisible(mghprlnkParent, false);
        setBuild(null);
    }
    compJob.layout();
}

From source file:com.testingtech.ttworkbench.utp.ttcn3.importer.ModelImporterSelectionPage.java

License:Open Source License

public void selectionChanged(SelectionChangedEvent event) {
    ISelection selection = event.getSelection();
    if (!selection.isEmpty() && selection instanceof IStructuredSelection) {
        Object selectedObject = ((IStructuredSelection) selection).getFirstElement();
        if (selectedObject instanceof IForeignModelImporterDescriptor) {
            descriptor = (IForeignModelImporterDescriptor) selectedObject;

            setMessage(descriptor.getDescription(), IMessageProvider.NONE);
            setSelectedNode((IWizardNode) modelImporterManager.getNode(descriptor));
            return;
        }//from w  w w  . j a  va2s .  c om
    }

    setPageComplete(false);
}

From source file:com.vmware.vfabric.ide.eclipse.tcserver.internal.ui.TcServer20WizardFragment.java

License:Open Source License

protected void validate() {
    if (wc == null) {
        wizard.setMessage("", IMessageProvider.ERROR);
        return;// w ww .  j a  va  2s.  c  o m
    }

    IStatus status = doValidate();
    if (status == null || status.isOK()) {
        wizard.setMessage(null, IMessageProvider.NONE);
    } else if (status.getSeverity() == IStatus.WARNING) {
        wizard.setMessage(status.getMessage(), IMessageProvider.WARNING);
    } else {
        wizard.setMessage(status.getMessage(), IMessageProvider.ERROR);
    }
    wizard.update();
}

From source file:com.vmware.vfabric.ide.eclipse.tcserver.internal.ui.TcServer21InstanceCreationFragment.java

License:Open Source License

protected void validate() {
    if (nameText.getText().trim().length() == 0) {
        wizardHandle.setMessage(TcServerInstanceConfiguratorPage.ENTER_NAME, IMessageProvider.NONE);
    } else if (!isDefaultLocationSelected() && !isValidLocation(locationPathField.getText())) {
        wizardHandle.setMessage(LOCATION_DOES_NOT_EXIST_MESSAGE, IMessageProvider.ERROR);
    } else if (instanceExists()) {
        wizardHandle.setMessage(TcServerInstanceConfiguratorPage.INSTANCE_EXISTS, IMessageProvider.ERROR);
    } else if (hasInvalidCharacters(nameText.getText())) {
        wizardHandle.setMessage(TcServerInstanceConfiguratorPage.ILLEGAL_SERVER_NAME, IMessageProvider.ERROR);
    } else if (templateViewer.getCheckedElements().length == 0) {
        wizardHandle.setMessage(SELECT_TEMPLATE_MESSAGE, IMessageProvider.NONE);
    } else {/*www .  j  a  va  2 s. c o  m*/
        wizardHandle.setMessage(null, IMessageProvider.NONE);
    }
    setComplete(wizardHandle.getMessage() == null);
    wizardHandle.update();
}

From source file:com.vmware.vfabric.ide.eclipse.tcserver.internal.ui.TcServer21WizardFragment.java

License:Open Source License

protected void validate() {
    if (!newInstanceButton.getSelection() && serverNameCombo.getText().length() == 0) {
        wizard.setMessage(SPECIFY_TC_SERVER_INSTANCE_MESSAGE, IMessageProvider.NONE);
        setComplete(false);/*from w  w  w.  j  ava  2 s .c om*/
        return;
    }

    if (wc == null) {
        wizard.setMessage("", IMessageProvider.ERROR);
        setComplete(false);
        return;
    }

    IStatus status = doValidate();
    if (status == null || status.isOK()) {
        wizard.setMessage(null, IMessageProvider.NONE);
        setComplete(true);
    } else if (status.getSeverity() == IStatus.INFO) {
        wizard.setMessage(status.getMessage(), IMessageProvider.NONE);
        setComplete(false);
    } else if (status.getSeverity() == IStatus.WARNING) {
        wizard.setMessage(status.getMessage(), IMessageProvider.WARNING);
        setComplete(true);
    } else {
        wizard.setMessage(status.getMessage(), IMessageProvider.ERROR);
        setComplete(false);
    }
    updateDescription(status);
    wizard.update();
}