Package org.eclipse.ui

Examples of org.eclipse.ui.XMLMemento


            URL detailsResId = new URL(null, "mapgraphic://localhost/mapgraphic#org.locationtech.udig.tutorial.mapgraphic.TitleArea", CorePlugin.RELAXED_HANDLER);
            IGeoResource detailsRes = localCatalog.getById(IGeoResource.class, new ID(detailsResId), new NullProgressMonitor());
            
            Layer titleAreaLayer = layerFactory.createLayer(detailsRes);
            titleAreaLayer.getStyleBlackboard().put(LocationStyleContent.ID, location);
            XMLMemento selectedFeatureMemento = XMLMemento.createWriteRoot("style");
            selectedFeatureMemento.putString(FEATURE_ID_KEY, id);
            titleAreaLayer.getStyleBlackboard().put(DialogSettingsStyleContent.EXTENSION_ID, selectedFeatureMemento);
            return titleAreaLayer;
        }
        catch (Exception e) {
            throw new IllegalStateException("failed to create title area", e);
View Full Code Here


        ILayer layer=map.getMapLayers().get(0);
        FeatureCollection<SimpleFeatureType, SimpleFeature> collection = layer.getResource(FeatureSource.class, null).getFeatures();
        SimpleFeature feature=collection.features().next();
       
        IIssue original=new FeatureIssue(Priority.WARNING, "test description", layer, feature, "groupID"); //$NON-NLS-1$ //$NON-NLS-2$
        XMLMemento memento=XMLMemento.createWriteRoot("memento"); //$NON-NLS-1$
        XMLMemento viewMemento=XMLMemento.createWriteRoot("viewMemento"); //$NON-NLS-1$
        original.save(memento);
        original.getViewMemento(viewMemento);
        FeatureIssue restored=new FeatureIssue();
        restored.init(memento, viewMemento, original.getId(), original.getGroupId(), original.getBounds());
        restored.setDescription(original.getDescription());
View Full Code Here

        if (styleEntry.getStyle() == null) {
            try {
                StyleContent styleContent = getStyleContent(styleEntry.getID());
                String mementoString = styleEntry.getMemento();
                if (mementoString != null) {
                    XMLMemento memento = XMLMemento.createReadRoot(new StringReader(mementoString));
                    Object style = styleContent.load(memento);
                    styleEntry.setStyle(style);
                    if (style != null) {
                        styleEntry.setStyleClass(style.getClass());
                    }
View Full Code Here

            return;
        }
        try {
            // save the state of the style
            XMLMemento memento = XMLMemento.createWriteRoot("styleEntry"); //$NON-NLS-1$
            styleContent.save(memento, style);

            StringWriter writer = new StringWriter();
            memento.save(writer);
            se.setMemento(writer.getBuffer().toString());

            writer.close();
        } catch (IOException e) {
            e.printStackTrace();
View Full Code Here

        if( mementoString.length()==0 ){
            return null;
        }
       
        try{
            XMLMemento memento = XMLMemento.createReadRoot(new StringReader(mementoString));
            IExtension extension = Platform.getExtensionRegistry().getExtension(PrintingModelPlugin.BOX_PRINTER_EXTENSION_ID, extensionID);
            if( extension==null ){
                PrintingModelPlugin.log("The method "+className+"#getExtensionID() returned: "+extensionID+ //$NON-NLS-1$ //$NON-NLS-2$
                        " this is not the correct extension id.  Check the extension id.  \nHint: Read the " + //$NON-NLS-1$
                        "javadocs for the method", null); //$NON-NLS-1$
View Full Code Here

     * <!-- end-user-doc -->
     * @generated NOT
     */
    public String convertBoxPrinterToString(EDataType eDataType, Object instanceValue) {
        BoxPrinter printer=(BoxPrinter) instanceValue;
        XMLMemento memento = XMLMemento.createWriteRoot("boxPrinter"); //$NON-NLS-1$
        printer.save(memento);

        StringWriter writer = new StringWriter();
        writer.getBuffer().append(printer.getExtensionPointID());
        writer.getBuffer().append(SPLIT);
        writer.getBuffer().append(printer.getClass().getName());
        writer.getBuffer().append(SPLIT);
        try {
            memento.save(writer);
        } catch (IOException e) {
            return "<boxPrinter></boxPrinter>"; //$NON-NLS-1$
        }

        return writer.getBuffer().toString();
View Full Code Here

                    // have to load from memento
                    String memento2 = entry.getMemento();
                    if (memento2 == null || memento2.length() == 0) {
                        return null;
                    }
                    XMLMemento memento = XMLMemento.createReadRoot(new StringReader(memento2));
                    IPersister<Object> persister = (IPersister<Object>) findPersister(entry,
                            memento);
                    if (persister != null) {
                        object = persister.load(memento);
                        entry.setObject(object);
View Full Code Here

        // find the persister to save the state
        @SuppressWarnings("unchecked")
        IPersister<Object> persister = (IPersister<Object>) findPersister(entry, null);
        try {
            if (persister != null) {
                XMLMemento memento = XMLMemento.createWriteRoot("blackboardContent"); //$NON-NLS-1$
                persister.save(value, memento);
                memento.putString("internalObjectClassStorage", entry.getObjectClass().getName()); //$NON-NLS-1$

                StringWriter writer = new StringWriter();
                memento.save(writer);
                entry.setMemento(writer.getBuffer().toString());
            } else {
                // this is a "real" object that cannot be shared between runs
            }
        } catch (Exception e) {
View Full Code Here

            return;
        IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
        try {
           
            view = page.showView(issue.getViewPartId());
            XMLMemento memento=XMLMemento.createWriteRoot("root"); //$NON-NLS-1$
            issue.getViewMemento(memento);
            view.init(view.getViewSite(), memento);
        } catch (PartInitException e) {
            ProjectUIPlugin.log(
                    Messages.IssueHandler_error_view + issue.getProblemObject(), e);
View Full Code Here

                issue.setDescription(description);
                issue.setResolution(resolution);
                issue.setPriority(priority);
               
                XMLMemento issueMemento=null;
                if (mementoData != null) {
                    try {
                        issueMemento = XMLMemento.createReadRoot(new StringReader(mementoData));
                    } catch (WorkbenchException e) {
                        issueMemento = null;
                    }
                }
                XMLMemento viewMemento=null;
                if (viewData != null){
                    try {
                        viewMemento = XMLMemento.createReadRoot(new StringReader(viewData));
                    } catch (WorkbenchException e) {
                        viewMemento = null;
View Full Code Here

TOP

Related Classes of org.eclipse.ui.XMLMemento

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.