Package org.eclipse.core.runtime

Examples of org.eclipse.core.runtime.MultiStatus


          }
        }
      }
    }

    MultiStatus conflicts = new MultiStatus("org.eclipse.ui.workbench", 0//$NON-NLS-1$
        "A handler conflict occurred.  This may disable some commands.", //$NON-NLS-1$
        null);
   
    /*
     * For every command identifier with a changed activation, we resolve
     * conflicts and trigger an update.
     */
    final Iterator changedCommandIdItr = changedCommandIds.iterator();
    while (changedCommandIdItr.hasNext()) {
      final String commandId = (String) changedCommandIdItr.next();
      final Object value = handlerActivationsByCommandId.get(commandId);
      if (value instanceof IHandlerActivation) {
        final IHandlerActivation activation = (IHandlerActivation) value;
        updateCommand(commandId, (evaluate(activation) ? activation
            : null));
      } else if (value instanceof SortedSet) {
        final IHandlerActivation activation = resolveConflicts(
            commandId, (SortedSet) value, conflicts);
        updateCommand(commandId, activation);
      } else {
        updateCommand(commandId, null);
      }
    }
    if (conflicts.getSeverity()!=IStatus.OK) {
      WorkbenchPlugin.log(conflicts);
    }

    // If tracing performance, then print the results.
    if (DEBUG_PERFORMANCE) {
View Full Code Here


     *
     * @param memento the <code>IMemento</code> to save to.
     * @return <code>IStatus</code>
     */
    public IStatus saveState(IMemento memento) {
        final MultiStatus result = new MultiStatus(PlatformUI.PLUGIN_ID,
                IStatus.OK, WorkbenchMessages.ViewFactory_problemsSavingViews, null);

        final IViewReference refs[] = getViews();
        for (int i = 0; i < refs.length; i++) {
            //for dynamic UI - add the following line to replace subsequent code which is commented out
View Full Code Here

    }

    //  for dynamic UI
    public IMemento saveViewState(IMemento memento, IViewReference ref,
            MultiStatus res) {
        final MultiStatus result = res;
        final IMemento viewMemento = memento
                .createChild(IWorkbenchConstants.TAG_VIEW);
        viewMemento.putString(IWorkbenchConstants.TAG_ID, ViewFactory
                .getKey(ref));
        if (ref instanceof ViewReference) {
            viewMemento.putString(IWorkbenchConstants.TAG_PART_NAME,
                    ((ViewReference) ref).getPartName());
        }
        final IViewReference viewRef = ref;
        final IViewPart view = (IViewPart) ref.getPart(false);
        if (view != null) {
            SafeRunner.run(new SafeRunnable() {
                public void run() {
                  if (view instanceof IWorkbenchPart3) {
            Map properties = ((IWorkbenchPart3) view)
                .getPartProperties();
            if (!properties.isEmpty()) {
              IMemento propBag = viewMemento
                  .createChild(IWorkbenchConstants.TAG_PROPERTIES);
              Iterator i = properties.entrySet().iterator();
              while (i.hasNext()) {
                Map.Entry entry = (Map.Entry) i.next();
                IMemento p = propBag.createChild(
                    IWorkbenchConstants.TAG_PROPERTY,
                    (String) entry.getKey());
                p.putTextData((String) entry.getValue());
              }
            }
          }
                    view.saveState(viewMemento
                            .createChild(IWorkbenchConstants.TAG_VIEW_STATE));
                }

                public void handleException(Throwable e) {
                    result
                            .add(new Status(
                                    IStatus.ERROR,
                                    PlatformUI.PLUGIN_ID,
                                    0,
                                    NLS.bind(WorkbenchMessages.ViewFactory_couldNotSave, viewRef.getTitle() ),
View Full Code Here

    /**
     * @see IPersistablePart
     */
    public IStatus restoreState(IMemento memento) {
        MultiStatus result = new MultiStatus(
                PlatformUI.PLUGIN_ID,
                IStatus.OK,
                WorkbenchMessages.RootLayoutContainer_problemsRestoringPerspective, null);

        // Read the info elements.
        IMemento[] children = memento.getChildren(IWorkbenchConstants.TAG_INFO);

        // Create a part ID to part hashtable.
        final Map mapIDtoPart = new HashMap(children.length);

        // Loop through the info elements.
        for (int i = 0; i < children.length; i++) {
            // Get the info details.
            IMemento childMem = children[i];
            String partID = childMem.getString(IWorkbenchConstants.TAG_PART);
            final String relativeID = childMem
                    .getString(IWorkbenchConstants.TAG_RELATIVE);
            int relationship = 0;
            float ratio = 0.0f;
            int left = 0, right = 0;
            if (relativeID != null) {
                relationship = childMem.getInteger(
                        IWorkbenchConstants.TAG_RELATIONSHIP).intValue();

                // Note: the ratio is used for reading pre-3.0 eclipse workspaces. It should be ignored
                // if "left" and "right" are available.
                Float ratioFloat = childMem
                        .getFloat(IWorkbenchConstants.TAG_RATIO);
                Integer leftInt = childMem
                        .getInteger(IWorkbenchConstants.TAG_RATIO_LEFT);
                Integer rightInt = childMem
                        .getInteger(IWorkbenchConstants.TAG_RATIO_RIGHT);
                if (leftInt != null && rightInt != null) {
                    left = leftInt.intValue();
                    right = rightInt.intValue();
                } else {
                    if (ratioFloat != null) {
                        ratio = ratioFloat.floatValue();
                    }
                }
            }
            String strFolder = childMem
                    .getString(IWorkbenchConstants.TAG_FOLDER);

            // Create the part.
            LayoutPart part = null;
            if (strFolder == null) {
        part = new PartPlaceholder(partID);
      } else {
                ViewStack folder = new ViewStack(page);
                folder.setID(partID);
                result.add(folder.restoreState(childMem
                        .getChild(IWorkbenchConstants.TAG_FOLDER)));
                ContainerPlaceholder placeholder = new ContainerPlaceholder(
                        partID);
                placeholder.setRealContainer(folder);
                part = placeholder;
View Full Code Here

     * @see IPersistablePart
     */
    public IStatus saveState(IMemento memento) {
        RelationshipInfo[] relationships = computeRelation();

        MultiStatus result = new MultiStatus(
                PlatformUI.PLUGIN_ID,
                IStatus.OK,
                WorkbenchMessages.RootLayoutContainer_problemsSavingPerspective, null);

        // Loop through the relationship array.
        for (int i = 0; i < relationships.length; i++) {
            // Save the relationship info ..
            //    private LayoutPart part;
            //     private int relationship;
            //     private float ratio;
            //     private LayoutPart relative;
            RelationshipInfo info = relationships[i];
            IMemento childMem = memento
                    .createChild(IWorkbenchConstants.TAG_INFO);
            childMem.putString(IWorkbenchConstants.TAG_PART, info.part.getID());
            if (info.relative != null) {
                childMem.putString(IWorkbenchConstants.TAG_RELATIVE,
                        info.relative.getID());
                childMem.putInteger(IWorkbenchConstants.TAG_RELATIONSHIP,
                        info.relationship);
                childMem.putInteger(IWorkbenchConstants.TAG_RATIO_LEFT,
                        info.left);
                childMem.putInteger(IWorkbenchConstants.TAG_RATIO_RIGHT,
                        info.right);

                // The ratio is only needed for saving workspaces that can be read by old versions
                // of Eclipse. It is not used in newer versions of Eclipse, which use the "left"
                // and "right" attributes instead.
                childMem.putFloat(IWorkbenchConstants.TAG_RATIO, info
                        .getRatio());
            }

            // Is this part a folder or a placeholder for one?
            ViewStack folder = null;
            if (info.part instanceof ViewStack) {
                folder = (ViewStack) info.part;
            } else if (info.part instanceof ContainerPlaceholder) {
                LayoutPart part = ((ContainerPlaceholder) info.part)
                        .getRealContainer();
                if (part instanceof ViewStack) {
          folder = (ViewStack) part;
        }
            }

            // If this is a folder (ViewStack) save the contents.
            if (folder != null) {
                childMem.putString(IWorkbenchConstants.TAG_FOLDER, "true");//$NON-NLS-1$
               
                IMemento folderMem = childMem
                        .createChild(IWorkbenchConstants.TAG_FOLDER);
                result.add(folder.saveState(folderMem));
            }
        }
        return result;
    }
View Full Code Here

                    _monitor.done();
                    ivy.getEventManager().removeIvyListener(IvyResolveJob.this);
                }

                if (!problemMessages.isEmpty()) {
                    MultiStatus multiStatus = new MultiStatus(IvyPlugin.ID, IStatus.ERROR,
                            "Impossible to resolve dependencies of " + md.getModuleRevisionId(),
                            null);
                    for (Iterator iter = problemMessages.iterator(); iter.hasNext();) {
                        multiStatus.add(new Status(IStatus.ERROR, IvyPlugin.ID, (String) iter
                                .next()));
                    }
                    status[0] = multiStatus;
                    return;
                }
View Full Code Here

            launcher.setTrace(launcher.getTrace() || logLevel.intValue() <= Level.FINE.intValue());
        }
    }

    protected static MultiStatus createStatus(String message, List<String> errors, List<String> warnings) {
        MultiStatus status = new MultiStatus(Plugin.PLUGIN_ID, 0, message, null);

        for (String error : errors) {
            status.add(new Status(IStatus.ERROR, Plugin.PLUGIN_ID, 0, error, null));
        }
        for (String warning : warnings) {
            status.add(new Status(IStatus.WARNING, Plugin.PLUGIN_ID, 0, warning, null));
        }

        return status;
    }
View Full Code Here

                    message += "\n - " + exceptionMessage;
                }
            }

            // create main status
            MultiStatus multiStatus = new MultiStatus( ConnectionCoreConstants.PLUGIN_ID, IStatus.ERROR, message, null );

            // append child status
            for ( Status status : errorStatusList )
            {
                String statusMessage = status.getMessage();
                if ( status.getException() != null )
                {
                    StringWriter sw = new StringWriter();
                    PrintWriter pw = new PrintWriter( sw );
                    status.getException().printStackTrace( pw );
                    statusMessage = sw.toString();
                }
                multiStatus.add( new Status( status.getSeverity(), status.getPlugin(), status.getCode(), statusMessage,
                    status.getException() ) );
            }

            return multiStatus;
        }
View Full Code Here

        if( message==null )
            m=""; //$NON-NLS-1$
        else
            m=message;
       
        final MultiStatus multi = new MultiStatus(pluginID, IStatus.OK, message, null);
        for( Throwable exception : exceptions ) {
            Status status = new Status(IStatus.ERROR, pluginID, IStatus.ERROR, exception
                    .getLocalizedMessage(), exception);
            multi.add(status);
        }

        PlatformGIS.syncInDisplayThread(new Runnable(){
            public void run() {
                Dialog dialog = new ErrorDialog(Display.getDefault().getActiveShell(), Messages.ErrorManager_very_informative_error,
View Full Code Here

import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.swt.widgets.Display;

public class ExceptionDisplayer {
    public static void displayExceptions( final List<Throwable> exceptions, final String message, final String pluginID) {
        final MultiStatus multi = new MultiStatus(pluginID, IStatus.OK, message, null);
        for (Throwable exception : exceptions) {
            Status status = new Status(IStatus.ERROR, pluginID, IStatus.ERROR, exception.getLocalizedMessage(), exception);
            multi.add(status);
        }
       
       PlatformGIS.syncInDisplayThread(new Runnable(){
            public void run() {
                Dialog dialog = new ErrorDialog(Display.getDefault().getActiveShell(), Messages.ExceptionDisplayer_very_informative_error, message, multi, IStatus.ERROR);
View Full Code Here

TOP

Related Classes of org.eclipse.core.runtime.MultiStatus

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.