X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.document.ui%2Fsrc%2Forg%2Fsimantics%2Fdocument%2Fui%2Ffunction%2FAll.java;h=effe30cd9b51c0ead4d1b7e97105d48c93fd0838;hp=76b5abe95c48559e3a384506b4ad5e3b2582e2a6;hb=5b3a1f2d3bffe5a79e344b55087fb161541a4301;hpb=894991ee53490cb8e28dd48b0da686203411324a diff --git a/bundles/org.simantics.document.ui/src/org/simantics/document/ui/function/All.java b/bundles/org.simantics.document.ui/src/org/simantics/document/ui/function/All.java index 76b5abe95..effe30cd9 100644 --- a/bundles/org.simantics.document.ui/src/org/simantics/document/ui/function/All.java +++ b/bundles/org.simantics.document.ui/src/org/simantics/document/ui/function/All.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012 Association for Decentralized Information Management in + * Copyright (c) 2012, 2017 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 @@ -8,6 +8,7 @@ * * Contributors: * VTT Technical Research Centre of Finland - initial API and implementation + * Semantum Oy - (#7066) introducing logger & refactoring *******************************************************************************/ package org.simantics.document.ui.function; @@ -38,7 +39,6 @@ import org.simantics.db.WriteGraph; import org.simantics.db.common.request.ReadRequest; import org.simantics.db.common.request.UnaryRead; import org.simantics.db.common.request.WriteRequest; -import org.simantics.db.common.utils.Logger; import org.simantics.db.common.utils.NameUtils; import org.simantics.db.common.utils.RequestUtil; import org.simantics.db.exception.DatabaseException; @@ -68,10 +68,14 @@ import org.simantics.ui.workbench.ResourceEditorInput2; import org.simantics.ui.workbench.action.DefaultActions; import org.simantics.utils.threads.SWTThread; import org.simantics.utils.ui.workbench.WorkbenchUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class All { + private static final Logger LOGGER = LoggerFactory.getLogger(All.class); + private static boolean createDocument(WriteGraph graph, Resource resource, Resource model) throws DatabaseException { Layer0 L0 = Layer0.getInstance(graph); @@ -187,6 +191,7 @@ public class All { if(document == null) return; RemoverUtil.remove(graph, document); + graph.markUndoPoint(); } @@ -318,12 +323,12 @@ public class All { @Override public void perform(WriteGraph graph) throws DatabaseException { - Variable selection = resolveEditSelection(graph, context, "..../Scroll/Browser#edited"); - if (selection != null) + if (selection != null) { selection.setValue(graph, (String)value, Bindings.STRING); - else { - System.err.println("no selection for resource : " + resource + ", Variable context : " + context + ", value : " + value); + graph.markUndoPoint(); + } else { + LOGGER.error("No selection for resource : " + resource + ", Variable context : " + context + ", value : " + value); } } @@ -743,19 +748,12 @@ public class All { String editorId = CSSEditor.EDITOR_ID; RVI rvi = null; - PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() { - - @Override - public void run() { - - try { - WorkbenchUtils.openEditor(editorId, new ResourceEditorInput2(editorId, root, root, rvi)); - } catch (PartInitException e) { - Logger.defaultLogError(e); - } - + PlatformUI.getWorkbench().getDisplay().asyncExec(() -> { + try { + WorkbenchUtils.openEditor(editorId, new ResourceEditorInput2(editorId, root, root, rvi)); + } catch (PartInitException e) { + LOGGER.error("Failed to open CSS editor for root " + root, e); } - }); }