SEL.canBeLifted false
SEL.HasStandardPropertyInfo MOD.SystemPropertyInfo
+MOD.changed
+ @L0.defTag
+ L0.HasDescription "Indicates that the change information of this object has been modified after import into this database."
+
MOD.TypeWithChangeInformation <T L0.Entity
L0.HasName : SEL.GenericParameterType
L0.HasLabel : SEL.GenericParameterType
L0X.HasGeneratedNamePrefix : SEL.GenericParameterType
-//MOD.HasNameBrowseContextContribution : VP.BrowseContextContribution
-// VP.BrowseContextContribution.HasType L0.String
-// VP.BrowseContextContribution.HasBrowseContext
-// _ : VP.BrowseContext
-
L0.SCLModule : MOD.TypeWithChangeInformation
L0.SCLScript : MOD.TypeWithChangeInformation
L0.Library : MOD.TypeWithChangeInformation
// that has already unwanted contributions.
MBC.ComponentTypeLockStatusImageDecorationRule : VP.ImageDecorationRule
+MBC.ChangedResourceImageDecorationRule : VP.ImageDecorationRule
// Labels
MBC
@VP.namedConstantImageRule MOD.Contributions.SheetBookImage SHEET.Book SILK.folder_table
@VP.namedConstantImageRule MOD.Contributions.SheetImage SHEET.Spreadsheet SILK.table
@VP.customImageDecorationRule STR.ComponentType MBC.ComponentTypeLockStatusImageDecorationRule
+ @VP.customImageDecorationRule L0.Entity MBC.ChangedResourceImageDecorationRule
IMAGES = MBC.Images : L0.Library
IMAGES.SubscriptionsFolder : IMAGE.PngImage
VP.ActionContribution.HasNodeType L0.Library
VP.ActionContribution.HasAction ACTIONS.NewSheetBook
+MOD.Contributions.ImportSheetBook : VP.ActionContribution
+ L0.HasLabel "Spreadsheet"
+ VP.ActionContribution.HasImage SILK.star
+ VP.ActionContribution.HasCategory VP.ImportActionCategory
+ VP.ActionContribution.HasNodeType L0.Library
+ VP.ActionContribution.HasAction ACTIONS.ImportSheetBook
+
MOD.Contributions.ActivateModel : VP.ActionContribution
L0.HasLabel "Activate"
VP.ActionContribution.HasImage SILK.bullet_go
VP.BrowseContext.SupportsRenamingOf MBC.Symbol
VP.BrowseContext.HasActionContribution
MOD.Contributions.NewSheetBook
+ MOD.Contributions.ImportSheetBook
@VP.renamingTestContribution
L0.SharedOntology
@MOD.sclAction "createSCLQueryTypeAction"
ACTIONS.NewSheetBook
@MOD.sclAction "createSpreadsheetBookAction"
+ACTIONS.ImportSheetBook
+ @MOD.sclAction "importSpreadsheetBookAction"
ACTIONS.ActivateModel
@MOD.sclAction "activateModelAction"
ACTIONS.ActivateExperiment
<resource
uri="http://www.simantics.org/Modeling-0.0/ModelingBrowseContext/ComponentTypeLockStatusImageDecorationRule"
class="org.simantics.structural.ui.modelBrowser.contributions.ComponentTypeLockStatusImageDecorationRule"/>
+ <resource
+ uri="http://www.simantics.org/Modeling-0.0/ModelingBrowseContext/ChangedResourceImageDecorationRule"
+ class="org.simantics.modeling.ui.modelBrowser2.image.ChangedResourceImageDecorationRule"/>
</target>
<target interface="org.simantics.db.layer0.variable.Expression">
public static String INFO_SVG_TEXT;
public static String NOTE_SVG_TEXT;
+ public static ImageDescriptor CHANGED_DECORATOR_ICON;
+
public static ImageDescriptor BULLET_GREEN_ICON;
public static ImageDescriptor BULLET_YELLOW_ICON;
INFO_SVG_TEXT = FileUtils.getContents(bundle.getResource("icons/info.svg")); //$NON-NLS-1$
NOTE_SVG_TEXT = FileUtils.getContents(bundle.getResource("icons/note4.svg")); //$NON-NLS-1$
+ CHANGED_DECORATOR_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/changed_decorator.png")); //$NON-NLS-1$
+
BULLET_GREEN_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/bullet_green.png")); //$NON-NLS-1$
BULLET_YELLOW_ICON = ImageDescriptor.createFromURL(bundle.getResource("icons/bullet_yellow.png")); //$NON-NLS-1$
--- /dev/null
+package org.simantics.modeling.ui.modelBrowser2.image;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.IDecoration;
+import org.simantics.browsing.ui.content.ImageDecorator;
+import org.simantics.browsing.ui.model.imagedecorators.ImageDecorationRule;
+import org.simantics.db.ReadGraph;
+import org.simantics.db.Resource;
+import org.simantics.db.exception.DatabaseException;
+import org.simantics.modeling.ModelingResources;
+import org.simantics.modeling.ui.Activator;
+import org.simantics.utils.ui.gfx.DecorationOverlayIcon;
+
+public class ChangedResourceImageDecorationRule implements ImageDecorationRule {
+
+ private ImageDecorator CHANGED_DECORATOR = new ImageDecorator() {
+ @Override
+ public <Image> Image decorateImage(Image image, String column, int itemIndex) {
+ ImageDescriptor original = (ImageDescriptor)image;
+ ImageDescriptor decorated = (original == null || original.getImageData() == null) ? Activator.CHANGED_DECORATOR_ICON
+ : new DecorationOverlayIcon(original, Activator.CHANGED_DECORATOR_ICON, IDecoration.BOTTOM_RIGHT);
+ return (Image)decorated;
+ }
+ };
+
+ @Override
+ public boolean isCompatible(Class<?> contentType) {
+ return Resource.class.isAssignableFrom(contentType);
+ }
+
+ @Override
+ public ImageDecorator getImageDecorator(ReadGraph graph, Object content)
+ throws DatabaseException
+ {
+ Resource resource = (Resource) content;
+ ModelingResources MOD = ModelingResources.getInstance(graph);
+ if (!graph.hasStatement(resource, MOD.changed))
+ return null;
+
+ return CHANGED_DECORATOR;
+ }
+
+}
import org.simantics.db.Resource;
import org.simantics.db.Session;
import org.simantics.db.Statement;
+import org.simantics.db.VirtualGraph;
import org.simantics.db.WriteGraph;
import org.simantics.db.common.Indexing;
import org.simantics.db.common.NamedResource;
return DiagramGraphUtil.getModelingRules(graph, diagramResource, null);
}
+ public static void markChanged(WriteGraph graph, Resource r) throws DatabaseException {
+ VirtualGraphSupport support = Simantics.getSession().getService(VirtualGraphSupport.class);
+ VirtualGraph vg = support.getWorkspacePersistent("changeInformation");
+ graph.syncRequest(new WriteRequest(vg) {
+ @Override
+ public void perform(WriteGraph graph) throws DatabaseException {
+ ModelingResources MOD = ModelingResources.getInstance(graph);
+ graph.claim(r, MOD.changed, MOD.changed, r);
+ }
+ });
+ }
+
}
import org.simantics.db.layer0.util.Layer0Utils;
import org.simantics.layer0.Layer0;
import org.simantics.modeling.ModelingResources;
+import org.simantics.modeling.ModelingUtils;
import org.simantics.modeling.adapters.ChangeHistoryUpdated;
import org.simantics.modeling.adapters.ChangeInformation;
for (Resource c : creates) {
CommonDBUtils.selectClusterSet(graph, c);
graph.claimLiteral(c, MOD.changeInformation, MOD.changeInformation_Inverse, MOD.ChangeInformation, info, ChangeInformation.BINDING);
+ ModelingUtils.markChanged(graph, c);
}
}
info.modifiedBy = author;
CommonDBUtils.selectClusterSet(graph, m);
graph.claimLiteral(m, MOD.changeInformation, MOD.changeInformation_Inverse, MOD.ChangeInformation, info, ChangeInformation.BINDING);
+ ModelingUtils.markChanged(graph, m);
}
for (Resource r : ids) {