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:nz.ac.massey.cs.jquest.views.VisualizationForm.java

License:Open Source License

protected Image getImage(int type) {
    switch (type) {
    case IMessageProvider.ERROR:
        return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_ERROR_TSK);
    case IMessageProvider.WARNING:
        return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_WARN_TSK);
    case IMessageProvider.INFORMATION:
        return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_INFO_TSK);
    }/*  ww  w .  j  a v  a2 s .  c  om*/
    return null;
}

From source file:org.apache.felix.sigil.eclipse.ui.internal.editors.project.VersionRangeComponent.java

License:Apache License

private void setVersions() {
    try {// w w w  .  ja  v  a 2  s  .co m
        if (specificButton.getSelection()) {
            if ("*".equals(specificText.getText())) {
                versions = VersionRange.ANY_VERSION;
            } else if (specificText.getText().trim().length() == 0) {
                versions = null;
            } else {
                Version v = VersionTable.getVersion(specificText.getText().trim());
                versions = new VersionRange(false, v, v, false);
            }
        } else {
            Version min = VersionTable.getVersion(minimumText.getText());
            Version max = "*".equals(maximumText.getText()) ? VersionRange.INFINITE_VERSION
                    : VersionTable.getVersion(maximumText.getText());
            versions = new VersionRange(!minInclusiveButton.getSelection(), min, max,
                    !maxInclusiveButton.getSelection());
        }
        fireValidationMessage(null, IMessageProvider.NONE);
    } catch (IllegalArgumentException e) {
        versions = null;
        fireValidationMessage("Invalid version", IMessageProvider.ERROR);
    }

    fireVersionChange();
}

From source file:org.apache.felix.sigil.ui.eclipse.ui.editors.project.VersionRangeComponent.java

License:Apache License

private void setVersions() {
    try {// w  w w.  jav  a  2  s .  com
        if (specificButton.getSelection()) {
            if ("*".equals(specificText.getText())) {
                versions = VersionRange.ANY_VERSION;
            } else if (specificText.getText().trim().length() == 0) {
                versions = null;
            } else {
                Version v = Version.parseVersion(specificText.getText().trim());
                versions = new VersionRange(false, v, v, false);
            }
        } else {
            Version min = Version.parseVersion(minimumText.getText());
            Version max = "*".equals(maximumText.getText()) ? VersionRange.INFINITE_VERSION
                    : Version.parseVersion(maximumText.getText());
            versions = new VersionRange(!minInclusiveButton.getSelection(), min, max,
                    !maxInclusiveButton.getSelection());
        }
        fireValidationMessage(null, IMessageProvider.NONE);
    } catch (IllegalArgumentException e) {
        versions = null;
        fireValidationMessage("Invalid version", IMessageProvider.ERROR);
    }

    fireVersionChange();
}

From source file:org.apache.hadoop.eclipse.servers.HadoopLocationWizard.java

License:Apache License

/**
 * Performs any actions appropriate in response to the user having pressed
 * the Finish button, or refuse if finishing now is not permitted.
 * //from w  w w.  j a  va  2 s .c o  m
 * @return the created or updated Hadoop location
 */

public HadoopServer performFinish() {
    try {
        if (this.original == null) {
            // New location
            Display.getDefault().syncExec(new Runnable() {
                public void run() {
                    ServerRegistry.getInstance().addServer(HadoopLocationWizard.this.location);
                }
            });
            return this.location;

        } else {
            // Update location
            final String originalName = this.original.getLocationName();
            this.original.load(this.location);

            Display.getDefault().syncExec(new Runnable() {
                public void run() {
                    ServerRegistry.getInstance().updateServer(originalName, HadoopLocationWizard.this.location);
                }
            });
            return this.original;

        }
    } catch (Exception e) {
        e.printStackTrace();
        setMessage("Invalid server location values", IMessageProvider.ERROR);
        return null;
    }
}

From source file:org.apache.hdt.debug.core.cluster.HadoopLocationWizard.java

License:Apache License

/**
 * Performs any actions appropriate in response to the user having pressed
 * the Finish button, or refuse if finishing now is not permitted.
 * //from   www  . j a v  a 2 s .  c  om
 * @return the created or updated Hadoop location
 */

public HadoopCluster performFinish() {
    try {
        if (this.original == null) {
            // New location
            Display.getDefault().syncExec(new Runnable() {
                public void run() {
                    ServerRegistry.getInstance().addServer(HadoopLocationWizard.this.location);
                }
            });
            return this.location;

        } else {
            // Update location
            final String originalName = this.original.getLocationName();
            this.original.load(this.location);

            Display.getDefault().syncExec(new Runnable() {
                public void run() {
                    ServerRegistry.getInstance().updateServer(originalName, HadoopLocationWizard.this.location);
                }
            });
            return this.original;

        }
    } catch (Exception e) {
        e.printStackTrace();
        setMessage("Invalid server location values", IMessageProvider.ERROR);
        return null;
    }
}

