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

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

Introduction

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

Prototype

int ERROR

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

Click Source Link

Document

Constant for an error message (value 3).

Usage

From source file:ca.mcgill.cs.swevo.qualyzer.editors.pages.InvestigatorEditorPage.java

License:Open Source License

private KeyAdapter createStringLengthValidator(final ScrolledForm form, final String pLabel, final Text pText) {
    return new KeyAdapter() {

        @Override/*from w w w . ja va2  s.c  o m*/
        public void keyReleased(KeyEvent event) {
            StringLengthValidator lValidator = new StringLengthValidator(pLabel, pText.getText().trim());

            if (!lValidator.isValid()) {
                form.setMessage(lValidator.getErrorMessage(), IMessageProvider.ERROR);
                notDirty();
            } else {
                form.setMessage(null, IMessageProvider.NONE);
            }
        }
    };
}

From source file:ca.mcgill.cs.swevo.qualyzer.editors.pages.ParticipantEditorPage.java

License:Open Source License

/**
 * Validates input./*www  .j a  v  a 2 s  .  c  om*/
 * @return
 */
private KeyAdapter createKeyAdapter() {
    return new KeyAdapter() {

        @Override
        public void keyReleased(KeyEvent event) {
            ParticipantValidator lValidator = new ParticipantValidator(fID.getText().trim(),
                    fParticipant.getParticipantId(), fParticipant.getProject());

            if (!lValidator.isValid()) {
                fForm.setMessage(lValidator.getErrorMessage(), IMessageProvider.ERROR);
                notDirty();
            } else {
                fForm.setMessage(null, IMessageProvider.NONE);
            }
        }

    };
}

From source file:ca.mcgill.cs.swevo.qualyzer.editors.pages.ParticipantEditorPage.java

License:Open Source License

private KeyAdapter createStringLengthValidator(final String pLabel, final Text pText) {
    return new KeyAdapter() {

        @Override//from w  ww. j a  va2s.  c o m
        public void keyReleased(KeyEvent event) {
            StringLengthValidator lValidator = new StringLengthValidator(pLabel, pText.getText().trim());

            if (!lValidator.isValid()) {
                fForm.setMessage(lValidator.getErrorMessage(), IMessageProvider.ERROR);
                notDirty();
            } else {
                fForm.setMessage(null, IMessageProvider.NONE);
            }
        }
    };
}

From source file:ca.piggott.p2.site.webview.ui.P2SiteBuilderDialog.java

License:Open Source License

protected void okPressed() {
    try {/*from ww  w. j  av a  2  s  . com*/
        P2SiteBuilder.writeIndex(ProvisioningUI.getDefaultUI().loadMetadataRepository(
                (URI) ((IStructuredSelection) comboViewer.getSelection()).getFirstElement(), false,
                new NullProgressMonitor()), new FileOutputStream(text.getText()), null);
        super.okPressed();
    } catch (ProvisionException e) {
        this.setMessage(e.getStatus().getMessage(), IMessageProvider.ERROR);
        StatusManager.getManager().handle(e.getStatus(), StatusManager.LOG);
    } catch (FileNotFoundException e) {
        this.setMessage("Unable to write to file", IMessageProvider.ERROR);
        StatusManager.getManager().handle(new Status(IStatus.ERROR, "ca.piggott.p2.site.webview.ui",
                "Failed to write to file: " + text.getText(), e), StatusManager.LOG);
    } catch (IOException e) {
        this.setMessage("Error writing to file", IMessageProvider.ERROR);
        StatusManager.getManager().handle(new Status(IStatus.ERROR, "ca.piggott.p2.site.webview.ui",
                "Failed to write to file: " + text.getText(), e), StatusManager.LOG);
    }
}

From source file:ca.usask.cs.srlab.simclipse.clone.comparison.CompareWithOtherResourceDialog.java

License:Open Source License

private void updateErrorInfo() {
    if (okButton != null) {
        if (leftPanel.getResource() == null || rightPanel.getResource() == null) {
            setMessage(CompareMessages.CompareWithOtherResourceDialog_error_empty, IMessageProvider.ERROR);
            okButton.setEnabled(false);//from ww w  .  ja v  a2s.  c  o m
        } else if (!isComparePossible()) {
            setMessage(CompareMessages.CompareWithOtherResourceDialog_error_not_comparable,
                    IMessageProvider.ERROR);
            okButton.setEnabled(false);
        } else {
            setMessage(CompareMessages.CompareWithOtherResourceDialog_info);
            okButton.setEnabled(true);
        }
    }
}

From source file:ch.elexis.core.ui.dialogs.LoginDialog.java

License:Open Source License

@Override
protected void okPressed() {
    if (Anwender.login(usr.getText(), pwd.getText()) == true) {
        super.okPressed();
    } else {//from   w  w  w.  j a  va 2  s . c o  m
        setMessage(Messages.LoginDialog_4, IMessageProvider.ERROR);
        // getButton(IDialogConstants.OK_ID).setEnabled(false);
    }
}

From source file:ch.elexis.dialogs.TerminDialog.java

License:Open Source License

private void enable(final boolean mode) {
    msg = Messages.TerminDialog_editTermins;
    bChange.setEnabled(mode);/*from   ww  w .  j av a 2s.  c  o m*/
    bSave.setEnabled(mode);
    getButton(IDialogConstants.OK_ID).setEnabled(mode);
    slider.setBackground(UiDesk.getColor(UiDesk.COL_LIGHTGREY)); //$NON-NLS-1$

    if (!mode) {
        slider.setBackground(UiDesk.getColor(UiDesk.COL_DARKGREY)); //$NON-NLS-1$
        msg = Messages.TerminDialog_editTermins + "\n\t" + Messages.TerminDialog_collision;
    }

    getShell().getDisplay().asyncExec(new Runnable() {
        @Override
        public void run() {
            setMessage(msg, mode ? IMessageProvider.NONE : IMessageProvider.ERROR);
        }
    });
}

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

