diff options
Diffstat (limited to 'bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional')
43 files changed, 0 insertions, 4422 deletions
diff --git a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/AbstractAdapterFactory.java b/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/AbstractAdapterFactory.java deleted file mode 100644 index 4aa9c807d9..0000000000 --- a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/AbstractAdapterFactory.java +++ /dev/null @@ -1,158 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation and others. - * 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: - * IBM Corporation - initial API and implementation - * Jens Lukowski/Innoopract - initial renaming/restructuring - * - *******************************************************************************/ -package org.eclipse.wst.sse.core.internal.provisional; - -/** - * An abstract implementation of IAdapterFactory. All implementers of - * IAdapterFactory should subclass this class. The default constructor uses - * itself (this) as the key. Subclasses need to provide a way to create the - * adapter, and can override or call other methods. - */ -abstract public class AbstractAdapterFactory implements INodeAdapterFactory { - - - - private Object fAdapterKey; - - private boolean fShouldRegisterAdapter; - - /** - * If this default constructor used, setAdapterKey and setShouldRegister - * should be used to properly initialize. - */ - protected AbstractAdapterFactory() { - super(); - - } - - - public AbstractAdapterFactory(Object adapterKey) { - this(adapterKey, true); - } - - /** - * Suclasses may extended this constructor, if needed. - */ - - public AbstractAdapterFactory(Object adapterKey, boolean registerAdapters) { - - super(); - fAdapterKey = adapterKey; - fShouldRegisterAdapter = registerAdapters; - - } - - /** - * ISSUE: should be final. See those that implement it - * for complicating details and "unknowns". - */ - public INodeAdapter adapt(INodeNotifier target) { - INodeAdapter adapter = null; - if (target != null) { - adapter = target.getExistingAdapter(fAdapterKey); - if (adapter == null) { - adapter = adaptNew(target); - } - } - return adapter; - } - - /** - * Subclasses should normally implement their own 'copy' method. By - * default, we'll return the same instance, for convenience of those using - * singleton factories (which have no state, and so need to do anything on - * 'release'). - * - */ - public INodeAdapterFactory copy() { - return this; - } - - /** - * This method needs to return true of this factory is for adapters of - * type 'type'. It is required that it return true if 'equals' and this - * default behavior is provided by this super class. Clients may extend - * this behavior if more complex logic is required. - */ - public boolean isFactoryForType(Object type) { - return type.equals(fAdapterKey); - } - - /** - * Subclasses may need to "cleanup" their adapter factory, release - * adapters, resources, etc. Subclasses may extend this method if such - * clean up is required. Note: while current behavior is to do nothing, - * subclasses should not assume this would always be true, so should - * always call super.release at the end of their method. - */ - public void release() { - // default for superclass is to do nothing - } - - /** - * Only for special cases there the adapter key can be set in the - * constructor. It can be set here. If it is set more than, and - */ - final protected void setAdapterKey(Object key) { - if (fAdapterKey != null && !(fAdapterKey.equals(key))) - throw new IllegalStateException("INodeAdapter Key cannot be changed."); //$NON-NLS-1$ - fAdapterKey = key; - } - - /** - * Can be called by subclasses during 'adapt' process, but must not be - * overridden or reimplemented by subclasses. - * - * @param target - * @return - */ - protected final INodeAdapter adaptNew(INodeNotifier target) { - INodeAdapter adapter = createAdapter(target); - if (adapter != null) { - if (fShouldRegisterAdapter) { - target.addAdapter(adapter); - } - } - return adapter; - } - - /** - * Subclasses must implement this method. It is called by infrastructure - * when an instance is needed. It is provided the node notifier, which may - * or may not be relevent when creating the adapter. Note: the adapter - * does not have to literally be a new intance and is actually recommended - * to typically be a singleton for performance reasons. - * - * @param target - * @return - */ - abstract protected INodeAdapter createAdapter(INodeNotifier target); - - - protected final boolean isShouldRegisterAdapter() { - return fShouldRegisterAdapter; - } - - - protected final void setShouldRegisterAdapter(boolean shouldRegisterAdapter) { - // ISSUE: technically we probably should not allow this value to - // change, after initialization, but is not so easy to do, - // and I'm not sure its "worth" the protection. - fShouldRegisterAdapter = shouldRegisterAdapter; - } - - - protected final Object getAdapterKey() { - return fAdapterKey; - } -} diff --git a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/AbstractNotifier.java b/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/AbstractNotifier.java deleted file mode 100644 index 1014270cea..0000000000 --- a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/AbstractNotifier.java +++ /dev/null @@ -1,240 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2004 IBM Corporation and others. - * 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: - * IBM Corporation - initial API and implementation - * Jens Lukowski/Innoopract - initial renaming/restructuring - * - *******************************************************************************/ -package org.eclipse.wst.sse.core.internal.provisional; - -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; - -import org.eclipse.core.runtime.Platform; -import org.eclipse.wst.sse.core.internal.Logger; -import org.eclipse.wst.sse.core.internal.model.FactoryRegistry; - - - -/** - * AbstractNotifier is similar to (and based on) the EMF NotifierImpl class, - * but is not related to EMF per se. This class is simpler (that is, not as - * many functions). - * - * Implementers of this INodeNotifier must subclass this class. - */ -public abstract class AbstractNotifier implements INodeNotifier { - private final static int growthConstant = 3; - private int adapterCount = 0; - - private INodeAdapter[] fAdapters; - - /** - * AbstractNotifier constructor comment. - */ - public AbstractNotifier() { - super(); - } - - /** - * addAdapter method comment. - */ - public synchronized void addAdapter(INodeAdapter adapter) { - - if (adapter == null) - return; - ensureCapacity(adapterCount + 1); - fAdapters[adapterCount++] = adapter; - } - - private void ensureCapacity(int needed) { - if (fAdapters == null) { - // first time - fAdapters = new INodeAdapter[needed + growthConstant]; - return; - } - int oldLength = fAdapters.length; - if (oldLength < needed) { - INodeAdapter[] oldAdapters = fAdapters; - INodeAdapter[] newAdapters = new INodeAdapter[needed + growthConstant]; - System.arraycopy(oldAdapters, 0, newAdapters, 0, adapterCount); - fAdapters = newAdapters; - } - } - - /** - * NOT API: used only for testing. - * - * @return int - */ - public int getAdapterCount() { - return adapterCount; - } - - /** - * Default behavior for getting an adapter. - */ - public INodeAdapter getAdapterFor(Object type) { - // first, we'll see if we already have one - INodeAdapter result = getExistingAdapter(type); - // if we didn't find one in our list already, - // let's create it - if (result == null) { - FactoryRegistry reg = getFactoryRegistry(); - if (reg != null) { - INodeAdapterFactory factory = reg.getFactoryFor(type); - if (factory != null) { - result = factory.adapt(this); - } - } - // We won't prevent null from being returned, but it would be - // unusual. - // It might be because Factory is not working correctly, or - // not installed, so we'll allow warning message. - if ((result == null) && (org.eclipse.wst.sse.core.internal.util.Debug.displayWarnings)) { - System.out.println("Warning: no adapter was found or created for " + type); //$NON-NLS-1$ - } - } - return result; - } - - /** - * Returns a shallow clone of list, since clients should not manipulate - * our list directly. Instead, they should use add/removeAdapter. - */ - public Collection getAdapters() { - if (fAdapters != null) { - if (adapterCount == 0) { - fAdapters = null; - return Collections.EMPTY_LIST; - } - else { - // we need to make a new array, to be sure - // it doesn't contain nulls at end, which may be - // present there for "growth". - INodeAdapter[] tempAdapters = new INodeAdapter[adapterCount]; - System.arraycopy(fAdapters, 0, tempAdapters, 0, adapterCount); - // EMF uses the unmodifiableCollection. Its a bit of a - // performance - // drain, but may want to leave in since - // it would "fail fast" if someone was trying to modify the - // list. - return Collections.unmodifiableCollection(Arrays.asList(tempAdapters)); - // return Arrays.asList(newAdapters); - } - } - else - return Collections.EMPTY_LIST; - } - - private long getAdapterTimeCriteria() { - // to "re-get" the property each time is a little awkward, but we - // do it that way to avoid adding instance variable just for - // debugging. - // This method should only be called if debugAdapterNotifcationTime - // is true. - final String criteriaStr = Platform.getDebugOption("org.eclipse.wst.sse.core/dom/adapter/notification/time/criteria"); //$NON-NLS-1$ - long criteria = -1; - if (criteriaStr != null) { - try { - criteria = Long.parseLong(criteriaStr); - } - catch (NumberFormatException e) { - // catch to be sure we don't burb in notification loop, - // but ignore, since just a debug aid - } - } - return criteria; - } - - public INodeAdapter getExistingAdapter(Object type) { - INodeAdapter result = null; - for (int i = 0; i < adapterCount; i++) { - INodeAdapter a = fAdapters[i]; - if (a.isAdapterForType(type)) { - result = a; - break; - } - } - // if we didn't find one in our list, - // return the null result - return result; - } - - abstract public FactoryRegistry getFactoryRegistry(); - - public void notify(int eventType, Object changedFeature, Object oldValue, Object newValue, int pos) { - - if (fAdapters != null) { - int localAdapterCount = 0; - INodeAdapter[] localAdapters = null; - - // lock object while making local assignments - synchronized (this) { - localAdapterCount = adapterCount; - localAdapters = new INodeAdapter[localAdapterCount]; - System.arraycopy(fAdapters, 0, localAdapters, 0, localAdapterCount); - } - - for (int i = 0; i < localAdapterCount; i++) { - INodeAdapter a = localAdapters[i]; - - if (Logger.DEBUG_ADAPTERNOTIFICATIONTIME) { - long getAdapterTimeCriteria = getAdapterTimeCriteria(); - long startTime = System.currentTimeMillis(); - // ** keep this line identical with non-debug version!! - a.notifyChanged(this, eventType, changedFeature, oldValue, newValue, pos); - long notifyDuration = System.currentTimeMillis() - startTime; - if (getAdapterTimeCriteria >= 0 && notifyDuration > getAdapterTimeCriteria) { - System.out.println("adapter notifyDuration: " + notifyDuration + " class: " + a.getClass()); //$NON-NLS-1$ //$NON-NLS-2$ - } - } - else { - try { - // ** keep this line identical with debug version!! - a.notifyChanged(this, eventType, changedFeature, oldValue, newValue, pos); - } - catch (Exception e) { - // Its important to "keep going", since notifications - // occur between an - // aboutToChange event and a changed event -- the - // changed event typically being require - // to restore state, etc. So, we just log message, do - // not re-throw it, but - // typically the exception does indicate a serious - // program error. - Logger.logException("A structured model client, " + a + " threw following exception during adapter notification (" + INodeNotifier.EVENT_TYPE_STRINGS[eventType] + " )", e); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - } - } - - } - } - } - - public synchronized void removeAdapter(INodeAdapter a) { - if (fAdapters == null || a == null) - return; - int newIndex = 0; - INodeAdapter[] newAdapters = new INodeAdapter[fAdapters.length]; - int oldAdapterCount = adapterCount; - boolean found = false; - for (int oldIndex = 0; oldIndex < oldAdapterCount; oldIndex++) { - INodeAdapter candidate = fAdapters[oldIndex]; - if (a == candidate) { - adapterCount--; - found = true; - } - else - newAdapters[newIndex++] = fAdapters[oldIndex]; - } - if (found) - fAdapters = newAdapters; - } - -} diff --git a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/DocumentChanged.java b/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/DocumentChanged.java deleted file mode 100644 index f0987dc2f3..0000000000 --- a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/DocumentChanged.java +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2004 IBM Corporation and others. - * 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: - * IBM Corporation - initial API and implementation - * Jens Lukowski/Innoopract - initial renaming/restructuring - * - *******************************************************************************/ -package org.eclipse.wst.sse.core.internal.provisional; - -import org.eclipse.wst.sse.core.internal.model.ModelLifecycleEvent; -import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument; - -public class DocumentChanged extends ModelLifecycleEvent { - private IStructuredDocument fNewDocument; - - private IStructuredDocument fOldDocument; - - protected DocumentChanged() { - - super(ModelLifecycleEvent.MODEL_DOCUMENT_CHANGED); - - } - - protected DocumentChanged(int additionalType, IStructuredModel model) { - - super(model, ModelLifecycleEvent.MODEL_DOCUMENT_CHANGED | additionalType); - - } - - public DocumentChanged(int additionalType, IStructuredModel model, IStructuredDocument oldDocument, IStructuredDocument newDocument) { - - this(additionalType, model); - fOldDocument = oldDocument; - fNewDocument = newDocument; - } - - public IStructuredDocument getNewDocument() { - - return fNewDocument; - } - - public IStructuredDocument getOldDocument() { - - return fOldDocument; - } - - void setNewDocument(IStructuredDocument newDocument) { - - fNewDocument = newDocument; - } - - void setOldDocument(IStructuredDocument oldDocument) { - - fOldDocument = oldDocument; - } -} diff --git a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/IModelLifecycleListener.java b/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/IModelLifecycleListener.java deleted file mode 100644 index a0b7e97870..0000000000 --- a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/IModelLifecycleListener.java +++ /dev/null @@ -1,27 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2004 IBM Corporation and others. - * 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: - * IBM Corporation - initial API and implementation - * Jens Lukowski/Innoopract - initial renaming/restructuring - * - *******************************************************************************/ -package org.eclipse.wst.sse.core.internal.provisional; - -import org.eclipse.wst.sse.core.internal.model.ModelLifecycleEvent; - -/** - * This is an early version of a class that may change over the next few - * milestones. - */ - -public interface IModelLifecycleListener { - - void processPostModelEvent(ModelLifecycleEvent event); - - void processPreModelEvent(ModelLifecycleEvent event); -} diff --git a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/IModelLoader.java b/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/IModelLoader.java deleted file mode 100644 index ccbff881dd..0000000000 --- a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/IModelLoader.java +++ /dev/null @@ -1,87 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2004 IBM Corporation and others. - * 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: - * IBM Corporation - initial API and implementation - * Jens Lukowski/Innoopract - initial renaming/restructuring - * - *******************************************************************************/ -package org.eclipse.wst.sse.core.internal.provisional; - -import java.io.IOException; -import java.io.InputStream; -import java.util.List; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.wst.sse.core.internal.encoding.EncodingRule; -import org.eclipse.wst.sse.core.internal.ltk.modelhandler.IModelHandler; -import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument; - - -/** - * Responsible for creating a new Model from a resource, or as a new, empty - * instance. - * - */ -public interface IModelLoader { - /** - * This method should perform all the model initialization required before - * it contains content, namely, it should call newModel, the - * createNewStructuredDocument(), then setAdapterFactories. (this is - * tentative) - */ - IStructuredModel createModel(); - - /** - * Method createModel. Creates a new model based on old one. - * - * @param oldModel - * @return IStructuredModel - */ - IStructuredModel createModel(IStructuredModel oldModel); - - /** - * This method must return those factories which must be attached to the - * structuredModel before content is applied. - */ - List getAdapterFactories(); - - void load(IFile file, IStructuredModel model) throws IOException, CoreException; - - void load(InputStream inputStream, IStructuredModel model, EncodingRule encodingRule) throws IOException; - - void load(String filename, InputStream inputStream, IStructuredModel model, String encodingName, String lineDelimiter) throws IOException; - - IModelLoader newInstance(); - - /** - * This method should always return an new, empty Structured Model - * appropriate for itself. - */ - IStructuredModel newModel(); - - IStructuredModel reinitialize(IStructuredModel model); - - /** - * This method should get a fresh copy of the data, and repopulate the - * models ... normally by a call to setText on the structuredDocument, for - * StructuredModels. This method is needed in some cases where clients are - * sharing a model and then changes canceled. Say for example, one editor - * and several "displays" are sharing a model, if the editor is closed - * without saving changes, then the displays still need a model, but they - * should revert to the original unsaved version. - */ - void reload(InputStream inputStream, IStructuredModel model); - - /** - * Create a Structured Model with the given StructuredDocument instance as - * its document (instead of a new document instance as well) - */ - IStructuredModel createModel(IStructuredDocument document, String baseLocation, IModelHandler handler); - -} diff --git a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/IModelManager.java b/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/IModelManager.java deleted file mode 100644 index 03155a8219..0000000000 --- a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/IModelManager.java +++ /dev/null @@ -1,297 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2004 IBM Corporation and others. - * 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: - * IBM Corporation - initial API and implementation - * Jens Lukowski/Innoopract - initial renaming/restructuring - * - *******************************************************************************/ -package org.eclipse.wst.sse.core.internal.provisional; - -import java.io.IOException; -import java.io.InputStream; -import java.io.UnsupportedEncodingException; -import java.util.Enumeration; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.jface.text.IDocument; -import org.eclipse.wst.sse.core.internal.encoding.EncodingRule; -import org.eclipse.wst.sse.core.internal.provisional.exceptions.ResourceAlreadyExists; -import org.eclipse.wst.sse.core.internal.provisional.exceptions.ResourceInUse; -import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument; -import org.eclipse.wst.sse.core.internal.util.URIResolver; - - -/** - * Responsible for providing a set of APIs for creating a new model manager, - * for managing (add or remove) model loaders and model dumpers, and for - * managing (get, release, save, and save as) models. - * - * Clients can reference, but should not implement. - * - * @see StructuredModelManger - */ -public interface IModelManager { - - public final static String DUPLICATED_MODEL = "org.eclipse.wst.sse.core.IModelManager.DUPLICATED_MODEL"; //$NON-NLS-1$ - public final static String UNMANAGED_MODEL = "org.eclipse.wst.sse.core.IModelManager.UNMANAGED_MODEL"; //$NON-NLS-1$ - - /** - * Calculate id provides a common way to determine the id from the input - * ... needed to get and save the model. It is a simple class utility, but - * is an instance method so can be accessed via interface. - */ - public String calculateId(IFile file); - - IStructuredModel copyModelForEdit(String oldId, String newId) throws ResourceInUse; - - /** - * createNewInstance is similar to clone, except the new instance has no - * content. Note: this produces an unmanaged model, for temporary use. If - * a true shared model is desired, use "copy". - */ - public IStructuredModel createNewInstance(IStructuredModel model) throws IOException; - - /** - * Factory method, since a proper IStructuredDocument must have a proper - * parser assigned. Note: its assume that IFile does not actually exist as - * a resource yet. If it does, ResourceAlreadyExists exception is thrown. - * If the resource does already exist, then createStructuredDocumentFor is - * the right API to use. - * - */ - IStructuredDocument createNewStructuredDocumentFor(IFile iFile) throws ResourceAlreadyExists, IOException, CoreException; - - /** - * Factory method, since a proper IStructuredDocument must have a proper - * parser assigned. Note: clients should verify IFile exists before using - * this method. If this IFile does not exist, then - * createNewStructuredDocument is the correct API to use. - */ - IStructuredDocument createStructuredDocumentFor(IFile iFile) throws IOException, CoreException; - - /** - * Conveience method, since a proper IStructuredDocument must have a - * proper parser assigned. It should only be used when an empty - * structuredDocument is needed. Otherwise, use IFile form. - */ - IStructuredDocument createStructuredDocumentFor(String contentTypeId); - - /** - * @deprecated -- I marked as deprecated to discouage use of this method. - * It does not really work for JSP fragments, since JSP - * Fragments need an IFile to correctly look up the content - * settings. Use IFile form instead. Note: some confustion - * with it and the form for HTPP encoding, so once a null arg - * is allowed in that API ... we can remove this one. (after - * verifying again with Tom/Linksbuild) - */ - IStructuredDocument createStructuredDocumentFor(String filename, InputStream inputStream, URIResolver resolver) throws IOException; - - IStructuredDocument createStructuredDocumentFor(String filename, InputStream inputStream, URIResolver resolver, String ianaEncodingName) throws IOException; - - IStructuredDocument createStructuredDocumentFor(String filename, String content, URIResolver resolver) throws IOException; - - /** - * Conveience method. It depends on the loaders newModel method to return - * an appropriate StrucuturedModel appropriately initialized. - */ - IStructuredModel createUnManagedStructuredModelFor(IFile iFile) throws IOException, CoreException; - - /** - * Conveience method. It depends on the loaders newModel method to return - * an appropriate StrucuturedModel appropriately initialized. - */ - IStructuredModel createUnManagedStructuredModelFor(String contentTypeId); - - IStructuredModel createUnManagedStructuredModelFor(String contentTypeId, URIResolver resolver); - - /** - * Note: users of this 'model' must still release it when finished. - * Returns null if there's not a model corresponding to document. - */ - IStructuredModel getExistingModelForEdit(IDocument document); - - public IStructuredModel getExistingModelForEdit(IFile iFile); - - /** - * This is similar to the getModel method, except this method does not - * create a model. This method does increment the reference count (if it - * exists). If the model does not already exist in the cache of models, - * null is returned. - */ - public IStructuredModel getExistingModelForEdit(Object id); - - /** - * Note: users of this 'model' must still release it when finished. - * Returns null if there's not a model corresponding to document. - */ - IStructuredModel getExistingModelForRead(IDocument document); - - public IStructuredModel getExistingModelForRead(IFile iFile); - - /** - * This is similar to the getModel method, except this method does not - * create a model. This method does increment the reference count (if it - * exists). If the model does not already exist in the cache of models, - * null is returned. - */ - public IStructuredModel getExistingModelForRead(Object id); - - public Enumeration getExistingModelIds(); - - public IStructuredModel getModelForEdit(IFile iFile) throws IOException, CoreException; - - /* - * @deprecated - encoding is handled automatically - */ - public IStructuredModel getModelForEdit(IFile iFile, EncodingRule encodingRule) throws UnsupportedEncodingException, IOException, CoreException; - - public IStructuredModel getModelForEdit(IFile iFile, String encoding, String lineDelimiter) throws UnsupportedEncodingException, IOException, CoreException; - - public IStructuredModel getModelForEdit(IStructuredDocument textFileBufferDocument); - - /* - * @deprecated - a URI resolver should be automatically created when - * needed - */ - public IStructuredModel getModelForEdit(String id, InputStream inStream, URIResolver resolver) throws UnsupportedEncodingException, IOException; - - public IStructuredModel getModelForRead(IFile iFile) throws IOException, CoreException; - - /* - * @deprecated - encoding is handled automatically - */ - public IStructuredModel getModelForRead(IFile iFile, EncodingRule encodingRule) throws UnsupportedEncodingException, IOException, CoreException; - - /* - * @deprecated - encoding and line delimiters are handled automatically - */ - public IStructuredModel getModelForRead(IFile iFile, String encoding, String lineDelimiter) throws UnsupportedEncodingException, IOException, CoreException; - - public IStructuredModel getModelForRead(IStructuredDocument textFileBufferDocument); - - /* - * @deprecated - a URI resolver should be automatically created when - * needed - */ - public IStructuredModel getModelForRead(String filename, InputStream inStream, URIResolver resolver) throws UnsupportedEncodingException, IOException; - - /** - * This method will not create a new model if it already exists ... if - * force is false. The idea is that a client should call this method once - * with force set to false. If the exception is thrown, then prompt client - * if they want to overwrite. - */ - IStructuredModel getNewModelForEdit(IFile iFile, boolean force) throws ResourceAlreadyExists, ResourceInUse, IOException, CoreException; - - /** - * This method will not create a new model if it already exists ... if - * force is false. The idea is that a client should call this method once - * with force set to false. If the exception is thrown, then prompt client - * if they want to overwrite. - */ - IStructuredModel getNewModelForRead(IFile iFile, boolean force) throws ResourceAlreadyExists, ResourceInUse, IOException, CoreException; - - /** - * This function returns the reference count of underlying model. - * - * @param id - * Object The id of the model TODO: try to refine the design - * not to use this function - * @deprecated - */ - int getReferenceCount(Object id); - - /** - * This function returns the reference count of underlying model. - * - * @param id - * Object The id of the model TODO: try to refine the design - * not to use this function - * @deprecated - */ - int getReferenceCountForEdit(Object id); - - /** - * This function returns the reference count of underlying model. - * - * @param id - * Object The id of the model TODO: try to refine the design - * not to use this function - * @deprecated - */ - int getReferenceCountForRead(Object id); - - /** - * This function returns true if there are other references to the - * underlying model. - * - * @param id - * Object The id of the model - */ - boolean isShared(Object id); - - /** - * This function returns true if there are other references to the - * underlying model. - * - * @param id - * Object The id of the model - */ - boolean isSharedForEdit(Object id); - - /** - * This function returns true if there are other references to the - * underlying model. - * - * @param id - * Object The id of the model - */ - boolean isSharedForRead(Object id); - - /** - * This method can be called to determine if the model manager is within a - * "aboutToChange" and "changed" sequence. - */ - public boolean isStateChanging(); - - /** - * This method changes the id of the model. TODO: try to refine the design - * not to use this function - * - * @deprecated - */ - void moveModel(Object oldId, Object newId); - - /** - * This method can be called when the content type of a model changes. Its - * assumed the contentType has already been changed, and this method uses - * the text of the old one, to repopulate the text of the new one. In - * theory, the actual instance could change, (e.g. using 'saveAs' to go - * from xml to dtd), but in practice, the intent of this API is to return - * the same instance, just using different handlers, adapter factories, - * etc. - */ - IStructuredModel reinitialize(IStructuredModel model) throws IOException; - - /** - * This is similar to the getModel method, except this method does not use - * the cached version, but forces the cached version to be replaced with a - * fresh, unchanged version. Note: this method does not change any - * reference counts. Also, if there is not already a cached version of the - * model, then this call is essentially ignored (that is, it does not put - * a model in the cache) and returns null. - * - * @deprecated - */ - IStructuredModel reloadModel(Object id, InputStream inStream) throws UnsupportedEncodingException; - - void saveStructuredDocument(IStructuredDocument structuredDocument, IFile iFile) throws UnsupportedEncodingException, IOException, CoreException; - -} diff --git a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/IModelStateListener.java b/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/IModelStateListener.java deleted file mode 100644 index 0ebdd8b4f8..0000000000 --- a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/IModelStateListener.java +++ /dev/null @@ -1,64 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2004 IBM Corporation and others. - * 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: - * IBM Corporation - initial API and implementation - * Jens Lukowski/Innoopract - initial renaming/restructuring - * - *******************************************************************************/ -package org.eclipse.wst.sse.core.internal.provisional; - - - -/** - * Interface for those wanting to listen to a model's state changing. - */ -public interface IModelStateListener { - - /** - * A model is about to be changed. This typically is initiated by one - * client of the model, to signal a large change and/or a change to the - * model's ID or base Location. A typical use might be if a client might - * want to suspend processing until all changes have been made. - */ - void modelAboutToBeChanged(IStructuredModel model); - - /** - * Signals that the changes foretold by modelAboutToBeChanged have been - * made. A typical use might be to refresh, or to resume processing that - * was suspended as a result of modelAboutToBeChanged. - */ - void modelChanged(IStructuredModel model); - - /** - * Notifies that a model's dirty state has changed, and passes that state - * in isDirty. A model becomes dirty when any change is made, and becomes - * not-dirty when the model is saved. - */ - void modelDirtyStateChanged(IStructuredModel model, boolean isDirty); - - /** - * A modelDeleted means the underlying resource has been deleted. The - * model itself is not removed from model management until all have - * released it. Note: baseLocation is not (necessarily) changed in this - * event, but may not be accurate. - */ - void modelResourceDeleted(IStructuredModel model); - - /** - * A model has been renamed or copied (as in saveAs..). In the renamed - * case, the two paramenters are the same instance, and only contain the - * new info for id and base location. - */ - void modelResourceMoved(IStructuredModel oldModel, IStructuredModel newModel); - - void modelAboutToBeReinitialized(IStructuredModel structuredModel); - - void modelReinitialized(IStructuredModel structuredModel); - - -} diff --git a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/INodeAdapter.java b/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/INodeAdapter.java deleted file mode 100644 index a81418e1fe..0000000000 --- a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/INodeAdapter.java +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2004 IBM Corporation and others. - * 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: - * IBM Corporation - initial API and implementation - * Jens Lukowski/Innoopract - initial renaming/restructuring - * - *******************************************************************************/ -package org.eclipse.wst.sse.core.internal.provisional; - -/** - * This interface allows nodes to be adapted. - * - * The main difference between this type of adapter (IAdaptable) and base - * adapter is that these adapters are notified of changes. - * - * @plannedfor 1.0 - */ - -public interface INodeAdapter { - - /** - * The infrastructure calls this method to determine if the adapter is - * appropriate for 'type'. Typically, adapters return true based on - * identity comparison to 'type', but this is not required, that is, the - * decision can be based on complex logic. - * - */ - boolean isAdapterForType(Object type); - - /** - * Sent to adapter when notifier changes. Each notifier is responsible for - * defining specific eventTypes, feature changed, etc. - * - * ISSUE: may be more evolvable if the argument was one big 'notifier - * event' instance. - */ - void notifyChanged(INodeNotifier notifier, int eventType, Object changedFeature, Object oldValue, Object newValue, int pos); -} diff --git a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/INodeAdapterFactory.java b/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/INodeAdapterFactory.java deleted file mode 100644 index 3967c48467..0000000000 --- a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/INodeAdapterFactory.java +++ /dev/null @@ -1,76 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2004 IBM Corporation and others. - * 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: - * IBM Corporation - initial API and implementation - * Jens Lukowski/Innoopract - initial renaming/restructuring - * - *******************************************************************************/ -package org.eclipse.wst.sse.core.internal.provisional; - -/** - * INodeNotifiers can be adapted by INodeAdapters. This factory interface - * provides a way to provide factories which are invoked by the infrastructure - * to manage this process, from creating, to adapting, to releasing, if - * required. - * - * @plannedfor 1.0 - * - */ -public interface INodeAdapterFactory { - - /** - * The primary purpose of an adapter factory is to create an adapter and - * associate it with an INodeNotifier. This adapt method Method that - * returns the adapter associated with the given object. The - * implementation of this method should call addAdapter on the adapted - * object with the correct instance of the adapter, if appropriate. - * - * Note: the instance of the adapter returned may be a singleton or not - * ... depending on the needs of the INodeAdapter ... but in general it is - * recommended for an adapter to be stateless, so the efficiencies of a - * singleton can be gained. - * - * @param object - * the node notifier to be adapted - */ - INodeAdapter adapt(INodeNotifier object); - - /** - * Unlike clone, this method may or may not return the same instance, such - * as in the case where the IAdapterFactory is intended to be a singleton. - * - * @return an instance of this adapter factory. - */ - public INodeAdapterFactory copy(); - - /** - * isFactoryForType is called by infrastructure to decide if this adapter - * factory is apporiate to use for an adapter request that specifies - * 'type'. - * - * @param type - - * same object used to identify/request adapters. - * @return true if factory is appropriate for type, false otherwise. - */ - boolean isFactoryForType(Object type); - - /** - * release is called by infrastructure when the factory registry is - * released (which is done when a structured model is released). This - * intened for the factory to be allowed to clean up any state information - * it may have. - * - * Note: while not recommended, due to performance reasons, if individual - * adapters need some cleanup (or need to be released) it is (typically) - * the responsibility of the adapter factory to track them, and initiate - * what ever clean up is needed. In other works, cleanup at the adatper - * level is not provided by infrastructure. - */ - public void release(); - -} diff --git a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/INodeNotifier.java b/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/INodeNotifier.java deleted file mode 100644 index 13103b359f..0000000000 --- a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/INodeNotifier.java +++ /dev/null @@ -1,103 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2004 IBM Corporation and others. - * 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: - * IBM Corporation - initial API and implementation - * Jens Lukowski/Innoopract - initial renaming/restructuring - * - *******************************************************************************/ -package org.eclipse.wst.sse.core.internal.provisional; - - - -import java.util.Collection; - -/** - * INodeNotifiers and INodeAdapters form a collaboration that allows clients - * to use the typical adapter pattern but with notification added, that is, - * client's adapters will be notified when the nodeNotifier changes. - * - * @plannedfor 1.0 - */ - -public interface INodeNotifier { - - /** - * The change represents a non-structural change, sent to node notifier's - * parent. - */ - static final int CHANGE = 1; - /** - * The change represents an add event. - */ - static final int ADD = 2; - - /** - * The change represents a remove event. - */ - static final int REMOVE = 3; - - /** - * The change represents a structural change, sent to least-common parent - * of node notifiers involved in the structural change - */ - static final int STRUCTURE_CHANGED = 4; - - /** - * The change represents a notification to parent notifier than its - * contents have changed. - */ - static final int CONTENT_CHANGED = 5; - - - /** - * NOT API: these strings are for printing, such as during debuging - */ - static final String[] EVENT_TYPE_STRINGS = new String[]{"undefined", "CHANGE", "ADD", "REMOVE", "STRUCUTRED_CHANGED", "CONTENT_CHANGED"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ - - - /** - * Add an adapter of this notifier. - * - * @param adapter - * the adapter to be added - * - */ - void addAdapter(INodeAdapter adapter); - - /** - * Return an exisiting adapter of type "type" or if none found create a - * new adapter using a registered adapter factory - */ - INodeAdapter getAdapterFor(Object type); - - /** - * Return a read-only Collection of the Adapters to this notifier. - * - * @return collection of adapters. - */ - Collection getAdapters(); - - /** - * Return an exisiting adapter of type "type" or null if none found - */ - INodeAdapter getExistingAdapter(Object type); - - /** - * sent to adapter when its nodeNotifier changes. - */ - void notify(int eventType, Object changedFeature, Object oldValue, Object newValue, int pos); - - /** - * Remove an adapter of this notifier. If the adapter does not exist for - * this node notifier, this request is ignored. - * - * @param adapter - * the adapter to remove - */ - void removeAdapter(INodeAdapter adapter); -} diff --git a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/IStructuredModel.java b/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/IStructuredModel.java deleted file mode 100644 index ba79ac677f..0000000000 --- a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/IStructuredModel.java +++ /dev/null @@ -1,391 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2004 IBM Corporation and others. - * 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: - * IBM Corporation - initial API and implementation - * Jens Lukowski/Innoopract - initial renaming/restructuring - * - *******************************************************************************/ -package org.eclipse.wst.sse.core.internal.provisional; - -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.io.UnsupportedEncodingException; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.wst.sse.core.internal.encoding.EncodingRule; -import org.eclipse.wst.sse.core.internal.ltk.modelhandler.IModelHandler; -import org.eclipse.wst.sse.core.internal.model.FactoryRegistry; -import org.eclipse.wst.sse.core.internal.provisional.exceptions.ResourceAlreadyExists; -import org.eclipse.wst.sse.core.internal.provisional.exceptions.ResourceInUse; -import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument; -import org.eclipse.wst.sse.core.internal.undo.IStructuredTextUndoManager; -import org.eclipse.wst.sse.core.internal.util.URIResolver; - - -/** - * IStructuredModels are mainly interesting by their extensions and - * implementers. The main purposed of this abstraction is to provide a common - * means to manage models that have an associated structured document. - * - * @plannedfor 2.0 - * - * <p> - * ISSUE: this interface needs ton of cleanup! - * </p> - * - * <p> - * This interface is not intended to be implemented by clients. - * </p> - */ -public interface IStructuredModel extends IAdaptable { - - - /** - * This API allows clients to declare that they are about to make a - * "large" change to the model. This change might be in terms of content - * or it might be in terms of the model id or base location. - * - * Note that in the case of embedded calls, notification to listeners is - * sent only once. - * - * Note that the client who is making these changes has the responsibility - * to restore the model's state once finished with the changes. See - * getMemento and restoreState. - * - * The method isModelStateChanging can be used by a client to determine if - * the model is already in a change sequence. - * - * This method is a matched pair to changedModel, and must be called - * before changedModel. A client should never call changedModel without - * calling aboutToChangeModel first nor call aboutToChangeModel without - * calling changedModel later from the same Thread. - */ - void aboutToChangeModel(); - - void addModelLifecycleListener(IModelLifecycleListener listener); - - void addModelStateListener(IModelStateListener listener); - - /** - * Begin recording undo transactions. - */ - void beginRecording(Object requester); - - /** - * Begin recording undo transactions. - */ - void beginRecording(Object requester, int cursorPosition, int selectionLength); - - /** - * Begin recording undo transactions. - */ - void beginRecording(Object requester, String label); - - /** - * Begin recording undo transactions. - */ - void beginRecording(Object requester, String label, int cursorPosition, int selectionLength); - - /** - * Begin recording undo transactions. - */ - void beginRecording(Object requester, String label, String description); - - /** - * Begin recording undo transactions. - */ - void beginRecording(Object requester, String label, String description, int cursorPosition, int selectionLength); - - /** - * This API allows a client controlled way of notifying all ModelEvent - * listeners that the model has been changed. This method is a matched - * pair to aboutToChangeModel, and must be called after aboutToChangeModel - * ... or some listeners could be left waiting indefinitely for the - * changed event. So, its suggested that changedModel always be in a - * finally clause. Likewise, a client should never call changedModel - * without calling aboutToChangeModel first. - * - * In the case of embedded calls, the notification is just sent once. - * - */ - void changedModel(); - - long computeModificationStamp(IResource resource); - - /** - * @deprecated - */ - IStructuredModel copy(String id) throws ResourceInUse, ResourceAlreadyExists; - - /** - * Disable undo management. - */ - void disableUndoManagement(); - - /** - * Enable undo management. - */ - void enableUndoManagement(); - - /** - * End recording undo transactions. - */ - void endRecording(Object requester); - - /** - * End recording undo transactions. - */ - void endRecording(Object requester, int cursorPosition, int selectionLength); - - /** - * This is a client-defined value for what that client (and/or loader) - * considers the "base" of the structured model. Frequently the location - * is either a workspace root-relative path of a workspace resource or an - * absolute path in the local file system. - */ - String getBaseLocation(); - - /** - * @return The associated content type identifier (String) for this model. - */ - String getContentTypeIdentifier(); - - /** - * - * @return The model's FactoryRegistry. A model is not valid without one. - */ - FactoryRegistry getFactoryRegistry(); - - /** - * The id is the id that the model manager uses to identify this model - */ - String getId(); - - /** - * @param offset - * a text offset within the structured document - * @return an IndexedRegion containing this offset or null if one could - * not be found - */ - IndexedRegion getIndexedRegion(int offset); - - IModelHandler getModelHandler(); - - IModelManager getModelManager(); - - /** - * @param id - * Object The id of the model TODO: try to refine the design - * not to use this function - * - * @return the reference count of underlying model - */ - int getReferenceCount(); - - /** - * This function returns the edit-responsible reference count of - * underlying model. - * - * @param id - * Object The id of the model TODO: try to refine the design - * not to use this function - */ - int getReferenceCountForEdit(); - - /** - * This function returns the reader reference count of underlying model. - * - * @param id - * Object The id of the model TODO: try to refine the design - * not to use this function - */ - int getReferenceCountForRead(); - - Object getReinitializeStateData(); - - /** - * Get URI resolution helper - * - * @deprecated - */ - URIResolver getResolver(); - - IStructuredDocument getStructuredDocument(); - - /** - * modification date of underlying resource, when this model was open, or - * last saved. (Note: for this version, the client must manage the - * accuracy of this data) - */ - long getSynchronizationStamp(); - - /** - * Get undo manager. - */ - IStructuredTextUndoManager getUndoManager(); - - /** - * - */ - boolean isDirty(); - - /** - * This method can be called to determine if the model is within a - * "aboutToChange" and "changed" sequence. - */ - public boolean isModelStateChanging(); - - /** - * - */ - boolean isNew(); - - boolean isReinitializationNeeded(); - - /** - * This is a combination of if the model is dirty and if the model is - * shared for write access. The last writer as the responsibility to be - * sure the user is prompted to save. - */ - public boolean isSaveNeeded(); - - /** - * This function returns true if either isSharedForRead or isSharedForEdit - * is true. - */ - boolean isShared(); - - /** - * This function returns true if there are other references to the - * underlying model. - */ - boolean isSharedForEdit(); - - /** - * This function returns true if there are other references to the - * underlying model. - */ - boolean isSharedForRead(); - - /** - * newInstance is similar to clone, except that the newInstance contains - * no content. Its purpose is so clients can get a temporary, unmanaged, - * model of the same "type" as the original. Note: the client may still - * need to do some initialization of the model returned by newInstance, - * depending on desired use. For example, the only factories in the - * newInstance are those that would be normally be created for a model of - * the given contentType. Others are not copied automatically, and if - * desired, should be added by client. - */ - IStructuredModel newInstance() throws IOException; - - /** - * Performs a reinitialization procedure. For this model. Note for future: - * there may be a day where the model returned from this method is a - * different instance than the instance it was called on. This will occur - * when there is full support for "save as" type functions, where the - * model could theoretically change completely. - */ - IStructuredModel reinit() throws IOException; - - /** - * This function allows the model to free up any resources it might be - * using. In particular, itself, as stored in the IModelManager. - * - */ - void releaseFromEdit(); - - /** - * This function allows the model to free up any resources it might be - * using. In particular, itself, as stored in the IModelManager. - * - */ - void releaseFromRead(); - - /** - * This function replenishes the model with the resource without saving - * any possible changes. It is used when one editor may be closing, and - * specifically says not to save the model, but another "display" of the - * model still needs to hang on to some model, so needs a fresh copy. - * - * Only valid for use with managed models. - */ - IStructuredModel reload(InputStream inputStream) throws IOException; - - void removeModelLifecycleListener(IModelLifecycleListener listener); - - void removeModelStateListener(IModelStateListener listener); - - /** - * A method that modifies the model's synchronization stamp to match the - * resource. Turns out there's several ways of doing it, so this ensures a - * common algorithm. - */ - void resetSynchronizationStamp(IResource resource); - - void resourceDeleted(); - - void resourceMoved(IStructuredModel newModel); - - void save() throws UnsupportedEncodingException, IOException, CoreException; - - void save(EncodingRule encodingRule) throws UnsupportedEncodingException, IOException, CoreException; - - void save(IFile iFile) throws UnsupportedEncodingException, IOException, CoreException; - - void save(IFile iFile, EncodingRule encodingRule) throws UnsupportedEncodingException, IOException, CoreException; - - void save(OutputStream outputStream) throws UnsupportedEncodingException, IOException, CoreException; - - void setBaseLocation(String newBaseLocation); - - public void setDirtyState(boolean dirtyState); - - void setFactoryRegistry(FactoryRegistry registry); - - /** - * The id is the id that the model manager uses to identify this model - */ - void setId(String id) throws ResourceInUse; - - void setModelHandler(IModelHandler modelHandler); - - void setModelManager(IModelManager modelManager); - - public void setNewState(boolean newState); - - /** - * Sets a "flag" that reinitialization is needed. - */ - void setReinitializeNeeded(boolean b); - - /** - * Holds any data that the reinitialization procedure might find useful in - * reinitializing the model. This is handy, since the reinitialization may - * not take place at once, and some "old" data may be needed to properly - * undo previous settings. Note: the parameter was intentionally made to - * be of type 'Object' so different models can use in different ways. - */ - void setReinitializeStateData(Object object); - - /** - * Set the URI resolution helper - */ - void setResolver(URIResolver uriResolver); - - void setStructuredDocument(IStructuredDocument structuredDocument); - - /** - * Set undo manager. - */ - void setUndoManager(IStructuredTextUndoManager undoManager); -} diff --git a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/IndexedRegion.java b/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/IndexedRegion.java deleted file mode 100644 index 7bf5dcaf69..0000000000 --- a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/IndexedRegion.java +++ /dev/null @@ -1,74 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2004 IBM Corporation and others. - * 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: - * IBM Corporation - initial API and implementation - * Jens Lukowski/Innoopract - initial renaming/restructuring - * - *******************************************************************************/ -package org.eclipse.wst.sse.core.internal.provisional; - - - -/** - * This type is used to indicate positions and lengths in source. Notice that - * while getEndOffset and getLength are redundant, given that - * - * <pre> - * <code> - * getEndOffset() == getStartOffset() + getLength(); - * </code> - * </pre> - * - * we provide (require) both since in some cases implementors may be able to - * provide one or the other more efficiently. - * - * Note: it is not part of the API contract that implementors of IndexedRegion -- - * as a whole collection for a particular source -- must completely cover the - * original source. They currently often do, so thought I'd mention explicitly - * this may not always be true. - * - * @plannedfor 1.0 - */ -public interface IndexedRegion { - - /** - * Can be used to test if the indexed regions contains the test position. - * - * @param testPosition - * @return true if test position is greater than or equal to start offset - * and less than start offset plus length. - */ - boolean contains(int testPosition); - - /** - * Can be used to get end offset of source text, relative to beginning of - * documnt. Implementers should return -1 if, or some reason, the region - * is not valid. - * - * @return endoffset - */ - int getEndOffset(); - - /** - * Can be used to get source postion of beginning of indexed region. - * Implementers should return -1 if, or some reason, the region is not - * valid. - * - * @return int position of start of index region. - */ - int getStartOffset(); - - /** - * Can be used to get the length of the source text. Implementers should - * return -1 if, or some reason, the region is not valid. - * - * @return int position of length of index region. - */ - int getLength(); - -} diff --git a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/StructuredModelManager.java b/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/StructuredModelManager.java deleted file mode 100644 index 0016fdb146..0000000000 --- a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/StructuredModelManager.java +++ /dev/null @@ -1,75 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * 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: - * IBM Corporation - initial API and implementation - * - *******************************************************************************/ -package org.eclipse.wst.sse.core.internal.provisional; - -import org.eclipse.core.runtime.Platform; -import org.eclipse.wst.sse.core.internal.SSECorePlugin; -import org.eclipse.wst.sse.core.internal.model.ModelManagerImpl; -import org.osgi.framework.Bundle; - -/** - * Class to allow access to ModelManager. Not intended to be subclassed. - * - * @plannedfor 1.0 - * @deprecated - use the one that is in - * org.eclipse.wst.sse.core.SttructuredModelManager - */ -final public class StructuredModelManager { - /** - * Do not allow instances to be created. - */ - private StructuredModelManager() { - super(); - } - - /** - * Provides access to the instance of IModelManager. Returns null if model - * manager can not be created or is not valid (such as, when workbench is - * shutting down). - * - * @return IModelManager - returns the one model manager for structured - * model - * @deprecated - use the one that is in - * org.eclipse.wst.sse.core.SttructuredModelManager - */ - public static IModelManager getModelManager() { - boolean isReady = false; - IModelManager modelManager = null; - while (!isReady) { - Bundle localBundle = Platform.getBundle(SSECorePlugin.ID); - int state = localBundle.getState(); - if (state == Bundle.ACTIVE) { - isReady = true; - // getInstance is a synchronized static method. - modelManager = ModelManagerImpl.getInstance(); - } - else if (state == Bundle.STARTING) { - try { - Thread.sleep(100); - } - catch (InterruptedException e) { - // ignore, just loop again - } - } - else if (state == Bundle.STOPPING || state == Bundle.UNINSTALLED) { - isReady = true; - modelManager = null; - } - else { - // not sure about other states, 'resolved', 'installed' - isReady = true; - modelManager = null; - } - } - return modelManager; - } -} diff --git a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/document/IEncodedDocument.java b/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/document/IEncodedDocument.java deleted file mode 100644 index 48194aee50..0000000000 --- a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/document/IEncodedDocument.java +++ /dev/null @@ -1,58 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2004 IBM Corporation and others. - * 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: - * IBM Corporation - initial API and implementation - * Jens Lukowski/Innoopract - initial renaming/restructuring - * - *******************************************************************************/ -package org.eclipse.wst.sse.core.internal.provisional.document; - -import org.eclipse.jface.text.IDocument; -import org.eclipse.wst.sse.core.internal.encoding.EncodingMemento; - -/** - * This interface is strictly to define important "document properties" not - * found in IDocument, but not central to "StructuredDocument". - * - * Its not to be be implmented by clients. - * - * @plannedfor 1.0 - */ - -public interface IEncodedDocument extends IDocument { - - /** - * Returns the encoding memento for this document. - * - * @return the encoding memento for this document. - */ - EncodingMemento getEncodingMemento(); - - /** - * Returns the preferred line delimiter for this document. - */ - String getPreferredLineDelimiter(); - - /** - * Sets the encoding memento for this document. - * - * Is not to be called by clients, only document creation classes. - * - * @param localEncodingMemento - */ - void setEncodingMemento(EncodingMemento localEncodingMemento); - - /** - * Sets the preferredLineDelimiter. Is not to be called by clients, only - * document creation classes. - * - * @param probableLineDelimiter - */ - void setPreferredLineDelimiter(String probableLineDelimiter); - -} diff --git a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/document/IStructuredDocumentProposed.java b/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/document/IStructuredDocumentProposed.java deleted file mode 100644 index 4d7dd6ff94..0000000000 --- a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/document/IStructuredDocumentProposed.java +++ /dev/null @@ -1,223 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2004 IBM Corporation and others. - * 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: - * IBM Corporation - initial API and implementation - * Jens Lukowski/Innoopract - initial renaming/restructuring - * - *******************************************************************************/ -package org.eclipse.wst.sse.core.internal.provisional.document; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.jface.text.IDocument; -import org.eclipse.jface.text.IDocumentExtension; -import org.eclipse.jface.text.IDocumentListener; -import org.eclipse.jface.text.Position; -import org.eclipse.wst.sse.core.internal.encoding.EncodingMemento; -import org.eclipse.wst.sse.core.internal.provisional.events.NewDocumentEvent; -import org.eclipse.wst.sse.core.internal.provisional.events.StructuredDocumentEvent; -import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion; -import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegionList; - - -/** - * A IStructuredDocument is a collection of StructuredDocumentRegions. It's - * often called a "flat model" because its does contain some structural - * information, but not very much, usually, at most, a few levels of - * containment. - * - * Clients should not implement. - * - * @plannedfor 1.0 - */ -public interface IStructuredDocumentProposed extends IDocument, IDocumentExtension, IAdaptable { - - /** - * The document changing listeners receives the same events as the - * document listeners, but the difference is the timing and - * synchronization of data changes and notifications. - */ - void addDocumentChangingListener(IDocumentListener listener); - - /** - * this API ensures that any portion of the document within startOff to - * length is not readonly (that is, that its editable). Note that if the - * range overlaps with other readonly regions, those other readonly - * regions will be adjusted. - * - * @param startOffset - * @param length - */ - void clearReadOnly(int startOffset, int length); - - /** - * returns true if any portion of startOffset to length is readonly - * - * @param startOffset - * @param length - * @return - */ - boolean containsReadOnly(int startOffset, int length); - - /** - * Returns the region contained by offset. - * - * @param offset - * @return - */ - IStructuredDocumentRegion getRegionAtCharacterOffset(int offset); - - /** - * Resturns a list of the structured document regions. - * - * Note: possibly expensive call, not to be used casually. - * - * @return a list of the structured document regions. - */ - IStructuredDocumentRegionList getRegionList(); - - - /** - * Returns the text of this document. - * - * Same as 'get' in super class, added for descriptiveness. - * - * @return the text of this document. - */ - String getText(); - - /** - * causes that portion of the document from startOffset to length to be - * marked as readonly. Note that if this range overlaps with some other - * region with is readonly, the regions are effectivly combined. - * - * @param startOffset - * @param length - */ - void makeReadOnly(int startOffset, int length); - - /** - * newInstance is similar to clone, except it contains no data. One - * important thing to duplicate is the parser, with the parser correctly - * "cloned", including its tokeninzer, block tags, etc. - * - * NOTE: even after obtaining a 'newInstance' the client may have to do - * some initialization, for example, it may need to add its own model - * listeners. Or, as another example, if the IStructuredDocument has a - * parser of type StructuredDocumentRegionParser, then the client may need - * to add its own StructuredDocumentRegionHandler to that parser, if it is - * in fact needed. - */ - IStructuredDocumentProposed newInstance(); - - /** - * The document changing listeners receives the same events as the - * document listeners, but the difference is the timing and - * synchronization of data changes and notifications. - */ - void removeDocumentChangingListener(IDocumentListener listener); - - /** - * One of the APIs to manipulate the IStructuredDocument. - * - * replaceText replaces the text from oldStart to oldEnd with the new text - * found in the requestedChange string. If oldStart and oldEnd are equal, - * it is an insertion request. If requestedChange is null (or empty) it is - * a delete request. Otherwise it is a replace request. - * - * Similar to 'replace' in super class. - */ - StructuredDocumentEvent replaceText(Object requester, int oldStart, int replacementLength, String requestedChange); - - /** - * Note, same as replaceText API, but will allow readonly areas to be - * replaced. This method is not to be called by clients, only - * infrastructure. For example, one case where its ok is with undo - * operations (since, presumably, if user just did something that - * happended to involve some inserting readonly text, they should normally - * be allowed to still undo that operation. There might be other cases - * where its used to give the user a choice, e.g. "you are about to - * overwrite read only portions, do you want to continue". - */ - StructuredDocumentEvent overrideReadOnlyreplaceText(Object requester, int oldStart, int replacementLength, String requestedChange); - - /** - * One of the APIs to manipulate the IStructuredDocument in terms of Text. - * - * The setText method replaces all text in the model. - * - * @param requester - - * the object requesting the document be created. - * @param allText - - * all the text of the document. - * @return NewDocumentEvent - besides causing this event to be sent to - * document listeners, the event is returned. - */ - NewDocumentEvent setText(Object requester, String allText); - - /** - * Returns the encoding memento for this document. - * - * @return the encoding memento for this document. - */ - EncodingMemento getEncodingMemento(); - - /** - * Returns the line delimiter detected when this document was read from - * storage. - * - * @return line delimiter detected when this document was read from - * storage. - */ - String getDetectedLineDelimiter(); - - /** - * Sets the encoding memento for this document. - * - * Is not to be called by clients, only document creation classes. - * - * @param localEncodingMemento - */ - void setEncodingMemento(EncodingMemento localEncodingMemento); - - /** - * Sets the detected line delimiter when the document was read. Is not to - * be called by clients, only document creation classes. - * - * @param probableLineDelimiter - */ - void setDetectedLineDelimiter(String probableLineDelimiter); - - /** - * This function provides a way for clients to compare a string with a - * region of the documnet, without having to retrieve (create) a string - * from the document, thus more efficient of lots of comparisons being - * done. - * - * @param ignoreCase - - * if true the characters are compared based on identity. If - * false, the string are compared with case accounted for. - * @param testString - - * the string to compare. - * @param documentOffset - - * the document in the offset to start the comparison. - * @param length - - * the length in the document to compare (Note: technically, - * clients could just provide the string, and we could infer - * the length from the string supplied, but this leaves every - * client to correctly not even ask us if the the string length - * doesn't match the expected length, so this is an effort to - * maximize performance with correct code. - * @return true if matches, false otherwise. - */ - boolean stringMatches(boolean ignoreCase, String testString, int documentOffset, int length); - - Position createPosition(int offset, String category, String type); - - Position createPosition(int offset, int length, String category, String type); - -} diff --git a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/events/AboutToBeChangedEvent.java b/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/events/AboutToBeChangedEvent.java deleted file mode 100644 index 583e75d4d1..0000000000 --- a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/events/AboutToBeChangedEvent.java +++ /dev/null @@ -1,44 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2004 IBM Corporation and others. - * 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: - * IBM Corporation - initial API and implementation - * Jens Lukowski/Innoopract - initial renaming/restructuring - * - *******************************************************************************/ -package org.eclipse.wst.sse.core.internal.provisional.events; - -import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument; - -/** - * This event is send to structured document listeners. It is perfectly - * analagous to its corresponding jface DocumentEvent and is provided simply - * to allow clients to distinguish the source of the event. - * - * @plannedfor 1.0 - */ -public class AboutToBeChangedEvent extends StructuredDocumentEvent { - - - /** - * Creates an instance of this event. - * - * @param document - * document involved in the change - * @param originalRequester - * source of original request - * @param changes - * the text changes - * @param offset - * offset of request - * @param lengthToReplace - * amount, if any, of replaced text - */ - public AboutToBeChangedEvent(IStructuredDocument document, Object originalRequester, String changes, int offset, int lengthToReplace) { - super(document, originalRequester, changes, offset, lengthToReplace); - } -} diff --git a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/events/IModelAboutToBeChangedListener.java b/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/events/IModelAboutToBeChangedListener.java deleted file mode 100644 index 2af8184537..0000000000 --- a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/events/IModelAboutToBeChangedListener.java +++ /dev/null @@ -1,26 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2004 IBM Corporation and others. - * 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: - * IBM Corporation - initial API and implementation - * Jens Lukowski/Innoopract - initial renaming/restructuring - * - *******************************************************************************/ -package org.eclipse.wst.sse.core.internal.provisional.events; - - - -/** - * Clients can implement this interface, and register with the - * structuredDocument using addAboutToBeChangedListner to be notified that the - * structuredDocument is about to be changed, but hasn't been changed at the - * time this event is fired. - */ -public interface IModelAboutToBeChangedListener { - - void modelAboutToBeChanged(AboutToBeChangedEvent structuredDocumentEvent); -} diff --git a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/events/IStructuredDocumentListener.java b/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/events/IStructuredDocumentListener.java deleted file mode 100644 index 8262a01744..0000000000 --- a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/events/IStructuredDocumentListener.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2004 IBM Corporation and others. - * 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: - * IBM Corporation - initial API and implementation - * Jens Lukowski/Innoopract - initial renaming/restructuring - * - *******************************************************************************/ -package org.eclipse.wst.sse.core.internal.provisional.events; - -/** - * @deprecated will be removed since we now subclass DocumentEvent. - */ - -public interface IStructuredDocumentListener { - - public void newModel(NewDocumentEvent structuredDocumentEvent); - - public void noChange(NoChangeEvent structuredDocumentEvent); - - public void nodesReplaced(StructuredDocumentRegionsReplacedEvent structuredDocumentEvent); - - public void regionChanged(RegionChangedEvent structuredDocumentEvent); - - public void regionsReplaced(RegionsReplacedEvent structuredDocumentEvent); -} diff --git a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/events/NewDocumentContentEvent.java b/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/events/NewDocumentContentEvent.java deleted file mode 100644 index 7dbd179648..0000000000 --- a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/events/NewDocumentContentEvent.java +++ /dev/null @@ -1,40 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2004 IBM Corporation and others. - * 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: - * IBM Corporation - initial API and implementation - * Jens Lukowski/Innoopract - initial renaming/restructuring - * - *******************************************************************************/ -package org.eclipse.wst.sse.core.internal.provisional.events; - -import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument; - -/** - * The NewDocumentContentEvent is fired when an instance of a - * IStructuredDocument replaces all of its text. - * - * ISSUE: not currently used, but there's still some efficiencies to be had so - * plan to implement. - * - * @plannedfor 1.0 - */ -public class NewDocumentContentEvent extends NewDocumentEvent { - /** - * Creates an instance of this event. - * - * @param document - * the document being changed - * @param originalRequester - * the original requester of the change - */ - public NewDocumentContentEvent(IStructuredDocument document, Object originalRequester) { - super(document, originalRequester); - } - - -} diff --git a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/events/NewDocumentEvent.java b/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/events/NewDocumentEvent.java deleted file mode 100644 index bf78ce45f7..0000000000 --- a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/events/NewDocumentEvent.java +++ /dev/null @@ -1,68 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2004 IBM Corporation and others. - * 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: - * IBM Corporation - initial API and implementation - * Jens Lukowski/Innoopract - initial renaming/restructuring - * - *******************************************************************************/ -package org.eclipse.wst.sse.core.internal.provisional.events; - -import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument; - -/** - * The NewDocumentEvent is fired when an instance of a IStructuredDocument - * sets or replaces all of its text. - * - * ISSUE: need to change so this is used for 'set' only. - * - * @plannedfor 1.0 - */ -public class NewDocumentEvent extends StructuredDocumentEvent { - - - /** - * Creates a new instance of the NewDocumentEvent. - * - * @param document - * being changed - * @param originalRequester - * source of request - */ - public NewDocumentEvent(IStructuredDocument document, Object originalRequester) { - super(document, originalRequester); - } - - /** - * This returns the length of the new document. - * - * @return int returns the length of the new document. - */ - public int getLength() { - return getStructuredDocument().getLength(); - } - - /** - * This doesn't mean quite the same thing as the IStructuredDocument - * Events in the super class. It always will return zero. - * - * @return int for a newDocument, the offset of is always 0 - */ - public int getOffset() { - return 0; - } - - /** - * For a new document, the text involved is the complete text. - * - * @return String the text that is the complete text of the documnet. - */ - public String getText() { - String results = getStructuredDocument().getText(); - return results; - } -} diff --git a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/events/NoChangeEvent.java b/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/events/NoChangeEvent.java deleted file mode 100644 index 3f5e788b0f..0000000000 --- a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/events/NoChangeEvent.java +++ /dev/null @@ -1,73 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2004 IBM Corporation and others. - * 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: - * IBM Corporation - initial API and implementation - * Jens Lukowski/Innoopract - initial renaming/restructuring - * - *******************************************************************************/ -package org.eclipse.wst.sse.core.internal.provisional.events; - -import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument; - -/** - * This event is sent if, after analysis, it is found there is no reason to - * change the structuredDocument. This might occur, for example, if someone - * pastes in the exact same text that they are replacing, or if someone tries - * to change a read-only region. - * - * This might be important, for example, if some state variables are set on an - * "about the change" event. then if there is no change (i.e.no other event is - * fired), those state variables could reset, or whatever, upon receiving this - * event. - * - * @plannedfor 1.0 - */ -public class NoChangeEvent extends StructuredDocumentEvent { - /** - * NO_CONTENT_CHANGE means that a some text was requested to be replaced - * with identical text, so no change is actually done. - */ - public final static int NO_CONTENT_CHANGE = 2; - /** - * NO_EVENT is used in rare error conditions, when, basically, a request - * to change the document is made before the previous request has - * completed. This event to used so aboutToChange/Changed cycles can - * complete as required, but the document is most likely not modified as - * expected. - */ - public final static int NO_EVENT = 8; - /** - * READ_ONLY_STATE_CHANGE means that the "read only" state of the text was - * changed, not the content itself. - */ - public final static int READ_ONLY_STATE_CHANGE = 4; - - /** - * set to one of the above detailed reasons for why no change was done. - */ - public int reason = 0; - - /** - * NoChangeEvent constructor. This event can occur if there was a request - * to modify a document or its properties, but there as not really is no - * change to a document's content. - * - * @param source - * @param originalSource - * java.lang.Object - * @param changes - * java.lang.String - * @param offset - * int - * @param lengthToReplace - * int - */ - public NoChangeEvent(IStructuredDocument source, Object originalSource, String changes, int offset, int lengthToReplace) { - super(source, originalSource, changes, offset, lengthToReplace); - } -} diff --git a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/events/RegionChangedEvent.java b/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/events/RegionChangedEvent.java deleted file mode 100644 index 95c935d981..0000000000 --- a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/events/RegionChangedEvent.java +++ /dev/null @@ -1,80 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2004 IBM Corporation and others. - * 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: - * IBM Corporation - initial API and implementation - * Jens Lukowski/Innoopract - initial renaming/restructuring - * - *******************************************************************************/ -package org.eclipse.wst.sse.core.internal.provisional.events; - -import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument; -import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion; -import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion; - -/** - * This event is used when a document region changes in a non-structural way. - * Non-structural, that is, as far as the IStructuredDocument is concerned. - * The whole region, along with the new text is sent, just in case a listener - * (e.g. a tree model) might make its own determination of what to do, and - * needs the whole region to act appropriately. - * - * Note: users should not make assumptions about whether the region is - * literally the same instance or not -- it is currently a different instance - * that is identical to the old except for the changed region, but this - * implementation may change. - * - * @plannedfor 1.0 - */ -public class RegionChangedEvent extends StructuredDocumentEvent { - private ITextRegion fChangedRegion; - private IStructuredDocumentRegion fStructuredDocumentRegion; - - /** - * Creates instance of a RegionChangedEvent. - * - * @param document - * the document being changed. - * @param originalRequester - * the object making the request for the change. - * @param structuredDocumentRegion - * the containing region - * @param changedRegion - * the region that has changed. - * @param changes - * the string representing the change. - * @param offset - * the offset of the change. - * @param lengthToReplace - * the length specified to be replaced. - */ - public RegionChangedEvent(IStructuredDocument document, Object originalRequester, IStructuredDocumentRegion structuredDocumentRegion, ITextRegion changedRegion, String changes, int offset, int lengthToReplace) { - super(document, originalRequester, changes, offset, lengthToReplace); - fStructuredDocumentRegion = structuredDocumentRegion; - fChangedRegion = changedRegion; - } - - - /** - * Returns the text region changed. - * - * @return the text region changed - */ - public ITextRegion getRegion() { - return fChangedRegion; - } - - - /** - * Returns the document region changed. - * - * @return the document region changed - */ - public IStructuredDocumentRegion getStructuredDocumentRegion() { - return fStructuredDocumentRegion; - } -} diff --git a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/events/RegionsReplacedEvent.java b/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/events/RegionsReplacedEvent.java deleted file mode 100644 index 21a2e4f76a..0000000000 --- a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/events/RegionsReplacedEvent.java +++ /dev/null @@ -1,85 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation and others. - * 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: - * IBM Corporation - initial API and implementation - * Jens Lukowski/Innoopract - initial renaming/restructuring - * - *******************************************************************************/ -package org.eclipse.wst.sse.core.internal.provisional.events; - -import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument; -import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion; -import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegionList; - -/** - * This event is used when a node's regions change, but the document region - * itself doesn't. This says nothing about the semantics of the document - * region, that may still have changed. Also, its assumed/required that all - * the regions are replaced (even those that may not have changed). - * - * @plannedfor 1.0 - */ -public class RegionsReplacedEvent extends StructuredDocumentEvent { - private ITextRegionList fNewRegions; - private ITextRegionList fOldRegions; - private IStructuredDocumentRegion fStructuredDocumentRegion; - - /** - * Creates an instance of the RegionsReplacedEvent. - * - * @param document - - * document being changed. - * @param originalRequester - - * requester of the change. - * @param structuredDocumentRegion - - * the region containing the change. - * @param oldRegions - - * the old Regions being replaced. - * @param newRegions - - * the new regions being added. - * @param changes - - * the String representing the change. - * @param offset - - * the offset of the change. - * @param lengthToReplace - - * the length of text to replace. - */ - public RegionsReplacedEvent(IStructuredDocument document, Object originalRequester, IStructuredDocumentRegion structuredDocumentRegion, ITextRegionList oldRegions, ITextRegionList newRegions, String changes, int offset, int lengthToReplace) { - super(document, originalRequester, changes, offset, lengthToReplace); - fStructuredDocumentRegion = structuredDocumentRegion; - fOldRegions = oldRegions; - fNewRegions = newRegions; - } - - /** - * Returns the new text regions. - * - * @return the new text regions. - */ - public ITextRegionList getNewRegions() { - return fNewRegions; - } - - /** - * Returns the old text regions. - * - * @return the old text regions. - */ - public ITextRegionList getOldRegions() { - return fOldRegions; - } - - /** - * Returns the structured document region. - * - * @return the structured document region. - */ - public IStructuredDocumentRegion getStructuredDocumentRegion() { - return fStructuredDocumentRegion; - } -} diff --git a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/events/StructuredDocumentEvent.java b/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/events/StructuredDocumentEvent.java deleted file mode 100644 index 6fa48cd0c2..0000000000 --- a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/events/StructuredDocumentEvent.java +++ /dev/null @@ -1,146 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2004 IBM Corporation and others. - * 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: - * IBM Corporation - initial API and implementation - * Jens Lukowski/Innoopract - initial renaming/restructuring - * - *******************************************************************************/ -package org.eclipse.wst.sse.core.internal.provisional.events; - -import org.eclipse.jface.text.DocumentEvent; -import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument; - - -/** - * IStructuredDocument events are generated by the IStructuredDocument, after - * the IStructuredDocument acts on a request. Not intended to be instantiated, - * except by subclasses in infrastructure. Not intended to be subclassed by - * clients. - * - * @plannedfor 1.0 - */ -public abstract class StructuredDocumentEvent extends DocumentEvent { - private String fDeletedText; - private Object fOriginalRequester; - - /** - * There is no public null-arg version of this constructor. - */ - private StructuredDocumentEvent() { - super(); - } - - /** - * We assume (and require) that an IStructuredDocument's are always the - * source of StructuredDocument events. - * - * @param document - - * the document being changed - */ - private StructuredDocumentEvent(IStructuredDocument document) { - super(); - if (document == null) - throw new IllegalArgumentException("null source"); //$NON-NLS-1$ - fDocument = document; - fOriginalRequester = document; - } - - /** - * We assume (and require) that an IStructuredDocument's are always the - * source of StructuredDocument events. - * - * @param document - - * the document being changed. - * @param originalRequester - - * the original requester of the change. - */ - StructuredDocumentEvent(IStructuredDocument document, Object originalRequester) { - this(document); - fOriginalRequester = originalRequester; - } - - /** - * We assume (and require) that an IStructuredDocument's are always the - * source of StructuredDocument events. - * - * @param document - - * the document being changed. - * @param originalRequester - - * the requester of the change. - * @param changes - - * the String representing the new text - * @param offset - - * the offset of the change. - * @param lengthToReplace - - * the length of text to replace. - */ - StructuredDocumentEvent(IStructuredDocument document, Object originalRequester, String changes, int offset, int lengthToReplace) { - this(document); - fOriginalRequester = originalRequester; - fText = changes; - fOffset = offset; - fLength = lengthToReplace; - } - - /** - * Provides the text that is being deleted. - * - * @return the text that is being deleted, or null if none is being - * deleted. - */ - public String getDeletedText() { - return fDeletedText; - } - - /** - * This method returns the object that originally caused the event to - * fire. This is typically not the object that created the event (the - * IStructuredDocument) but instead the object that made a request to the - * IStructuredDocument. - * - * @return the object that made the request to the document - */ - public Object getOriginalRequester() { - return fOriginalRequester; - } - - /** - * This method is equivalent to 'getDocument' except it returns an object - * of the appropriate type (namely, a IStructuredDocument, instead of - * IDocument). - * - * @return IStructuredDocumnt - the document being changed - */ - public IStructuredDocument getStructuredDocument() { - // a safe case, since constructor can only be called with a - // IStructuredDocument - return (IStructuredDocument) fDocument; - } - - /** - * Not to be called by clients, only parsers and reparsers. (will - * eventually be moved to an SPI package). - * - * @param newDeletedText - - * the text that has been deleted. - */ - public void setDeletedText(String newDeletedText) { - fDeletedText = newDeletedText; - } - - /** - * for debugging only - * - * @deprecated - need to fix unit tests which depend on this exact format, - * then delete this - */ - public String toString() { - // return getClass().getName() + "[source=" + source + "]"; - return getClass().getName(); - } -} diff --git a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/events/StructuredDocumentRegionsReplacedEvent.java b/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/events/StructuredDocumentRegionsReplacedEvent.java deleted file mode 100644 index 149e4d622c..0000000000 --- a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/events/StructuredDocumentRegionsReplacedEvent.java +++ /dev/null @@ -1,73 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2004 IBM Corporation and others. - * 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: - * IBM Corporation - initial API and implementation - * Jens Lukowski/Innoopract - initial renaming/restructuring - * - *******************************************************************************/ -package org.eclipse.wst.sse.core.internal.provisional.events; - - - -import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument; -import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegionList; - -/** - * This event is used when a IStructuredDocumentRegion is deleted, or replaced - * with more than one IStructuredDocumentRegion, or when simply more than one - * IStructuredDocumentRegion changes. - * - * @plannedfor 1.0 - */ -public class StructuredDocumentRegionsReplacedEvent extends StructuredDocumentEvent { - - private IStructuredDocumentRegionList fNewStructuredDocumentRegions; - private IStructuredDocumentRegionList fOldStructuredDocumentRegions; - - /** - * Creates an instance of StructuredDocumentRegionsReplacedEvent - * - * @param document - - * the document being changed. - * @param originalRequester - - * the requester of the change. - * @param oldStructuredDocumentRegions - - * the old document regions removed. - * @param newStructuredDocumentRegions - - * the new document regions added. - * @param changes - - * a string representing the text change. - * @param offset - - * the offset of the change. - * @param lengthToReplace - - * the length of text requested to be replaced. - */ - public StructuredDocumentRegionsReplacedEvent(IStructuredDocument document, Object originalRequester, IStructuredDocumentRegionList oldStructuredDocumentRegions, IStructuredDocumentRegionList newStructuredDocumentRegions, String changes, int offset, int lengthToReplace) { - super(document, originalRequester, changes, offset, lengthToReplace); - fOldStructuredDocumentRegions = oldStructuredDocumentRegions; - fNewStructuredDocumentRegions = newStructuredDocumentRegions; - } - - /** - * Returns the new structured document regions. - * - * @return the new structured document regions. - */ - public IStructuredDocumentRegionList getNewStructuredDocumentRegions() { - return fNewStructuredDocumentRegions; - } - - /** - * Returns the old structured document regions. - * - * @return the old structured document regions. - */ - public IStructuredDocumentRegionList getOldStructuredDocumentRegions() { - return fOldStructuredDocumentRegions; - } -} diff --git a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/exceptions/ResourceAlreadyExists.java b/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/exceptions/ResourceAlreadyExists.java deleted file mode 100644 index 69233ccb2e..0000000000 --- a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/exceptions/ResourceAlreadyExists.java +++ /dev/null @@ -1,40 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2004 IBM Corporation and others. - * 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: - * IBM Corporation - initial API and implementation - * Jens Lukowski/Innoopract - initial renaming/restructuring - * - *******************************************************************************/ -package org.eclipse.wst.sse.core.internal.provisional.exceptions; - - - -public class ResourceAlreadyExists extends Exception { - - /** - * Comment for <code>serialVersionUID</code> - */ - private static final long serialVersionUID = 1L; - - /** - * ResourceAlreadyExists constructor comment. - */ - public ResourceAlreadyExists() { - super(); - } - - /** - * ResourceAlreadyExists constructor comment. - * - * @param s - * java.lang.String - */ - public ResourceAlreadyExists(String s) { - super(s); - } -} diff --git a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/exceptions/ResourceInUse.java b/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/exceptions/ResourceInUse.java deleted file mode 100644 index 77dac5189e..0000000000 --- a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/exceptions/ResourceInUse.java +++ /dev/null @@ -1,40 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2004 IBM Corporation and others. - * 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: - * IBM Corporation - initial API and implementation - * Jens Lukowski/Innoopract - initial renaming/restructuring - * - *******************************************************************************/ -package org.eclipse.wst.sse.core.internal.provisional.exceptions; - - - -public class ResourceInUse extends Exception { - - /** - * Comment for <code>serialVersionUID</code> - */ - private static final long serialVersionUID = 1L; - - /** - * ResourceAlreadyExists constructor comment. - */ - public ResourceInUse() { - super(); - } - - /** - * ResourceAlreadyExists constructor comment. - * - * @param s - * java.lang.String - */ - public ResourceInUse(String s) { - super(s); - } -} diff --git a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/model/IModelManagerProposed.java b/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/model/IModelManagerProposed.java deleted file mode 100644 index fb9c6b6b85..0000000000 --- a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/model/IModelManagerProposed.java +++ /dev/null @@ -1,338 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation and others. - * 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: - * IBM Corporation - initial API and implementation - * - *******************************************************************************/ -package org.eclipse.wst.sse.core.internal.provisional.model; - -import java.io.IOException; -import java.io.UnsupportedEncodingException; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.jface.text.IDocument; -import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel; -import org.eclipse.wst.sse.core.internal.provisional.exceptions.ResourceAlreadyExists; -import org.eclipse.wst.sse.core.internal.provisional.exceptions.ResourceInUse; -import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument; - -/** - * Responsible for managing IStructuredModels. - * - * This allows clients to share models, so they do not have to be re-created - * or passed around from one client to another. Clients should internally - * enforce that models are gotten and released from locations close to each - * other to prevent model leaks. - * - * There are three ways to get a model based on usage and responsibility: for - * 'MODIFY', just for 'SHARED', and 'UNSHARED'. Contrary to their names, a - * model can technically be modified, and all modifications directly affect - * the commonly shared version of the model. It is part of the API contract, - * however, that clients who get a model for SHARED do not modify it. The - * significance of the 'MODIFY' model is that the client is registering their - * interest in saving changes to the model. - * - * Clients can reference this interface, but should not implement. - * - * @see org.eclipse.wst.sse.core.StructuredModelManager - * @plannedfor 1.0 - */ -public interface IModelManagerProposed { - - /** - * AccessType is used internally as a JRE 1.4 compatible enumerated type. - * Not intended to be referenced by clients. - */ - static class AccessType { - private String fType; - - /** - * default access contructor we use to create our specific constants. - * - * @param type - */ - AccessType(String type) { - super(); - fType = type; - } - - /** - * For debug purposes only. - */ - public String toString() { - return "Model Access Type: " + fType; //$NON-NLS-1$ - } - } - - /** - * Constant to provide compile time safe parameter. <code>NOTSHARED</code>signifies - * the client intentially wants a model that is not shared with other - * clients. NOTSHARED models can not be saved. - */ - final AccessType NOTSHARED = new AccessType("NOTSHARED"); //$NON-NLS-1$ - - /** - * Constant to provide compile-time safe parameter. <code>SHARED</code>signifies - * the client is not intending to make changes and does not care whether - * the model accessed is saved. - */ - final AccessType SHARED = new AccessType("SHARED"); //$NON-NLS-1$ - - /** - * Constant to provide compile-time safe parameter. <code>MODIFY</code>signifies - * the client is intending to make changes and is responsible for saving - * changes (or not) if they are the last one holding MODIFY access to the - * model before it's released. - */ - final AccessType MODIFY = new AccessType("MODIFY"); //$NON-NLS-1$ - - /** - * copyModel is similar to a deep clone. The resulting model is shared, - * according to the value of ReadEditType. If a model already is being - * managed for 'newLocation' then a ResourceInUse exception is thrown, - * unless the ReadEditType is NOTSHARED, in which case the resulting model - * can not be saved. - * - * @param oldLocation - * @param newLocation - * @param type - * @return - * @throws ResourceInUse - * - * ISSUE: is this important enough to be API, or can clients solve - * themselves - */ - IStructuredModel copyModel(IPath oldLocation, IPath newLocation, AccessType type) throws ResourceInUse; - - /** - * createNewInstance is similar to clone, except the new instance has no - * text content. Note: this produces an UNSHARED model, for temporary use, - * that has the same characteristics as original model. If a true shared - * model is desired, use "copy". - * - * ISSUE: still needed? - * - * @param requester - * @param model - * @return - * @throws IOException - */ - public IStructuredModel createNewInstance(Object requester, IStructuredModel model) throws IOException; - - /** - * Factory method, since a proper IStructuredDocument must have a proper - * parser assigned. Note: its assume that IPath does not actually exist as - * a resource yet. If it does, ResourceAlreadyExists exception is thrown. - * If the resource does already exist, then createStructuredDocumentFor is - * the right API to use. - * - * ISSUE: do we want to support this via model manager, or else where? - * ISSUE: do we need two of these? What's legacy use case? - * - * @param location - * @param progressMonitor - * @return - * @throws ResourceAlreadyExists - * @throws IOException - * @throws CoreException - */ - IStructuredDocument createNewStructuredDocumentFor(IPath location, IProgressMonitor progressMonitor) throws ResourceAlreadyExists, IOException, CoreException; - - /** - * Factory method, since a proper IStructuredDocument must have a proper - * parser assigned. Note: clients should verify that the resource - * identified by the IPath exists before using this method. If this IFile - * does not exist, then createNewStructuredDocument is the correct API to - * use. - * - * ISSUE: do we want to support this via model manager, or else where? - * ISSUE: do we need two of these? What's legacy use case? - * - * @param location - * @param progressMonitor - * @return - * @throws IOException - * @throws CoreException - */ - IStructuredDocument createStructuredDocumentFor(IPath location, IProgressMonitor progressMonitor) throws IOException, CoreException; - - /** - * Note: callers of this method must still release the model when - * finished. Returns the model for this document if it already exists and - * is being shared. Returns null if this is not the case. The ReadEditType - * must be either MODIFY or SHARED. - * - * ISSUE: should we accept IDocument on parameter for future evolution, - * and constrain to StructuredDocuments at runtime? - * - * @param requester - * @param type - * @param document - * @return - */ - IStructuredModel getExistingModel(Object requester, AccessType type, IDocument document); - - /** - * Callers of this method must still release the model when finished. - * Returns the model for this location if it already exists and is being - * shared. Returns null if this is not the case. The ReadEditType must be - * either MODIFY or SHARED. - * - * @param requester - * @param type - * @param location - * @return - */ - public IStructuredModel getExistingModel(Object requester, AccessType type, IPath location); - - /** - * Returns the model that has the specified document as its structured - * document. - * - * @param requester - * @param type - * @param progressMonitor - * @param document - * @return - */ - public IStructuredModel getModel(Object requester, AccessType type, IProgressMonitor progressMonitor, IDocument document); - - /** - * Returns the model based on the content at the specified location. - * - * Note: if the ModelManager does not know how to create a model for - * such a file for content, null is return. - * ISSUE: should we throw some special, meaningful, checked - * exception instead? - * - * @param requester - * @param type - * @param progressMonitor - * @param location - * @return - * @throws IOException - * @throws CoreException - */ - public IStructuredModel getModel(Object requester, AccessType type, IProgressMonitor progressMonitor, IPath location) throws IOException, CoreException; - - /** - * This method will not create a new model if it already exists ... if - * force is false. The idea is that a client should call this method once - * with force set to false. If the exception is thrown, then prompt client - * if they want to overwrite. - * - * @param requester - * @param location - * @param force - * @param type - * @param progressMonitor - * @return - * @throws ResourceAlreadyExists - * @throws ResourceInUse - * @throws IOException - * @throws CoreException - */ - IStructuredModel getNewModel(Object requester, IPath location, boolean force, AccessType type, IProgressMonitor progressMonitor) throws ResourceAlreadyExists, ResourceInUse, IOException, CoreException; - - /** - * This function returns true if there are other references to the - * underlying model. - * - * @param location - * @return - */ - boolean isShared(IPath location); - - /** - * This function returns true if there are other references to the - * underlying model, shared in the specified way. The ReadEditType must be - * either MODIFY or SHARED. - * - * @param location - * @param type - * @return - */ - boolean isShared(IPath location, AccessType type); - - /** - * This method can be called when the content type of a model changes. Its - * assumed the contentType has already been changed, and this method uses - * the text of the old one, to repopulate the text of the new one. - * - * @param model - * @return - * @throws IOException - */ - IStructuredModel reinitialize(IStructuredModel model) throws IOException; - - - /** - * This is used by clients to signify that they are finished with a model - * and will no longer access it or any of its underlying data (such as its - * structured document). The ReadEditType must match what ever the client - * used in the corresponding 'get' method. - * - * This method must be called for every 'get'. Clients should use the - * try/finally pattern to ensure the release is called even if there is an - * unexpected exception. - * - * @param requester - * @param structuredModel - * @param type - */ - void releaseModel(Object requester, IStructuredModel structuredModel, AccessType type); - - /** - * Writes the underlying document to the IPath. - * - * ISSUE: we want to just "dump" contents to location, but need to spec. - * all the different cases of shared, etc. - * - * ?If to same location as 'get', then same instance of model, If to - * different location (esp. if shared) then need to leave old instance of - * model, create new model, and save to new location. ? - * - * Cases: IPath is null, write to IPath created with IPath specificed and - * equals IPath created with, write to IPath IPath specified and not - * equals IPath created with, dumps to new IPath, no change in current - * model state. - * - * ISSUE: think through 'normalization' cases - * - * - * @param structuredModel - * @param location - already normalized? - * @param progressMonitor - * @throws UnsupportedEncodingException - * @throws IOException - * @throws CoreException - * - * ISSUE: resource aleady exists? veto override - */ - void saveModel(IStructuredModel structuredModel, IPath location, IProgressMonitor progressMonitor) throws UnsupportedEncodingException, IOException, CoreException; - - /** - * Writes the underlying document to the IPath if the model is only shared - * for EDIT by one client. This is the recommended way for 'background - * jobs' to save models, in case the model is being shared by an editor, - * or other client that might desire user intervention to save a resource. - * - * @param structuredModel - * @param location - already normalized? - * @param progressMonitor - * @throws UnsupportedEncodingException - * @throws IOException - * @throws CoreException - * - * ISSUE: is locaiton needed in this case, or just use the one it was - * created with - */ - void saveModelIfNotShared(IStructuredModel structuredModel, IPath location, IProgressMonitor progressMonitor) throws UnsupportedEncodingException, IOException, CoreException; -} diff --git a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/model/IModelStateListenerProposed.java b/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/model/IModelStateListenerProposed.java deleted file mode 100644 index e4a4baa523..0000000000 --- a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/model/IModelStateListenerProposed.java +++ /dev/null @@ -1,36 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2004 IBM Corporation and others. - * 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: - * IBM Corporation - initial API and implementation - * Jens Lukowski/Innoopract - initial renaming/restructuring - * - *******************************************************************************/ -package org.eclipse.wst.sse.core.internal.provisional.model; - - -/** - * Interface for those wanting to listen to a model's state changing. - * - * @plannedfor 1.0 - */ -public interface IModelStateListenerProposed { - - /** - * A model is about to be changed. The event object itself signifies which - * model, and any pertinent information. - */ - void modelAboutToBeChanged(IStructuredModelEvent event); - - /** - * Signals that the changes foretold by modelAboutToBeChanged have been - * made. A typical use might be to refresh, or to resume processing that - * was suspended as a result of modelAboutToBeChanged. - */ - void modelChanged(IStructuredModelEvent event); - -} diff --git a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/model/INodeAdapterFactoryManager.java b/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/model/INodeAdapterFactoryManager.java deleted file mode 100644 index 6c2d165167..0000000000 --- a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/model/INodeAdapterFactoryManager.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005 IBM Corporation and others. - * 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: - * IBM Corporation - initial API and implementation - * - *******************************************************************************/ - -package org.eclipse.wst.sse.core.internal.provisional.model; - -import org.eclipse.core.runtime.content.IContentType; -import org.eclipse.wst.sse.core.internal.provisional.INodeAdapterFactory; -/** - * Provides a means for clients to register IAdapterFactories for use - * by infrastructure when StructuredModels are created. - */ -public interface INodeAdapterFactoryManager { - - /** - * - * @param factory - * @param contentType - */ - void addAdapterFactory(INodeAdapterFactory factory, IContentType contentType); - - void removeAdapterFactory(INodeAdapterFactory factory, IContentType contentType); - - -} diff --git a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/model/IStructuredModelEvent.java b/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/model/IStructuredModelEvent.java deleted file mode 100644 index 3c5a16e062..0000000000 --- a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/model/IStructuredModelEvent.java +++ /dev/null @@ -1,17 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 IBM Corporation and others. - * 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: - * IBM Corporation - initial API and implementation - * - *******************************************************************************/ - -package org.eclipse.wst.sse.core.internal.provisional.model; - -public interface IStructuredModelEvent { - -} diff --git a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/model/IStructuredModelProposed.java b/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/model/IStructuredModelProposed.java deleted file mode 100644 index 7d984daed2..0000000000 --- a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/model/IStructuredModelProposed.java +++ /dev/null @@ -1,152 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation and others. - * 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: - * IBM Corporation - initial API and implementation - * - *******************************************************************************/ -package org.eclipse.wst.sse.core.internal.provisional.model; - -import java.io.IOException; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.content.IContentType; -import org.eclipse.wst.sse.core.internal.model.FactoryRegistry; -import org.eclipse.wst.sse.core.internal.provisional.IModelStateListener; -import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion; -import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument; - - -/** - * IStructuredModel's are mainly interesting by their extensions and - * implementers. The main purposed of this abstraction it to provide a common - * way to manage models that have an associated structured documnet. - * - * @plannedfor 1.0 - * - */ -public interface IStructuredModelProposed extends IAdaptable { - - - /** - * This API allows clients to declare that they are about to make a - * "large" change to the model. This change might be in terms of content - * or it might be in terms of the model id or base location. - * - * Note that in the case of embedded calls, notification to listeners is - * sent only once. - * - * Note that the client who is making these changes has the responsibility - * to restore the model's state once finished with the changes. See - * getMemento and restoreState. - * - * The method isModelStateChanging can be used by a client to determine if - * the model is already in a change sequence. - * - * This method is a matched pair to changedModel, and must be called - * before changedModel. A client should never call changedModel without - * calling aboutToChangeModel first nor call aboutToChangeModel without - * calling changedModel later from the same Thread. - */ - void aboutToChangeModel(); - - void addModelStateListener(IModelStateListener listener); - - /** - * This API allows a client controlled way of notifying all ModelEvent - * listners that the model has been changed. This method is a matched pair - * to aboutToChangeModel, and must be called after aboutToChangeModel ... - * or some listeners could be left waiting indefinitely for the changed - * event. So, its suggested that changedModel always be in a finally - * clause. Likewise, a client should never call changedModel without - * calling aboutToChangeModel first. - * - * In the case of embedded calls, the notification is just sent once. - * - */ - void changedModel(); - - /** - * This is a client-defined value for what that client (and/or loader) - * considers the "base" of the structured model. Frequently the location - * is either a workspace root-relative path of a workspace resource or an - * absolute path in the local file system. - */ - IPath getLocation(); - - /** - * @return The associated content type identifier (String) for this model. - */ - IContentType getContentType() throws CoreException; - - /** - * - * @return The model's FactoryRegistry. A model is not valid without one. - */ - FactoryRegistry getFactoryRegistry(); - - /** - * Return the index region at offset. Returns null if there is no - * IndexedRegion that contains offset. - */ - IndexedRegion getIndexedRegion(int offset); - - /** - * ISSUE: do we want to provide this? How to ensure job/thread safety - * - * @return - */ - IndexedRegion[] getIndexedRegions(); - - /** - * Rreturns the IStructuredDocument that underlies this model - * - * @return - */ - IStructuredDocument getStructuredDocument(); - - /** - * - */ - boolean isDirty(); - - /** - * This method can be called to determine if the model is within a - * "aboutToChange" and "changed" sequence. - */ - public boolean isModelStateChanging(); - - /** - * - */ - boolean isNew(); - - boolean isReinitializationNeeded(); - - /** - * This is a combination of if the model is dirty and if the model is - * shared for write access. The last writer as the responsibility to be - * sure the user is prompted to save. - */ - public boolean isSaveNeeded(); - - /** - * newInstance is similar to clone, except that the newInstance contains - * no content. Its purpose is so clients can get a temporary, unmanaged, - * model of the same "type" as the original. Note: the client may still - * need to do some intialization of the model returned by newInstance, - * depending on desired use. For example, the only factories in the - * newInstance are those that would be normally be created for a model of - * the given contentType. Others are not copied automatically, and if - * desired, should be added by client. - */ - IStructuredModelProposed newInstance() throws IOException; - - void removeModelStateListener(IModelStateListener listener); -} diff --git a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/text/IStructuredDocument.java b/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/text/IStructuredDocument.java deleted file mode 100644 index 9cff78e7cf..0000000000 --- a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/text/IStructuredDocument.java +++ /dev/null @@ -1,218 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2004 IBM Corporation and others. - * 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: - * IBM Corporation - initial API and implementation - * Jens Lukowski/Innoopract - initial renaming/restructuring - * - *******************************************************************************/ -package org.eclipse.wst.sse.core.internal.provisional.text; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.jface.text.IDocumentExtension; -import org.eclipse.wst.sse.core.internal.encoding.EncodingMemento; -import org.eclipse.wst.sse.core.internal.ltk.parser.RegionParser; -import org.eclipse.wst.sse.core.internal.provisional.document.IEncodedDocument; -import org.eclipse.wst.sse.core.internal.provisional.events.IModelAboutToBeChangedListener; -import org.eclipse.wst.sse.core.internal.provisional.events.IStructuredDocumentListener; -import org.eclipse.wst.sse.core.internal.provisional.events.StructuredDocumentEvent; -import org.eclipse.wst.sse.core.internal.undo.IStructuredTextUndoManager; - - -/** - * A IStructuredDocument is a collection of StructuredDocumentRegions. It's - * often called "flat" because its contents by design do not contain much - * structural information beyond containment. Clients should not implement. - */ -public interface IStructuredDocument extends IEncodedDocument, IDocumentExtension, IAdaptable { - - void addDocumentAboutToChangeListener(IModelAboutToBeChangedListener listener); - - /** - * The StructuredDocumentListeners and ModelChangedListeners are very - * similar. They both receive identical events. The difference is the - * timing. The "pure" StructuredDocumentListeners are notified after the - * structuredDocument has been changed, but before other, related models - * may have been changed such as the Structural Model. The Structural - * model is in fact itself a "pure" StructuredDocumentListner. The - * ModelChangedListeners can rest assured that all models and data have - * been updated from the change by the tiem they are notified. This is - * especially important for the text widget, for example, which may rely - * on both structuredDocument and structural model information. - */ - void addDocumentChangedListener(IStructuredDocumentListener listener); - - /** - * The StructuredDocumentListeners and ModelChangedListeners are very - * similar. They both receive identical events. The difference is the - * timing. The "pure" StructuredDocumentListeners are notified after the - * structuredDocument has been changed, but before other, related models - * may have been changed such as the Structural Model. The Structural - * model is in fact itself a "pure" StructuredDocumentListner. The - * ModelChangedListeners can rest assured that all models and data have - * been updated from the change by the tiem they are notified. This is - * especially important for the text widget, for example, which may rely - * on both structuredDocument and structural model information. - */ - void addDocumentChangingListener(IStructuredDocumentListener listener); - - /** - * this API ensures that any portion of the document within startOff to - * length is not readonly (that is, that its editable). Note that if the - * range overlaps with other readonly regions, those other readonly - * regions will be adjusted. - * - * @param startOffset - * @param length - */ - void clearReadOnly(int startOffset, int length); - - /** - * returns true if any portion of startOffset to length is readonly - * - * @param startOffset - * @param length - * @return - */ - boolean containsReadOnly(int startOffset, int length); - - /** - * This method is to remember info about the encoding When the resource - * was last loaded or saved. Note: it is not kept "current", that is, can - * not be depended on blindly to reflect what encoding to use. For that, - * must go through the normal rules expressed in Loaders and Dumpers. - */ - - EncodingMemento getEncodingMemento(); - - org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion getFirstStructuredDocumentRegion(); - - org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion getLastStructuredDocumentRegion(); - - /** - * This can be considered the preferred delimiter. - */ - public String getLineDelimiter(); - - int getLineOfOffset(int offset); // throws SourceEditingException; - - /** - * The parser is now required on constructor, so there are occasions it - * needs to be retrieved, such as to be initialized by EmbeddedContentType - */ - RegionParser getParser(); - - /** - * @deprecated use getStructuredDocumentRegions() - * @return - */ - IStructuredDocumentRegionList getRegionList(); - - /** - * Returns the <code>IStructuredDocumentRegion</code> at the given character offset. - * @param offset - * @return the <code>IStructuredDocumentRegion</code> at the given character offset. - */ - IStructuredDocumentRegion getRegionAtCharacterOffset(int offset); - - /** - * Returns <code>IStructuredDocumentRegion</code>s in the specified range. - * @param offset - * @param length - * @return <code>IStructuredDocumentRegion</code>s in the specified range. - */ - IStructuredDocumentRegion[] getStructuredDocumentRegions(int offset, int length); - - /** - * Returns all <code>IStructuredDocumentRegion</code>s in the document. - * @return all <code>IStructuredDocumentRegion</code>s in the document. - */ - IStructuredDocumentRegion[] getStructuredDocumentRegions(); - - /** - * Note: this method was made public, and part of the interface, for - * easier testing. Clients normally never manipulate the reparser directly - * (nor should they need to). - */ - IStructuredTextReParser getReParser(); - - String getText(); - - IStructuredTextUndoManager getUndoManager(); - - /** - * causes that portion of the document from startOffset to length to be - * marked as readonly. Note that if this range overlaps with some other - * region with is readonly, the regions are effectivly combined. - * - * @param startOffset - * @param length - */ - void makeReadOnly(int startOffset, int length); - - /** - * newInstance is similar to clone, except it contains no data. One - * important thing to duplicate is the parser, with the parser correctly - * "cloned", including its tokeninzer, block tags, etc. - * - * NOTE: even after obtaining a 'newInstance' the client may have to do - * some initialization, for example, it may need to add its own model - * listeners. Or, as another example, if the IStructuredDocument has a - * parser of type StructuredDocumentRegionParser, then the client may need - * to add its own StructuredDocumentRegionHandler to that parser, if it is - * in fact needed. - */ - IStructuredDocument newInstance(); - - void removeDocumentAboutToChangeListener(IModelAboutToBeChangedListener listener); - - void removeDocumentChangedListener(IStructuredDocumentListener listener); - - void removeDocumentChangingListener(IStructuredDocumentListener listener); - - /** - * One of the APIs to manipulate the IStructuredDocument. - * - * replaceText replaces the text from oldStart to oldEnd with the new text - * found in the requestedChange string. If oldStart and oldEnd are equal, - * it is an insertion request. If requestedChange is null (or empty) it is - * a delete request. Otherwise it is a replace request. - */ - StructuredDocumentEvent replaceText(Object source, int oldStart, int replacementLength, String requestedChange); - - /** - * Note, same as replaceText API, but will allow readonly areas to be - * replaced. This should seldom be called with a value of "true" for - * ignoreReadOnlySetting. One case where its ok is with undo operations - * (since, presumably, if user just did something that happended to - * involve some inserting readonly text, they should normally be allowed - * to still undo that operation. Otherwise, I can't think of a single - * example, unless its to give the user a choice, e.g. "you are about to - * overwrite read only portions, do you want to continue". - */ - StructuredDocumentEvent replaceText(Object source, int oldStart, int replacementLength, String requestedChange, boolean ignoreReadOnlySetting); - - /** - * This method is to remember info about the encoding When the resource - * was last loaded or saved. Note: it is not kept "current", that is, can - * not be depended on blindly to reflect what encoding to use. For that, - * must go through the normal rules expressed in Loaders and Dumpers. - */ - void setEncodingMemento(EncodingMemento encodingMemento); - - public void setLineDelimiter(String delimiter); - - /** - * One of the APIs to manipulate the IStructuredDocument in terms of Text. - * - * The setText method replaces all text in the model. - */ - StructuredDocumentEvent setText(Object requester, String allText); - - void setUndoManager(IStructuredTextUndoManager undoManager); - -} diff --git a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/text/IStructuredDocumentRegion.java b/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/text/IStructuredDocumentRegion.java deleted file mode 100644 index 314d1aada5..0000000000 --- a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/text/IStructuredDocumentRegion.java +++ /dev/null @@ -1,163 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2004 IBM Corporation and others. - * 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: - * IBM Corporation - initial API and implementation - * Jens Lukowski/Innoopract - initial renaming/restructuring - * - *******************************************************************************/ -package org.eclipse.wst.sse.core.internal.provisional.text; - -/** - * A ITextRegionCollection is a collection of ITextRegions. It is a structural - * unit, but a minimal one. For example, in might consist of a "start tag" but - * not a whole XML element. - */ -public interface IStructuredDocumentRegion extends ITextRegionCollection { - - /** - * Adds a text region to the end of the collection of regions contained by - * this region. It is the parsers responsibility to make sure its a - * correct region (that is, its start offset is one greater than previous - * regions end offset) - * - * For use by parsers and reparsers only. - */ - void addRegion(ITextRegion aRegion); - - /** - * Returns the structured document region that follows this one or null if - * at end of document. - * - * @return the structured document region that follows this one. - * - * ISSUE: for thread safety, this should be more restrictive. - */ - IStructuredDocumentRegion getNext(); - - /** - * Returns this regions parent document. - * - * @return this regions parent document. - */ - IStructuredDocument getParentDocument(); - - /** - * Returns the structured document region that preceeds this one or null - * if at beginning of document. - * - * @return the structured document region that follows this one. - * - * ISSUE: for thread safety, this should be more restrictive. - */ - IStructuredDocumentRegion getPrevious(); - - /** - * Returns true if this document has been deleted, and is no longer part - * of the actual structured document. This field can be used in - * multi-threaded operations, which may retrieve a long list of regions - * and be iterating through them at the same time the document is - * modified, and regions deleted. - * - * @return true if this region is no longer part of document. - */ - boolean isDeleted(); - - /** - * Returns true if this structured document region was ended "naturally" - * by syntactic rules, or if simply assumed to end so another could be - * started. - * - * @return true if region has syntactic end. - */ - boolean isEnded(); - - /** - * Tests is region is equal to this one, ignoring position offsets of - * shift. - * - * For use by parsers and reparsers only. - * - * @param region - * @param shift - * @return - */ - boolean sameAs(IStructuredDocumentRegion region, int shift); - - /** - * Tests if <code>oldRegion</code> is same as <code>newRegion</code>, - * ignoring position offsets of <code>shift</code>. - * - * ISSUE: which document region are old and new in? - * - * For use by parsers and reparsers only. - * - * @param oldRegion - * @param documentRegion - * @param newRegion - * @param shift - * @return - */ - boolean sameAs(ITextRegion oldRegion, IStructuredDocumentRegion documentRegion, ITextRegion newRegion, int shift); - - /** - * Set to true if/when this region is removed from a document, during the - * process of re-parsing. - * - * For use by parsers and reparsers only. - * - * @param deleted - */ - void setDeleted(boolean deleted); - - /** - * Set to true by parser/reparser if region deemed to end syntactically. - * - * For use by parsers and reparsers only. - * - * @param hasEnd - */ - void setEnded(boolean hasEnd); - - /** - * Sets length of region. - * - * For use by parsers and reparsers only. - */ - void setLength(int newLength); - - /** - * Assigns pointer to next region, or null if last region. - * - * For use by parsers and reparsers only. - */ - void setNext(IStructuredDocumentRegion newNext); - - /** - * Assigns parent documnet. - * - * For use by parsers and reparsers only. - */ - void setParentDocument(IStructuredDocument document); - - /** - * Assigns pointer to previous region, or null if first region. - * - * For use by parsers and reparsers only. - */ - void setPrevious(IStructuredDocumentRegion newPrevious); - - /** - * Sets start offset of region, relative to beginning of document. - * - * For use by parsers and reparsers only. - */ - void setStart(int newStart); - - - -} diff --git a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/text/IStructuredDocumentRegionList.java b/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/text/IStructuredDocumentRegionList.java deleted file mode 100644 index 0d7db56f0b..0000000000 --- a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/text/IStructuredDocumentRegionList.java +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2004 IBM Corporation and others. - * 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: - * IBM Corporation - initial API and implementation - * Jens Lukowski/Innoopract - initial renaming/restructuring - * - *******************************************************************************/ -package org.eclipse.wst.sse.core.internal.provisional.text; - -import java.util.Enumeration; - -/** - * This is a class used to provide a list of StructuredDocumentRegions, so the - * implementation of how the list is formed can be hidden (encapsulated by - * this class). - * - * ISSUE: should extend ITextRegionList instead? - * - * @plannedfor 1.0 - * - */ -public interface IStructuredDocumentRegionList { - - /** - * Returns enumeration. - * - * @return enumeration. - */ - Enumeration elements(); - - /** - * Returns size of list. - * - * @return size of list. - */ - int getLength(); - - /** - * Returns the structured document region at index i. - * - * @param i - * index of region to return - * @return the region at specified offset. - */ - IStructuredDocumentRegion item(int i); - -} diff --git a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/text/IStructuredPartitionTypes.java b/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/text/IStructuredPartitionTypes.java deleted file mode 100644 index 70c7b80ff8..0000000000 --- a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/text/IStructuredPartitionTypes.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.eclipse.wst.sse.core.internal.provisional.text; - -/** - * This interface is not intended to be implemented. - * It defines the partitioning for StructuredDocuments. - * Clients should reference the partition type Strings defined here directly. - * - * @deprecated use org.eclipse.wst.sse.core.internal.provisional.text.IStructuredPartitions - */ -public interface IStructuredPartitionTypes { - - String DEFAULT_PARTITION = "org.eclipse.wst.sse.ST_DEFAULT"; //$NON-NLS-1$ - String UNKNOWN_PARTITION = "org.eclipse.wst.sse.UNKNOWN_PARTITION_TYPE"; //$NON-NLS-1$ -} diff --git a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/text/IStructuredPartitioning.java b/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/text/IStructuredPartitioning.java deleted file mode 100644 index f7e940c2d4..0000000000 --- a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/text/IStructuredPartitioning.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.eclipse.wst.sse.core.internal.provisional.text; - -/** - * Identifies the way that Documents are partitioned. - * - * @plannedfor 1.0 - */ -public interface IStructuredPartitioning { - - /** String to identify default partitioning*/ - String DEFAULT_STRUCTURED_PARTITIONING = "org.eclipse.wst.sse.core.default_structured_text_partitioning"; //$NON-NLS-1$ -} diff --git a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/text/IStructuredTextPartitioner.java b/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/text/IStructuredTextPartitioner.java deleted file mode 100644 index ff64c8626e..0000000000 --- a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/text/IStructuredTextPartitioner.java +++ /dev/null @@ -1,86 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2004 IBM Corporation and others. - * 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: - * IBM Corporation - initial API and implementation - * Jens Lukowski/Innoopract - initial renaming/restructuring - * - *******************************************************************************/ -package org.eclipse.wst.sse.core.internal.provisional.text; - -import org.eclipse.jface.text.IDocumentPartitioner; -import org.eclipse.wst.sse.core.internal.text.rules.IStructuredTypedRegion; - - -/** - * A partitioner interface required for handling the embedded content type - * properly. - * - * ISSUE: need to investigate necessity of these methods - * - * @plannedfor 1.0 - */ - -public interface IStructuredTextPartitioner extends IDocumentPartitioner { - - /** - * Used by JSP partitioner to ensure that the partitioner of the - * embedded content type gets to create the partition in case the specific - * classes are important. - * - * ISSUE: investigate if we really need this... - */ - IStructuredTypedRegion createPartition(int offset, int length, String partitionType); - - /** - * Returns the Default partition type for this partitioner. - * <p> - * eg: - * <br><code>org.eclipse.wst.xml.core.text.IXMLPartitions.XML_DEFAULT</code> - * <br><code>org.eclipse.wst.html.core.text.IHTMLPartitions.HTML_DEFAULT</code> - * <br><code>org.eclipse.wst.jsp.core.text.IJSPPartitions.JSP_DEFAULT</code> - * </p> - * @see org.eclipse.wst.sse.core.text.IStructuredPartitions - * @see org.eclipse.wst.xml.core.text.IXMLPartitions - * @see org.eclipse.wst.html.core.text.IHTMLPartitions - * @see org.eclipse.wst.jsp.core.text.IJSPPartitions - * - * @return the Default partition type for this partitioner. - */ - String getDefaultPartitionType(); - - /** - * Returns the particular partition type for the given region/offset. - * <p> - * eg: - * <br><code>org.eclipse.wst.xml.core.text.IXMLPartitions.XML_DEFAULT</code> - * <br><code>org.eclipse.wst.html.core.text.IHTMLPartitions.HTML_DEFAULT</code> - * <br><code>org.eclipse.wst.jsp.core.text.IJSPPartitions.JSP_DEFAULT</code> - * </p> - * - * @param region of the IStructuredDocument - * @param offset in the IStructuredDoucment - * @return the particular partition type for the given region/offset. - */ - String getPartitionType(ITextRegion region, int offset); - - /** - * Returns the partition type String of the IStructuredDocumentRegion - * between the 2 region parameters. - * Useful for finding the partition type of a 0 length region. - * eg. - * <pre> - * <script type="text/javascript">|</script> - * </pre> - * @param previousNode - * @param nextNode - * @return the partition type of the node between previousNode and nextNode - * @deprecated move to IDocumentPartitionerExtension2 -> - * String getContentType(int offset, boolean preferOpenPartitions); - */ - String getPartitionTypeBetween(IStructuredDocumentRegion previousNode, IStructuredDocumentRegion nextNode); -} diff --git a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/text/IStructuredTextReParser.java b/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/text/IStructuredTextReParser.java deleted file mode 100644 index e465fa90fa..0000000000 --- a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/text/IStructuredTextReParser.java +++ /dev/null @@ -1,72 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2004 IBM Corporation and others. - * 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: - * IBM Corporation - initial API and implementation - * Jens Lukowski/Innoopract - initial renaming/restructuring - * - *******************************************************************************/ -package org.eclipse.wst.sse.core.internal.provisional.text; - - -import org.eclipse.wst.sse.core.internal.provisional.events.StructuredDocumentEvent; - -/** - * IStructuredTextReParser describes the characteristics and responsibilities - * for reparsing a structured document. - * - * @plannedfor 1.0 - */ -public interface IStructuredTextReParser { - - /** - * Begins the process of reparsing, by providing the information needed - * for the reparse. The reparse is actually performed when the reparse - * method is called. Will through an IllegalStateException if document as - * not be set. - * - * @param requester - * @param start - * @param lengthToReplace - * @param changes - */ - void initialize(Object requester, int start, int lengthToReplace, String changes); - - /** - * This method is provided to enable multiple threads to reparse a - * document. This is needed since the intialize method sets state - * variables that must be "in sync" with the structuredDocument. - */ - public boolean isParsing(); - - /** - * Returns a new instance of this reparser, used when cloning documents. - * - * @return a new instance of this reparser. - */ - public IStructuredTextReParser newInstance(); - - /** - * An entry point for reparsing. It needs to calculates the dirty start - * and dirty end in terms of structured document regions based on the - * start point and length of the changes, which are provided by the - * initialize method. Will through an IllegalStateException if document as - * not be set. - * - */ - public StructuredDocumentEvent reparse(); - - - - /** - * The reparser is initialized with its document, either in or shortly - * after its constructed is called. - * - * @param structuredDocument - */ - public void setStructuredDocument(IStructuredDocument newStructuredDocument); -} diff --git a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/text/ITextRegion.java b/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/text/ITextRegion.java deleted file mode 100644 index b1281ab82c..0000000000 --- a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/text/ITextRegion.java +++ /dev/null @@ -1,158 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation and others. - * 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: - * IBM Corporation - initial API and implementation - * Jens Lukowski/Innoopract - initial renaming/restructuring - * - *******************************************************************************/ -package org.eclipse.wst.sse.core.internal.provisional.text; - -import org.eclipse.wst.sse.core.internal.provisional.events.StructuredDocumentEvent; - -/** - * A simple description of a bit of text (technically, a bit of a text buffer) - * that has a "type" associated with it. For example, for the XML text - * "<IMG>", the ' <' might form a region of type "open bracket" where as - * the text "IMG" might form a region of type "tag name". - * - * Note that there are three positions associated with a region, the start, - * the end, and the end of the text. The end of the region should always be - * greater than or equal to the end of the text, because the end of the text - * simply includes any white space that might follow the non-whitespace - * portion of the region. This whitespace is assumed to be ignorable except - * for reasons of maintaining it in the original document for formatting, - * appearance, etc. - * - * Follows the Prime Directives: - * - * getEnd() == getStart() + getLength() - * - * getTextEnd() == getStart() + getTextLength(); - * - * Event though 'end' and 'length' are redundant (given start), both methods - * are provided, since some parsers/implementations favor one or the other for - * efficiency. - * - * @plannedfor 1.0 - */ -public interface ITextRegion { - - /** - * Changes length of region. May be less than, equal to, or greater than - * zero. It may not, however, cause the length of the region to be less - * than or equal to zero, or an illegal argument acception may be thrown - * at runtime. - * - * For use by parsers and reparsers only. - */ - void adjustLength(int i); - - /** - * Changes start offset of region. May be less than, equal to, or greater - * than zero. It may not, however, cause the offset of the region to be - * less than zero, or an illegal argument acception may be thrown at - * runtime. - * - * For use by parsers and reparsers only. - */ - void adjustStart(int i); - - /** - * Changes text length of region. - * - * May be less than, equal to, or greater than zero. It may not, however, - * cause the text length of the region to be greater than the length of a - * region, or an illegal argument acception may be thrown at runtime. - * - * For use by parsers and reparsers only. - */ - void adjustTextLength(int i); - - /** - * Makes this regions start, length, and text length equal to the - * paremter's start, length, and text length. - * - * @param region - */ - void equatePositions(ITextRegion region); - - /** - * Returns the end offset of this region. Whether is relative to the - * document, or another region depends on the subtype. - * - * Follows the Prime Directive: getEnd() == getStart() + getLength() - * - * @return the end offset of this region. - */ - int getEnd(); - - /** - * Returns the length of the region. - * - * Follows the Prime Directive: getEnd() == getStart() + getLength() - * - * @return the length of the region. - */ - int getLength(); - - /** - * Returns the start of the region. Whether is relative to the document, - * or another region depends on the subtype. - * - * Follows the Prime Directive: getEnd() == getStart() + getLength() - * - * @return the start of the region. - */ - int getStart(); - - /** - * Returns the end offset of the text of this region. - * - * In some implementations, the "end" of the region (accessible via - * getEnd()) also contains any and all white space that may or may not be - * present after the "token" (read: relevant) part of the region. This - * method, getTextEnd(), is specific for the "token" part of the region, - * without the whitespace. - * - * @return the end offset of the text of this region. - */ - int getTextEnd(); - - /** - * Returns the length of the text of this region. - * - * The text length is equal to length if there is no white space at the - * end of a region. Otherwise it is smaller than length. - * - * @return the length of the text of this region. - */ - int getTextLength(); - - /** - * Returns the type of this region. - * - * @see regiontypes, structureddocumentregiontypes - * @return the type of this region. - */ - String getType(); - - /** - * Allows the region itself to participate in reparsing process. - * - * The region itself can decide if it can determine the appropriate event - * to return, based on the requested change. If it can not, this method - * must return null, so a "higher level" reparsing process will be given - * the oppurtunity to decide. If it returns an Event, that's it, not other - * reparsing process will get an oppurtunity to reparse. - * - * For use by parsers and reparsers only. - * - */ - StructuredDocumentEvent updateRegion(Object requester, IStructuredDocumentRegion parent, String changes, int requestStart, int lengthToReplace); - -} diff --git a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/text/ITextRegionCollection.java b/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/text/ITextRegionCollection.java deleted file mode 100644 index 08890ae4e1..0000000000 --- a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/text/ITextRegionCollection.java +++ /dev/null @@ -1,178 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation and others. - * 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: - * IBM Corporation - initial API and implementation - * Jens Lukowski/Innoopract - initial renaming/restructuring - * - *******************************************************************************/ -package org.eclipse.wst.sse.core.internal.provisional.text; - -/** - * ITextRegionCollection, as its name implies, is a collection of - * ITextRegions. - * - * @plannedfor 1.0 - */ -public interface ITextRegionCollection extends ITextRegion { - - /** - * Used to determine if a region contains a particular offset, where - * offset is relative to the beginning of a document. - * - * @param offset - * @return true if offset is greater than or equal to regions start and - * less than its end offset. - */ - boolean containsOffset(int offset); - - /** - * Used to determine if a region contains a particular offset. - * - * ISSUE: I need to figure out what this is really for! (that is, how to - * describe it, or if still needed). - * - * @param offset - * @return true if offset is greater than or equal to regions start and - * less than its end offset. - */ - boolean containsOffset(ITextRegion region, int offset); - - /** - * Returns the end offset of this region, relative to beginning of - * document. - * - * For some subtypes, but not all, it is equivilent to getEnd(). - * - * @return the end offset of this region. - */ - int getEndOffset(); - - /** - * Returns the end offset, relative to the beginning of the document of - * the contained region. - * - * @param containedRegion - * @return the end offset of the contained region. - */ - int getEndOffset(ITextRegion containedRegion); - - /** - * Returns the first region of those contained by this region collection. - * - * @return the first region. - */ - ITextRegion getFirstRegion(); - - /** - * Returns the full text of this region, including whitespace. - * - * @return the full text of this region, including whitespace. - */ - String getFullText(); - - /** - * Returns the full text of the contained region, including whitespace. - * - * @return the full text of the contained region, including whitespace. - */ - String getFullText(ITextRegion containedRegion); - - /** - * Returns the last region of those contained by this region collection. - * - * @return the last region. - */ - ITextRegion getLastRegion(); - - /** - * Returns the number of regions contained by this region. - * - * @return the number of regions contained by this region. - */ - int getNumberOfRegions(); - - /** - * Returns the region that contains offset. In the case of "nested" - * regions, returns the top most region. - * - * @param offset - * relative to beginning of document. - * @return the region that contains offset. In the case of "nested" - * regions, returns the top most region. - */ - ITextRegion getRegionAtCharacterOffset(int offset); - - /** - * Returns the regions contained by this region. - * - * Note: no assumptions should be made about the object identity of the - * regions returned. Put another way, due to memory use optimizations, - * even if the underlying text has not changed, the regions may or may not - * be the same ones returned from one call to the next. - * - * @return the regions contained by this region. - */ - ITextRegionList getRegions(); - - /** - * Returns the start offset of this region, relative to the beginning of - * the document. - * - * @return the start offset of this region - */ - int getStartOffset(); - - /** - * Returns the start offset of the contained region, relative to the - * beginning of the document. - * - * @return the start offset of the contained region - */ - int getStartOffset(ITextRegion containedRegion); - - /** - * Returns the text of this region, not including white space. - * - * @return the text of this region, not including white space. - */ - String getText(); - - /** - * Returns the text of the contained region, not including white space. - * - * @return the text of the contained region, not including white space. - */ - String getText(ITextRegion containedRegion); - - /** - * Returns the end offset of the text of this region, not including white - * space. - * - * @return the end offset of the text of this region, not including white - * space. - */ - int getTextEndOffset(); - - /** - * Returns the end offset of the text of the contained region, not - * including white space. - * - * @return the end offset of the text of the contained region, not - * including white space. - */ - int getTextEndOffset(ITextRegion containedRegion); - - /** - * Assigns the collection contained in this region. - * - * For use by parsers and reparsers only. - * - * @param containedRegions - */ - void setRegions(ITextRegionList containedRegions); -} diff --git a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/text/ITextRegionContainer.java b/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/text/ITextRegionContainer.java deleted file mode 100644 index 654ca8116e..0000000000 --- a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/text/ITextRegionContainer.java +++ /dev/null @@ -1,40 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation and others. - * 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: - * IBM Corporation - initial API and implementation - * Jens Lukowski/Innoopract - initial renaming/restructuring - * - *******************************************************************************/ -package org.eclipse.wst.sse.core.internal.provisional.text; - -/** - * ITextRegionContainer contains other regions, like a ITextRegionCollection - * but is itself a region in an ITextRegionCollection, so its "parent" region - * is maintained. - * - * @plannedfor 1.0 - */ -public interface ITextRegionContainer extends ITextRegionCollection { - - /** - * Returns the parent region. - * - * @return the parent region. - */ - ITextRegionCollection getParent(); - - /** - * Sets the parent region. - * - * For use by parsers and reparsers only. - * - * @param parent - * the ITextRegionCollection this region is contained in. - */ - void setParent(ITextRegionCollection parent); -} diff --git a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/text/ITextRegionList.java b/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/text/ITextRegionList.java deleted file mode 100644 index a013572aa9..0000000000 --- a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/text/ITextRegionList.java +++ /dev/null @@ -1,131 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2004 IBM Corporation and others. - * 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: - * IBM Corporation - initial API and implementation - * Jens Lukowski/Innoopract - initial renaming/restructuring - * - *******************************************************************************/ -package org.eclipse.wst.sse.core.internal.provisional.text; - -import java.util.Iterator; - -/** - * ITextRegionList is to provide a list of regions. It can be used so clients - * do not need to be aware of underlying implementation. - */ -public interface ITextRegionList { - - /** - * Adds region to the list. - * - * For use by parsers and reparsers only, while list is being created. - * - * @param region - * @return - */ - public boolean add(ITextRegion region); - - /** - * Adds new regions to the list. - * - * For use by parsers and reparsers only, while list is being created. - * - * @param insertPos - * @param newRegions - * @return - */ - public boolean addAll(int insertPos, ITextRegionList newRegions); - - /** - * Removes all regions from the list. - * - * For use by parsers and reparsers only, while list is being created. - * - */ - public void clear(); - - - /** - * Returns the region at <code>index</code>, where 0 is first one in - * the list. Throws an <code>ArrayIndexOutOfBoundsException</code> if - * list is empty, or if index is out of range. - * - * @param index - * @return - */ - public ITextRegion get(int index); - - /** - * Returns the index of <code>region</code> or -1 if <code>region</code> - * is not in the list. - * - * @param region - * @return - */ - public int indexOf(ITextRegion region); - - /** - * Returns true if list has no regions. - * - * @return true if list has no regions. - */ - public boolean isEmpty(); - - - /** - * Returns an iterator for this list. - * - * @return an iterator for this list. - */ - public Iterator iterator(); - - /** - * Removes the region at index. - * - * For use by parsers and reparsers only, while list is being created. - * - */ - public ITextRegion remove(int index); - - /** - * Removes the region. - * - * For use by parsers and reparsers only, while list is being created. - * - */ - public void remove(ITextRegion region); - - - /** - * Removes all regionList from this list. - * - * For use by parsers and reparsers only, while list is being created. - * - */ - public void removeAll(ITextRegionList regionList); - - /** - * Returns the size of the list. - * - * @return the size of the list. - */ - public int size(); - - - /** - * Creates and returns the regions in an array. No assumptions should be - * made if the regions in the array are clones are same instance of - * original region. - * - * ISSUE: do we need to specify if cloned copies or not? - * - * @return an array of regions. - */ - public ITextRegion[] toArray(); - -} |