diff --git a/bundles/org.eclipse.text/META-INF/MANIFEST.MF b/bundles/org.eclipse.text/META-INF/MANIFEST.MF
index 516af6ca8a04..ea963949ec2a 100644
--- a/bundles/org.eclipse.text/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.text/META-INF/MANIFEST.MF
@@ -2,9 +2,10 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.text
-Bundle-Version: 3.14.600.qualifier
+Bundle-Version: 3.14.700.qualifier
Bundle-Vendor: %providerName
Bundle-Localization: plugin
+Bundle-Activator: org.eclipse.text.internal.TextPlugin
Export-Package:
org.eclipse.jface.text; text="split"; mandatory:="text",
org.eclipse.jface.text.link; text="split"; mandatory:="text",
@@ -14,6 +15,7 @@ Export-Package:
org.eclipse.jface.text.templates; text="split"; mandatory:="text",
org.eclipse.text.edits,
org.eclipse.text.html,
+ org.eclipse.text.internal;x-internal:=true,
org.eclipse.text.readers,
org.eclipse.text.templates,
org.eclipse.text.undo
@@ -24,3 +26,4 @@ Require-Bundle:
org.eclipse.core.runtime;bundle-version="[3.29.0,4.0.0)"
Bundle-RequiredExecutionEnvironment: JavaSE-17
Automatic-Module-Name: org.eclipse.text
+Bundle-ActivationPolicy: lazy
diff --git a/bundles/org.eclipse.text/src/org/eclipse/jface/text/CopyOnWriteTextStore.java b/bundles/org.eclipse.text/src/org/eclipse/jface/text/CopyOnWriteTextStore.java
index 8c20b2a62516..afca03f744a5 100644
--- a/bundles/org.eclipse.text/src/org/eclipse/jface/text/CopyOnWriteTextStore.java
+++ b/bundles/org.eclipse.text/src/org/eclipse/jface/text/CopyOnWriteTextStore.java
@@ -15,6 +15,8 @@
import org.eclipse.core.runtime.Assert;
+import org.eclipse.text.internal.TextPlugin;
+
/**
* Copy-on-write ITextStore wrapper.
@@ -135,6 +137,9 @@ public int getLength() {
@Override
public void replace(int offset, int length, String text) {
+ if (TextPlugin.DEBUG) {
+ TextPlugin.trace("CopyOnWriteTextStore.replace() offset=" + offset + ", length=" + length + ", text=" + text); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
if (fTextStore != fModifiableTextStore) {
String content= fTextStore.get(0, fTextStore.getLength());
fTextStore= fModifiableTextStore;
@@ -145,8 +150,12 @@ public void replace(int offset, int length, String text) {
@Override
public void set(String text) {
+ if (TextPlugin.DEBUG) {
+ TextPlugin.trace("CopyOnWriteTextStore.set() text=" + text); //$NON-NLS-1$
+ }
fTextStore= new StringTextStore(text);
fModifiableTextStore.set(""); //$NON-NLS-1$
}
+
}
diff --git a/bundles/org.eclipse.text/src/org/eclipse/jface/text/GapTextStore.java b/bundles/org.eclipse.text/src/org/eclipse/jface/text/GapTextStore.java
index 41ab32f890c2..c61f15e44309 100644
--- a/bundles/org.eclipse.text/src/org/eclipse/jface/text/GapTextStore.java
+++ b/bundles/org.eclipse.text/src/org/eclipse/jface/text/GapTextStore.java
@@ -15,6 +15,8 @@
import org.eclipse.core.runtime.Assert;
+import org.eclipse.text.internal.TextPlugin;
+
/**
* Implements a gap managing text store. The gap text store relies on the assumption that
@@ -186,6 +188,9 @@ public final void set(String text) {
@Override
public final void replace(int offset, int length, String text) {
+ if (TextPlugin.DEBUG) {
+ TextPlugin.trace("GapTextStore.replace() offset=" + offset + ", length=" + length + ", text=" + text); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
if (text == null) {
adjustGap(offset, length, 0);
} else {
diff --git a/bundles/org.eclipse.text/src/org/eclipse/text/internal/TextPlugin.java b/bundles/org.eclipse.text/src/org/eclipse/text/internal/TextPlugin.java
new file mode 100644
index 000000000000..629ceb8df97a
--- /dev/null
+++ b/bundles/org.eclipse.text/src/org/eclipse/text/internal/TextPlugin.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) Simeon Andreev and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Simeon Andreev - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.text.internal;
+
+import java.util.Hashtable;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+import org.eclipse.osgi.service.debug.DebugOptions;
+import org.eclipse.osgi.service.debug.DebugOptionsListener;
+import org.eclipse.osgi.service.debug.DebugTrace;
+
+public class TextPlugin implements BundleActivator, DebugOptionsListener {
+
+ public static final String PLUGIN_ID = "org.eclipse.text"; //$NON-NLS-1$
+
+ private static final String DEBUG_FLAG = PLUGIN_ID + "/debug"; //$NON-NLS-1$
+
+ private static DebugTrace debugTrace;
+
+ public static boolean DEBUG = false;
+
+ @Override
+ public void start(BundleContext context) throws Exception {
+ Hashtable props = new Hashtable<>(2);
+ props.put(DebugOptions.LISTENER_SYMBOLICNAME, PLUGIN_ID);
+ context.registerService(DebugOptionsListener.class.getName(), this, props);
+ }
+
+ @Override
+ public void optionsChanged(DebugOptions options) {
+ debugTrace = options.newDebugTrace(PLUGIN_ID, TextPlugin.class);
+ DEBUG = options.getBooleanOption(DEBUG_FLAG, false);
+ }
+
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ }
+
+ /**
+ * Prints the given message to the OSGi tracing (if enabled)
+ *
+ * @param message the message or null
+ */
+ public static void trace(String message) {
+ if (DEBUG) {
+ debugTrace.trace(null, message, null);
+ }
+ }
+}