License:Open Source License

protected void setErrorInPage(String message) {
    if (message == null) {
        editorPage.setMessage(null, IMessageProvider.NONE);
    } else {/*w  w w . j  av a 2s .co  m*/
        editorPage.setMessage(message, IMessageProvider.ERROR);
    }
}

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

License:Open Source License

public void refreshUI() {
    logError(null);//from   w w w.ja va  2 s  .  c  o m
    resizeTableColumns();

    canUpdate = false;
    DockerFoundryApplicationModule appModule = cloudServer.getExistingCloudModule(module);

    // Refresh the state of the editor regardless of whether there is a
    // module or not
    refreshPublishState(appModule);

    if (appModule == null) {
        return;
    }

    //      if (saveManifest != null) {
    //         ManifestParser parser = new ManifestParser(appModule, cloudServer);
    //         if (!parser.canWriteToManifest()) {
    //            saveManifest.setEnabled(false);
    //            saveManifest.setToolTipText(Messages.ApplicationDetailsPart_TEXT_MANIFEST_SAVE_CREATE_TOOLTIP);
    //         }
    //         else {
    //            saveManifest.setEnabled(true);
    //            saveManifest.setToolTipText(Messages.ApplicationDetailsPart_TEXT_MANIFEST_UPDATE);
    //         }
    //      }

    // The rest of the refresh requires appModule to be non-null
    updateServerNameDisplay(appModule);

    int state = appModule.getState();

    //      instanceSpinner.setSelection(appModule.getInstanceCount());

    //      refreshDeploymentButtons(appModule);

    mappedURIsLink.setEnabled(true);

    CloudApplication cloudApplication = appModule.getApplication();

    //      instanceSpinner.setEnabled(cloudApplication != null);
    instancesViewer.getTable().setEnabled(cloudApplication != null);

    if (this.dockerContainerInfo != null) {
        String ipAddress = this.dockerContainerInfo.getIpAddress();
        String ports = this.dockerContainerInfo.getExposedPortsAsString();
        long cpu = this.dockerContainerInfo.getCpuShares();
        long memory = this.dockerContainerInfo.getMemory();
        String uptime = this.dockerContainerInfo.getUptime();

        instancesViewer.setInput(null);
    } else
        instancesViewer.setInput(null);

    //      memoryText.setEnabled(cloudApplication != null);
    //      if (cloudApplication != null) {
    //         int appMemory = appModule.getApplication().getMemory();
    //
    //         if (appMemory > 0) {
    //            memoryText.setText(appMemory + ""); //$NON-NLS-1$
    //         }
    //      }

    if (this.dockerContainerInfo != null) {
        DockerContainerInfo[] infos = new DockerContainerInfo[1];
        infos[0] = this.dockerContainerInfo;
        instancesViewer.setInput(infos);
    }

    //      if (cloudApplication != null) {
    ////         currentURIs = cloudApplication.getUris();
    //
    //         ApplicationStats applicationStats = appModule.getApplicationStats();
    //         InstancesInfo instancesInfo = appModule.getInstancesInfo();
    //         if (applicationStats != null) {
    //            List<InstanceStats> statss = applicationStats.getRecords();
    //            List<InstanceInfo> infos = instancesInfo != null ? instancesInfo.getInstances() : null;
    //            InstanceStatsAndInfo[] statsAndInfos = new InstanceStatsAndInfo[statss.size()];
    //
    //            for (int i = 0; i < statss.size(); i++) {
    //               InstanceStats stats = statss.get(i);
    //               InstanceInfo info = null;
    //               if (infos != null && infos.size() > i) {
    //                  info = infos.get(i);
    //               }
    //
    //               statsAndInfos[i] = new InstanceStatsAndInfo(stats, info);
    //            }
    //            instancesViewer.setInput(statsAndInfos);
    //         }
    //      }

    //      if (currentURIs == null && !isPublished) {
    //         // At this stage, the app may not have deployed due to errors, but
    //         // there may already
    //         // be set URIs in an existing info
    //         currentURIs = appModule.getDeploymentInfo() != null ? appModule.getDeploymentInfo().getUris() : null;
    //      }
    //
    //      if (currentURIs == null) {
    //         currentURIs = Collections.emptyList();
    //      }
    //
    //      if (!currentURIs.equals(this.appUrls)) {
    //         updateAppUrls(currentURIs);
    //      }
    List<String> currentURIs = new ArrayList<String>();
    if (this.appUrls != null) {
        for (String appUrl : this.appUrls) {
            currentURIs.add(appUrl + "/" + appModule.getName());
        }
    }
    updateAppUrls(currentURIs);
    //      refreshServices(appModule);
    instancesViewer.refresh(true);

    canUpdate = true;

    if (appModule.getErrorMessage() != null) {
        editorPage.setMessage(appModule.getErrorMessage(), IMessageProvider.ERROR);
    } else {
        editorPage.setMessage(null, IMessageProvider.ERROR);
    }
}

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

License:Open Source License

protected void setErrorInPage(String message) {
    if (message == null) {
        setMessage(null, IMessageProvider.NONE);
    } else {/* ww w . j  a va  2  s.c o  m*/
        setMessage(message, IMessageProvider.ERROR);
    }
}