From source file:org.apache.ivyde.eclipse.resolvevisualizer.MessageContentProvider.java

License:Apache License

/**
 * Called when the view selection changes and the message list needs to be rebuilt.
 *//*from w  w w.j  a  v  a  2s  .  c o m*/
public void selectionChanged(IvyNodeElement root) {
    if (root == null) {
        return;
    }
    manager.removeAllMessages();

    Map/* <ModuleId, Collection<IvyNodeElement>> */ conflicts = new HashMap/* <ModuleId, Collection<IvyNodeElement>> */();

    IvyNodeElement[] deepDependencies = root.getDeepDependencies();
    for (int i = 0; i < deepDependencies.length; i++) {
        if (deepDependencies[i].getConflicts().length > 0) {
            Collection/* <IvyNodeElement> */ conflictParticipants = (Collection) conflicts
                    .get(deepDependencies[i].getModuleRevisionId().getModuleId());
            if (conflictParticipants == null)
                conflictParticipants = new HashSet/* <IvyNodeElement> */();
            conflictParticipants.add(deepDependencies[i]);
            conflicts.put(deepDependencies[i].getModuleRevisionId().getModuleId(), conflictParticipants);
        }
    }

    for (Iterator conflictIter = conflicts.keySet().iterator(); conflictIter.hasNext();) {
        ModuleId conflictKey = (ModuleId) conflictIter.next();
        manager.addMessage(conflictKey,
                "Conflict on module " + conflictKey.getOrganisation() + "#" + conflictKey.getName(),
                conflicts.get(conflictKey), IMessageProvider.ERROR);
    }
}

From source file:org.apache.ivyde.eclipse.resolvevisualizer.ResolveVisualizerForm.java

License:Apache License

private Image getImage(int type) {
    switch (type) {
    case IMessageProvider.ERROR:
        return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_ERROR_TSK);
    case IMessageProvider.WARNING:
        return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_WARN_TSK);
    case IMessageProvider.INFORMATION:
        return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_INFO_TSK);
    }//  ww w.  ja v a 2 s  . c  om
    return null;
}

From source file:org.apache.ivyde.eclipse.resolvevisualizer.ResolveVisualizerForm.java

License:Apache License

private void configureFormText(final Form form, FormText text) {
    text.addHyperlinkListener(new HyperlinkAdapter() {
        public void linkActivated(HyperlinkEvent e) {
            String is = (String) e.getHref();
            try {
                ((FormText) e.widget).getShell().dispose();
                int index = Integer.parseInt(is);
                IMessage[] messages = form.getChildrenMessages();
                IMessage message = messages[index];
                Set/* <IvyNodeElement> */ conflicts = (Set/* <IvyNodeElement> */) message.getData();
                if (conflicts != null) {
                    viewer.setSelection(new StructuredSelection(new ArrayList(conflicts)));
                }/* ww w  .j  a  v  a2  s .  c  o m*/
            } catch (NumberFormatException ex) {
            }
        }
    });
    text.setImage("error", getImage(IMessageProvider.ERROR));
    text.setImage("warning", getImage(IMessageProvider.WARNING));
    text.setImage("info", getImage(IMessageProvider.INFORMATION));
}

From source file:org.apache.sling.ide.eclipse.ui.wizards.AbstractNewSlingApplicationWizard.java

License:Apache License

public void reportError(CoreException e) {
    WizardPage currentPage = getCurrentWizardPage();
    if (currentPage != null) {
        currentPage.setMessage(e.getMessage(), IMessageProvider.ERROR);
    } else {//  w  w  w.  j  a  va  2 s  .c  om
        MessageDialog.openError(getShell(), "Unexpected error", e.getMessage());
    }

    Activator.getDefault().getLog().log(e.getStatus());
}

From source file:org.apache.sling.ide.eclipse.ui.wizards.np.AbstractNewSlingApplicationWizard.java

License:Apache License

protected void reportError(CoreException e) {
    WizardPage currentPage = getCurrentWizardPage();
    if (currentPage != null) {
        currentPage.setMessage(e.getMessage(), IMessageProvider.ERROR);
    } else {//from   w w w .  j  a va2 s  .  c  o m
        MessageDialog.openError(getShell(), "Unexpected error", e.getMessage());
    }

    Activator.getDefault().getLog().log(e.getStatus());
}