X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.debug.browser%2Fsrc%2Forg%2Fsimantics%2Fdebug%2Fbrowser%2Finternal%2Frewriters%2FRawStatementsCreator.java;h=1caaa9e6636b9c921bed6550215d464743f9f3e8;hb=HEAD;hp=5908fd36d04e2b694c6763a0caccb7ada9a2f1f6;hpb=969bd23cab98a79ca9101af33334000879fb60c5;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.debug.browser/src/org/simantics/debug/browser/internal/rewriters/RawStatementsCreator.java b/bundles/org.simantics.debug.browser/src/org/simantics/debug/browser/internal/rewriters/RawStatementsCreator.java index 5908fd36d..1caaa9e66 100644 --- a/bundles/org.simantics.debug.browser/src/org/simantics/debug/browser/internal/rewriters/RawStatementsCreator.java +++ b/bundles/org.simantics.debug.browser/src/org/simantics/debug/browser/internal/rewriters/RawStatementsCreator.java @@ -1,55 +1,55 @@ -/******************************************************************************* - * Copyright (c) 2016 Association for Decentralized Information Management - * in Industry THTH ry. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * THTH ry - initial API and implementation - *******************************************************************************/ -package org.simantics.debug.browser.internal.rewriters; - -import java.util.ArrayList; -import java.util.Collection; - -import org.simantics.db.ReadGraph; -import org.simantics.db.Resource; -import org.simantics.db.Statement; -import org.simantics.db.exception.DatabaseException; -import org.simantics.debug.browser.content.ResourceBrowserContent; -import org.simantics.debug.browser.content.ResourceBrowserRewriter; -import org.simantics.debug.browser.sections.PageHeaderSection; -import org.simantics.debug.browser.sections.RawStatementsSection; - -public enum RawStatementsCreator implements ResourceBrowserRewriter { - INSTANCE; - - @Override - public void rewrite(ReadGraph graph, ResourceBrowserContent content) throws DatabaseException { - RawStatementsSection section = new RawStatementsSection(); - section.resource = content.resource; - for(Resource predicate : graph.getPredicates(content.resource)) { - Collection statements = graph.getStatements(content.resource, predicate); - ArrayList filteredStatements = new ArrayList(statements.size()); - for(Statement statement : statements) - if(statement.getPredicate().equals(predicate)) - filteredStatements.add(statement); - section.statementsByPredicates.put(predicate, filteredStatements); - } - content.putSection(RawStatementsSection.class, section); - - // Add custom CSS to header - PageHeaderSection hdr = content.getSection(PageHeaderSection.class); - hdr.getHeadWriter().println(""); - hdr.getHeadWriter().println(""); - hdr.getHeadWriter().println(""); - } - - @Override - public double getPriority() { - return 0; - } - -} +/******************************************************************************* + * Copyright (c) 2016 Association for Decentralized Information Management + * in Industry THTH ry. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * THTH ry - initial API and implementation + *******************************************************************************/ +package org.simantics.debug.browser.internal.rewriters; + +import java.util.ArrayList; +import java.util.Collection; + +import org.simantics.db.ReadGraph; +import org.simantics.db.Resource; +import org.simantics.db.Statement; +import org.simantics.db.exception.DatabaseException; +import org.simantics.debug.browser.content.ResourceBrowserContent; +import org.simantics.debug.browser.content.ResourceBrowserRewriter; +import org.simantics.debug.browser.sections.PageHeaderSection; +import org.simantics.debug.browser.sections.RawStatementsSection; + +public enum RawStatementsCreator implements ResourceBrowserRewriter { + INSTANCE; + + @Override + public void rewrite(ReadGraph graph, ResourceBrowserContent content) throws DatabaseException { + RawStatementsSection section = new RawStatementsSection(); + section.resource = content.resource; + for(Resource predicate : graph.getPredicates(content.resource)) { + Collection statements = graph.getStatements(content.resource, predicate); + ArrayList filteredStatements = new ArrayList(statements.size()); + for(Statement statement : statements) + if(statement.getPredicate().equals(predicate)) + filteredStatements.add(statement); + section.statementsByPredicates.put(predicate, filteredStatements); + } + content.putSection(RawStatementsSection.class, section); + + // Add custom CSS to header + PageHeaderSection hdr = content.getSection(PageHeaderSection.class); + hdr.getHeadWriter().println(""); + hdr.getHeadWriter().println(""); + hdr.getHeadWriter().println(""); + } + + @Override + public double getPriority() { + return 0; + } + +}