]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/dnd/DropSuggestion.java
Ask to link library to model when dropping symbol from unlinked library
[simantics/platform.git] / bundles / org.simantics.modeling.ui / src / org / simantics / modeling / ui / diagramEditor / dnd / DropSuggestion.java
diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/dnd/DropSuggestion.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/dnd/DropSuggestion.java
new file mode 100644 (file)
index 0000000..52d239c
--- /dev/null
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (c) 2018 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:
+ *     Semantum Oy - initial API and implementation
+ *******************************************************************************/
+package org.simantics.modeling.ui.diagramEditor.dnd;
+
+import org.simantics.db.WriteGraph;
+import org.simantics.db.exception.DatabaseException;
+
+/**
+ * Represents a suggestion of a fix/change that must be made to the target model
+ * before actually performing the element to diagram drop database changes.
+ * 
+ * The {@link #toString()} method should return a clear description of the
+ * suggested fix/change.
+ * 
+ * @author Tuukka Lehtonen
+ * @since 1.37.0
+ */
+public interface DropSuggestion {
+
+    /**
+     * Perform the suggested database fix/change encapsulated by this instance.
+     * 
+     * @param graph
+     * @throws DatabaseException
+     */
+    void fix(WriteGraph graph) throws DatabaseException;
+
+    /**
+     * @return a clear end-user readable description of the suggested fix/change
+     */
+    @Override
+    String toString();
+
+}