Skip to main content

This CGIT instance is deprecated, and repositories have been moved to Gitlab or Github. See the repository descriptions for specific locations.

summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/ui/preferences/formatter/CompilationUnitPreview.java')
-rw-r--r--bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/ui/preferences/formatter/CompilationUnitPreview.java75
1 files changed, 0 insertions, 75 deletions
diff --git a/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/ui/preferences/formatter/CompilationUnitPreview.java b/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/ui/preferences/formatter/CompilationUnitPreview.java
deleted file mode 100644
index 0629126b..00000000
--- a/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/ui/preferences/formatter/CompilationUnitPreview.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2008 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.jsdt.internal.ui.preferences.formatter;
-
-import java.util.Map;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.text.Region;
-import org.eclipse.jface.text.formatter.FormattingContextProperties;
-import org.eclipse.jface.text.formatter.IContentFormatter;
-import org.eclipse.jface.text.formatter.IContentFormatterExtension;
-import org.eclipse.jface.text.formatter.IFormattingContext;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.wst.jsdt.internal.ui.IJavaStatusConstants;
-import org.eclipse.wst.jsdt.internal.ui.JavaScriptPlugin;
-import org.eclipse.wst.jsdt.internal.ui.text.comment.CommentFormattingContext;
-
-
-public class CompilationUnitPreview extends JavaPreview {
-
- private String fPreviewText;
-
- /**
- * @param workingValues
- * @param parent
- */
- public CompilationUnitPreview(Map workingValues, Composite parent) {
-
- super(workingValues, parent);
- }
-
- protected void doFormatPreview() {
- if (fPreviewText == null) {
- fPreviewDocument.set(""); //$NON-NLS-1$
- return;
- }
- fPreviewDocument.set(fPreviewText);
-
- fSourceViewer.setRedraw(false);
- final IFormattingContext context = new CommentFormattingContext();
- try {
- final IContentFormatter formatter = fViewerConfiguration.getContentFormatter(fSourceViewer);
- if (formatter instanceof IContentFormatterExtension) {
- final IContentFormatterExtension extension = (IContentFormatterExtension) formatter;
- context.setProperty(FormattingContextProperties.CONTEXT_PREFERENCES, fWorkingValues);
- context.setProperty(FormattingContextProperties.CONTEXT_DOCUMENT, Boolean.valueOf(true));
- extension.format(fPreviewDocument, context);
- } else
- formatter.format(fPreviewDocument, new Region(0, fPreviewDocument.getLength()));
- } catch (Exception e) {
- final IStatus status= new Status(IStatus.ERROR, JavaScriptPlugin.getPluginId(), IJavaStatusConstants.INTERNAL_ERROR,
- FormatterMessages.JavaPreview_formatter_exception, e);
- JavaScriptPlugin.log(status);
- } finally {
- context.dispose();
- fSourceViewer.setRedraw(true);
- }
- }
-
- public void setPreviewText(String previewText) {
-// if (previewText == null) throw new IllegalArgumentException();
- fPreviewText= previewText;
- update();
- }
-}

Back to the top