Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/format/StructuredFormattingStrategy.java')
-rw-r--r--bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/format/StructuredFormattingStrategy.java95
1 files changed, 0 insertions, 95 deletions
diff --git a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/format/StructuredFormattingStrategy.java b/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/format/StructuredFormattingStrategy.java
deleted file mode 100644
index 06b006e2c3..0000000000
--- a/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/format/StructuredFormattingStrategy.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
-* Copyright (c) 2002 IBM Corporation and others.
-* All rights reserved. This program and the accompanying materials
-* are made available under the terms of the Common Public License v1.0
-* which accompanies this distribution, and is available at
-* http://www.eclipse.org/legal/cpl-v10.html
-*
-* Contributors:
-* IBM - Initial API and implementation
-* Jens Lukowski/Innoopract - initial renaming/restructuring
-*
-*/
-package org.eclipse.wst.sse.core.format;
-
-import java.io.IOException;
-import java.util.LinkedList;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.TypedPosition;
-import org.eclipse.jface.text.formatter.ContextBasedFormattingStrategy;
-import org.eclipse.jface.text.formatter.FormattingContextProperties;
-import org.eclipse.jface.text.formatter.IFormattingContext;
-import org.eclipse.wst.sse.core.IModelManager;
-import org.eclipse.wst.sse.core.IModelManagerPlugin;
-import org.eclipse.wst.sse.core.exceptions.SourceEditingRuntimeException;
-
-
-public class StructuredFormattingStrategy extends ContextBasedFormattingStrategy {
-
- /** Documents to be formatted by this strategy */
- private final LinkedList fDocuments = new LinkedList();
- /** Partitions to be formatted by this strategy */
- private final LinkedList fPartitions = new LinkedList();
- private IStructuredFormatProcessor fFormatProcessor;
- private IRegion fRegion;
-
- /**
- * @param formatProcessor
- */
- public StructuredFormattingStrategy(IStructuredFormatProcessor formatProcessor) {
- super();
-
- fFormatProcessor = formatProcessor;
- }
-
- /*
- * @see org.eclipse.jface.text.formatter.ContextBasedFormattingStrategy#format()
- */
- public void format() {
- super.format();
-
- final IDocument document = (IDocument) fDocuments.removeFirst();
- final TypedPosition partition = (TypedPosition) fPartitions.removeFirst();
-
- if (document != null && partition != null && fRegion != null && fFormatProcessor != null) {
- try {
- fFormatProcessor.formatDocument(document, fRegion.getOffset(), fRegion.getLength());
- }
- catch (IOException e) {
- throw new SourceEditingRuntimeException(e);
- }
- catch (CoreException e) {
- throw new SourceEditingRuntimeException(e);
- }
- }
- }
-
- /*
- * @see org.eclipse.jface.text.formatter.ContextBasedFormattingStrategy#formatterStarts(org.eclipse.jface.text.formatter.IFormattingContext)
- */
- public void formatterStarts(final IFormattingContext context) {
- super.formatterStarts(context);
-
- fPartitions.addLast(context.getProperty(FormattingContextProperties.CONTEXT_PARTITION));
- fDocuments.addLast(context.getProperty(FormattingContextProperties.CONTEXT_MEDIUM));
- fRegion = (IRegion) context.getProperty(FormattingContextProperties.CONTEXT_REGION);
- }
-
- /*
- * @see org.eclipse.jface.text.formatter.ContextBasedFormattingStrategy#formatterStops()
- */
- public void formatterStops() {
- super.formatterStops();
-
- fPartitions.clear();
- fDocuments.clear();
- }
-
- protected static IModelManager getModelManager() {
- return ((IModelManagerPlugin) Platform.getPlugin(IModelManagerPlugin.ID)).getModelManager();
- }
-}

Back to the top