X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.scl.commands%2Fsrc%2Forg%2Fsimantics%2Fscl%2Fcommands%2FCommands.java;h=ea20626d7b7f498d3a2ae4919c64425e1e441dc2;hb=HEAD;hp=10426802ac061fc4f4ca8e50fc93003a64c45a04;hpb=969bd23cab98a79ca9101af33334000879fb60c5;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.scl.commands/src/org/simantics/scl/commands/Commands.java b/bundles/org.simantics.scl.commands/src/org/simantics/scl/commands/Commands.java index 10426802a..ea20626d7 100644 --- a/bundles/org.simantics.scl.commands/src/org/simantics/scl/commands/Commands.java +++ b/bundles/org.simantics.scl.commands/src/org/simantics/scl/commands/Commands.java @@ -1,26 +1,26 @@ -package org.simantics.scl.commands; - -import java.util.concurrent.ConcurrentHashMap; - -import org.simantics.db.ReadGraph; -import org.simantics.scl.commands.internal.CommandImpl; - - -public class Commands { - private static final ConcurrentHashMap COMMAND_CACHE = - new ConcurrentHashMap(); - - /** - * Returns a command object of given type. This method always succeeds, - * but may return a command object whose check-method always returns fail - * and commit will throw an exception. - */ - public static Command get(ReadGraph graph, String name) { - Command command = COMMAND_CACHE.get(name); - if(command == null) { - command = CommandImpl.create(graph, name); - COMMAND_CACHE.put(name, command); - } - return command; - } -} +package org.simantics.scl.commands; + +import java.util.concurrent.ConcurrentHashMap; + +import org.simantics.db.ReadGraph; +import org.simantics.scl.commands.internal.CommandImpl; + + +public class Commands { + private static final ConcurrentHashMap COMMAND_CACHE = + new ConcurrentHashMap(); + + /** + * Returns a command object of given type. This method always succeeds, + * but may return a command object whose check-method always returns fail + * and commit will throw an exception. + */ + public static Command get(ReadGraph graph, String name) { + Command command = COMMAND_CACHE.get(name); + if(command == null) { + command = CommandImpl.create(graph, name); + COMMAND_CACHE.put(name, command); + } + return command; + } +}