Package org.noos.common.context

Examples of org.noos.common.context.MutableContext


        Thread.currentThread().setContextClassLoader(bundleClassLoader);

        try {
            XMLWriter writer = new XMLWriter(new OutputStreamWriter(outputStream));

            MutableContext context = new DefaultMutableContext();
            context.put(MyDoggyToolWindowManager.class, toolWindowManager);
            context.put(PersistenceDelegateFilter.class, (filter != null) ? filter : dummyFilter);
            context.put(InternalPersistenceDelegateFilter.class,
                    (filter != null)
                            ? (filter instanceof InternalPersistenceDelegateFilter ? filter : new InternalPersistenceDelegateFilterWrapper(filter))
                            : dummyFilter);
            context.put("standalone", standalone);

            masterElementWriter.write(writer, context);

            writer.flush();
        } catch (Exception e) {
View Full Code Here



        public void write(XMLWriter writer, Context context) {
            try {
                // Init context
                MutableContext mutableContext = (MutableContext) context;
                mutableContext.put(ToolWindowManager.class, manager);
                boolean standalone = (Boolean) context.get("standalone");

                // Start document
                if (standalone)
                    writer.startDocument();

                // Write header
                AttributesImpl mydoggyAttributes = new AttributesImpl();
                mydoggyAttributes.addAttribute(null, "version", null, null, "1.5.0");
                mydoggyAttributes.addAttribute(null, "contentManagerEnabled", null, null,
                        String.valueOf(manager.getContentManager().isEnabled()));
                writer.startElement("mydoggy", mydoggyAttributes);

                // Write ToolWindows
                writer.startElement("toolWindows");

                // Write SharedWindows
                writer.startElement("sharedWindows");

                for (MultiSplitWindow<? extends Dockable> multiSplitWindow : toolWindowManager.getFloatingWindows()) {
                    storeMultiSplitWindow(writer, multiSplitWindow);
                }

                for (MultiSplitWindow<? extends Dockable> multiSplitWindow : toolWindowManager.getFloatingLiveWindows()) {
                    storeMultiSplitWindow(writer, multiSplitWindow);
                }

                writer.endElement("sharedWindows");

                // Write tools
                for (ToolWindow toolWindow : manager.getToolWindows()) {
                    if (!context.get(PersistenceDelegateFilter.class).storeToolWindow(toolWindow))
                        continue;

                    mutableContext.put(ToolWindow.class, toolWindow);
                    getElementWriter(ToolWindow.class).write(writer, context);
                }

                writer.endElement("toolWindows");

                // Write ToolWindowManagerDescriptor
                if (context.get(PersistenceDelegateFilter.class).storeToolWindowManagerDescriptor()) {
                    mutableContext.put(ToolWindowManagerDescriptor.class, manager.getToolWindowManagerDescriptor());
                    getElementWriter(ToolWindowManagerDescriptor.class).write(writer, context);
                }

                if (context.get(PersistenceDelegateFilter.class).storeContentManager()) {
                    // Write ContentManagerUI
                    mutableContext.put(ContentManager.class, manager.getContentManager());
                    mutableContext.put(ContentManagerUI.class, manager.getContentManager().getContentManagerUI());

                    ContentManager contentManager = manager.getContentManager();
                    writer.startElement("contentManagerUI");
                    getElementWriter(contentManager.getContentManagerUI().getClass()).write(writer, context);
                    writer.endElement("contentManagerUI");
View Full Code Here


        public void write(XMLWriter writer, Context params) {
            try {
                // Init context
                MutableContext context = new DefaultMutableContext();
                context.put(ToolWindowManager.class, manager);

                // Start document
                writer.startDocument();

                // Write header
                AttributesImpl mydoggyAttributes = new AttributesImpl();
                mydoggyAttributes.addAttribute(null, "version", null, null, "1.4.2");
                mydoggyAttributes.addAttribute(null, "contentManagerEnabled", null, null,
                                               String.valueOf(manager.getContentManager().isEnabled()));
                writer.startElement("mydoggy", mydoggyAttributes);

                // Write ToolWindows
                writer.startElement("toolWindows");
                for (ToolWindow toolWindow : manager.getToolWindows()) {
                    context.put(ToolWindow.class, toolWindow);
                    getElementWriter(ToolWindow.class).write(writer, context);
                }
                writer.endElement("toolWindows");

                // Write ToolWindowManagerDescriptor
                context.put(ToolWindowManagerDescriptor.class, manager.getToolWindowManagerDescriptor());
                getElementWriter(ToolWindowManagerDescriptor.class).write(writer, context);

                // Write ContentManagerUI
                context.put(ContentManager.class, manager.getContentManager());
                context.put(ContentManagerUI.class, manager.getContentManager().getContentManagerUI());

                ContentManager contentManager = manager.getContentManager();
                writer.startElement("contentManagerUI");
                getElementWriter(contentManager.getContentManagerUI().getClass()).write(writer, context);
                writer.endElement("contentManagerUI");
View Full Code Here

TOP

Related Classes of org.noos.common.context.MutableContext

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.