X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.issues.ui%2Fsrc%2Forg%2Fsimantics%2Fissues%2Fui%2FIssueLabelRule.java;h=ada862d86b585b5b628847bce8c407bbef986df9;hb=d837e1dc077a32288fccea32a55b4e81717e75a9;hp=b92699043f1989ced60ffe4523e8a566ebe5b4ea;hpb=969bd23cab98a79ca9101af33334000879fb60c5;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/IssueLabelRule.java b/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/IssueLabelRule.java index b92699043..ada862d86 100644 --- a/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/IssueLabelRule.java +++ b/bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/IssueLabelRule.java @@ -1,52 +1,50 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 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: - * VTT Technical Research Centre of Finland - initial API and implementation - *******************************************************************************/ -package org.simantics.issues.ui; - -import java.util.Map; - -import org.simantics.browsing.ui.common.ColumnKeys; -import org.simantics.browsing.ui.model.labels.LabelRule; -import org.simantics.db.ReadGraph; -import org.simantics.db.exception.DatabaseException; -import org.simantics.db.layer0.variable.Variable; -import org.simantics.utils.datastructures.ArrayMap; -import org.simantics.utils.strings.StringUtils; - -public class IssueLabelRule implements LabelRule { - - public static final IssueLabelRule INSTANCE = new IssueLabelRule(); - - private static final String[] COLS = new String[] { ColumnKeys.SINGLE, "Resource", "Path" }; - - public IssueLabelRule() { - } - - @Override - public boolean isCompatible(Class contentType) { - return contentType.equals(Variable.class); - } - - @Override - public Map getLabel(ReadGraph graph, Object content) throws DatabaseException { - - Variable issue = (Variable)content; - //Layer0 L0 = Layer0.getInstance(graph); - //IssueResource ISSUE = IssueResource.getInstance(graph); - String description = StringUtils.safeString( (String) issue.getPossiblePropertyValue(graph, "HasDescription") ); - String resource = StringUtils.safeString( (String) issue.getPossiblePropertyValue(graph, "resource") ); - String path = StringUtils.safeString( (String) issue.getPossiblePropertyValue(graph, "path") ); - - String[] result = new String[] { description, resource, path }; - return new ArrayMap(COLS, result); - - } -} +/******************************************************************************* + * Copyright (c) 2010, 2011 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: + * VTT Technical Research Centre of Finland - initial API and implementation + *******************************************************************************/ +package org.simantics.issues.ui; + +import java.util.Map; + +import org.simantics.browsing.ui.common.ColumnKeys; +import org.simantics.browsing.ui.model.labels.LabelRule; +import org.simantics.db.ReadGraph; +import org.simantics.db.exception.DatabaseException; +import org.simantics.db.layer0.variable.Variable; +import org.simantics.utils.datastructures.ArrayMap; +import org.simantics.utils.strings.StringUtils; + +public class IssueLabelRule implements LabelRule { + + public static final IssueLabelRule INSTANCE = new IssueLabelRule(); + + private static final String[] COLS = new String[] { ColumnKeys.SINGLE, Messages.IssueLabelRule_Resource, Messages.IssueLabelRule_Path }; + + public IssueLabelRule() { + } + + @Override + public boolean isCompatible(Class contentType) { + return contentType.equals(Variable.class); + } + + @Override + public Map getLabel(ReadGraph graph, Object content) throws DatabaseException { + + Variable issue = (Variable)content; + String description = StringUtils.safeString( (String) issue.getPossiblePropertyValue(graph, "HasDescription") ); //$NON-NLS-1$ + String resource = StringUtils.safeString( (String) issue.getPossiblePropertyValue(graph, "resource") ); //$NON-NLS-1$ + String path = StringUtils.safeString( (String) issue.getPossiblePropertyValue(graph, "path") ); //$NON-NLS-1$ + + String[] result = new String[] { description, resource, path }; + return new ArrayMap(COLS, result); + + } +}