Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion bundles/org.eclipse.text/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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
Expand All @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@

import org.eclipse.core.runtime.Assert;

import org.eclipse.text.internal.TextPlugin;


/**
* Copy-on-write <code>ITextStore</code> wrapper.
Expand Down Expand Up @@ -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;
Expand All @@ -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$
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
@@ -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<String, String> 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 <code>null</code>
*/
public static void trace(String message) {
if (DEBUG) {
debugTrace.trace(null, message, null);
}
}
}
Loading