Search in sources :

Example 96 with Status

use of org.eclipse.core.runtime.Status in project sling by apache.

the class ProjectUtil method loadFilter.

/**
     * Loads a filter for the specified project
     * 
     * @param project the project to find a filter for
     * @return the found filter or null
     * @throws CoreException
     */
public static Filter loadFilter(final IProject project) throws CoreException {
    FilterLocator filterLocator = Activator.getDefault().getFilterLocator();
    IPath filterPath = findFilterPath(project);
    if (filterPath == null) {
        return null;
    }
    IFile filterFile = ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(filterPath);
    Filter filter = null;
    if (filterFile != null && filterFile.exists()) {
        try (InputStream contents = filterFile.getContents()) {
            filter = filterLocator.loadFilter(contents);
        } catch (IOException e) {
            throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Failed loading filter file for project " + project.getName() + " from location " + filterFile, e));
        }
    }
    return filter;
}
Also used : Status(org.eclipse.core.runtime.Status) IStatus(org.eclipse.core.runtime.IStatus) FilterLocator(org.apache.sling.ide.filter.FilterLocator) IFile(org.eclipse.core.resources.IFile) IPath(org.eclipse.core.runtime.IPath) CoreException(org.eclipse.core.runtime.CoreException) Filter(org.apache.sling.ide.filter.Filter) InputStream(java.io.InputStream) IOException(java.io.IOException)

Example 97 with Status

use of org.eclipse.core.runtime.Status in project sling by apache.

the class AbstractNewSlingApplicationWizard method reportError.

public void reportError(Throwable t) {
    if (t instanceof CoreException) {
        reportError((CoreException) t);
        return;
    }
    IStatus status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, t.getMessage(), t);
    reportError(new CoreException(status));
}
Also used : IStatus(org.eclipse.core.runtime.IStatus) Status(org.eclipse.core.runtime.Status) IStatus(org.eclipse.core.runtime.IStatus) CoreException(org.eclipse.core.runtime.CoreException)

Example 98 with Status

use of org.eclipse.core.runtime.Status in project bndtools by bndtools.

the class Plugin method report.

public static void report(boolean warnings, @SuppressWarnings("unused") boolean acknowledge, Processor reporter, final String title, final String extra) {
    if (reporter.getErrors().size() > 0 || (warnings && reporter.getWarnings().size() > 0)) {
        final StringBuffer sb = new StringBuffer();
        sb.append("\n");
        if (reporter.getErrors().size() > 0) {
            sb.append("[Errors]\n");
            for (String msg : reporter.getErrors()) {
                sb.append(msg);
                sb.append("\n");
            }
        }
        sb.append("\n");
        if (reporter.getWarnings().size() > 0) {
            sb.append("[Warnings]\n");
            for (String msg : reporter.getWarnings()) {
                sb.append(msg);
                sb.append("\n");
            }
        }
        final Status s = new Status(Status.ERROR, PLUGIN_ID, 0, sb.toString(), null);
        reporter.clear();
        async(new Runnable() {

            @Override
            public void run() {
                ErrorDialog.openError(null, title, title + "\n" + extra, s);
            }
        });
    } else {
        message(title + " : ok");
    }
}
Also used : Status(org.eclipse.core.runtime.Status)

Example 99 with Status

use of org.eclipse.core.runtime.Status in project bndtools by bndtools.

the class Plugin method warning.

public static void warning(List<String> errors) {
    final StringBuffer sb = new StringBuffer();
    for (String msg : errors) {
        sb.append(msg);
        sb.append("\n");
    }
    async(new Runnable() {

        @Override
        public void run() {
            Status s = new Status(Status.WARNING, PLUGIN_ID, 0, "", null);
            ErrorDialog.openError(null, "Warnings during bundle generation", sb.toString(), s);
        }
    });
}
Also used : Status(org.eclipse.core.runtime.Status)

Example 100 with Status

use of org.eclipse.core.runtime.Status in project bndtools by bndtools.

the class Plugin method error.

public void error(final String msg, final Throwable t) {
    Status s = new Status(Status.ERROR, PLUGIN_ID, 0, msg, t);
    getLog().log(s);
    async(new Runnable() {

        @Override
        public void run() {
            if (!busy.compareAndSet(false, true)) {
                Status s = new Status(Status.ERROR, PLUGIN_ID, 0, "", null);
                ErrorDialog.openError(null, "Errors during bundle generation", msg + " " + t.getMessage(), s);
                busy.set(false);
            }
        }
    });
}
Also used : Status(org.eclipse.core.runtime.Status)

Aggregations

Status (org.eclipse.core.runtime.Status)305 IStatus (org.eclipse.core.runtime.IStatus)282 CoreException (org.eclipse.core.runtime.CoreException)132 IOException (java.io.IOException)66 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)64 InvocationTargetException (java.lang.reflect.InvocationTargetException)40 File (java.io.File)38 ArrayList (java.util.ArrayList)37 IFile (org.eclipse.core.resources.IFile)37 MultiStatus (org.eclipse.core.runtime.MultiStatus)30 IResource (org.eclipse.core.resources.IResource)27 IRunnableWithProgress (org.eclipse.jface.operation.IRunnableWithProgress)26 IProject (org.eclipse.core.resources.IProject)24 IPath (org.eclipse.core.runtime.IPath)24 ITask (com.cubrid.common.core.task.ITask)23 PartInitException (org.eclipse.ui.PartInitException)23 InputStream (java.io.InputStream)18 GridData (org.eclipse.swt.layout.GridData)17 GridLayout (org.eclipse.swt.layout.GridLayout)17 Composite (org.eclipse.swt.widgets.Composite)16