Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.compare/compare/org/eclipse/compare/IEditableContent.java')
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/IEditableContent.java50
1 files changed, 50 insertions, 0 deletions
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/IEditableContent.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/IEditableContent.java
new file mode 100644
index 000000000..f41eecf20
--- /dev/null
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/IEditableContent.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed Materials - Property of IBM,
+ * WebSphere Studio Workbench
+ * (c) Copyright IBM Corp 2001
+ */
+package org.eclipse.compare;
+
+/**
+ * Common interface for objects with editable contents.
+ * Typically it is implemented by objects that also implement
+ * the <code>IStreamContentAccessor</code> interface.
+ * <p>
+ * Clients may implement this interface.
+ * <p>
+ * Note that implementing <code>IEditableContent</code> does not
+ * automatically mean that it is editable. An object is only editable if
+ * it implements <code>IEditableContent</code> and the <code>isEditable</code> method returns <code>true</code>.
+ *
+ * @see IStreamContentAccessor
+ */
+public interface IEditableContent {
+
+ /**
+ * Returns <code>true</code> if this object can be modified.
+ * If it returns <code>false</code> the other methods of this API must not be called.
+ *
+ * @return <code>true</code> if this object can be modified
+ */
+ boolean isEditable();
+
+ /**
+ * Replaces the current content with the given new bytes.
+ *
+ * @param newContent this new contents replaces the old contents
+ */
+ void setContent(byte[] newContent);
+
+ /**
+ * This method is called on a parent to
+ * - add a child,
+ * - remove a child,
+ * - copy the contents of a child
+ *
+ * What to do is encoded in the two arguments as follows:
+ * add: child == null other != null
+ * remove: child != null other == null
+ * copy: child != null other != null
+ */
+ ITypedElement replace(ITypedElement child, ITypedElement other);
+}

Back to the top