X-Git-Url: http://secure.phpeclipse.com
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/phpdoc/JavaDocAutoIndentStrategy.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/phpdoc/JavaDocAutoIndentStrategy.java
index 20f3c40..34c8f21 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/phpdoc/JavaDocAutoIndentStrategy.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/text/phpdoc/JavaDocAutoIndentStrategy.java
@@ -13,19 +13,19 @@ package net.sourceforge.phpdt.internal.ui.text.phpdoc;
import java.text.BreakIterator;
-import net.sourceforge.phpdt.core.ICompilationUnit;
-import net.sourceforge.phpdt.core.IJavaElement;
-import net.sourceforge.phpdt.core.IMethod;
-import net.sourceforge.phpdt.core.ISourceRange;
-import net.sourceforge.phpdt.core.IType;
-import net.sourceforge.phpdt.internal.corext.util.Strings;
-import net.sourceforge.phpdt.ui.CodeGeneration;
-import net.sourceforge.phpdt.ui.IWorkingCopyManager;
+//import net.sourceforge.phpdt.core.ICompilationUnit;
+//import net.sourceforge.phpdt.core.IJavaElement;
+//import net.sourceforge.phpdt.core.IMethod;
+//import net.sourceforge.phpdt.core.ISourceRange;
+//import net.sourceforge.phpdt.core.IType;
+//import net.sourceforge.phpdt.internal.corext.util.Strings;
+//import net.sourceforge.phpdt.ui.CodeGeneration;
+//import net.sourceforge.phpdt.ui.IWorkingCopyManager;
import net.sourceforge.phpdt.ui.PreferenceConstants;
import net.sourceforge.phpeclipse.PHPeclipsePlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.Preferences;
+//import org.eclipse.core.runtime.CoreException;
+//import org.eclipse.core.runtime.Preferences;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.DefaultIndentLineAutoEditStrategy;
@@ -36,8 +36,8 @@ import org.eclipse.jface.text.ITypedRegion;
import org.eclipse.jface.text.TextUtilities;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
+//import org.eclipse.ui.IWorkbenchWindow;
+//import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.texteditor.AbstractDecoratedTextEditorPreferenceConstants;
import org.eclipse.ui.texteditor.ITextEditorExtension3;
@@ -118,7 +118,7 @@ public class JavaDocAutoIndentStrategy extends
String endTag = lineDelimiter + indentation + " */"; //$NON-NLS-1$
d.replace(c.offset, 0, endTag); //$NON-NLS-1$
// evaluate method signature
- ICompilationUnit unit = getCompilationUnit();
+ //ICompilationUnit unit = getCompilationUnit();
// if
// (PHPeclipsePlugin.getDefault().getPreferenceStore().getBoolean(PreferenceConstants.EDITOR_ADD_JAVADOC_TAGS)
@@ -149,94 +149,94 @@ public class JavaDocAutoIndentStrategy extends
}
}
- private String createJavaDocTags(IDocument document,
- DocumentCommand command, String indentation, String lineDelimiter,
- ICompilationUnit unit) throws CoreException, BadLocationException {
- IJavaElement element = unit.getElementAt(command.offset);
- if (element == null)
- return null;
-
- switch (element.getElementType()) {
- case IJavaElement.TYPE:
- return createTypeTags(document, command, indentation,
- lineDelimiter, (IType) element);
-
- case IJavaElement.METHOD:
- return createMethodTags(document, command, indentation,
- lineDelimiter, (IMethod) element);
-
- default:
- return null;
- }
- }
+// private String createJavaDocTags(IDocument document,
+// DocumentCommand command, String indentation, String lineDelimiter,
+// ICompilationUnit unit) throws CoreException, BadLocationException {
+// IJavaElement element = unit.getElementAt(command.offset);
+// if (element == null)
+// return null;
+//
+// switch (element.getElementType()) {
+// case IJavaElement.TYPE:
+// return createTypeTags(document, command, indentation,
+// lineDelimiter, (IType) element);
+//
+// case IJavaElement.METHOD:
+// return createMethodTags(document, command, indentation,
+// lineDelimiter, (IMethod) element);
+//
+// default:
+// return null;
+// }
+// }
/*
* Removes start and end of a comment and corrects indentation and line
* delimiters.
*/
- private String prepareTemplateComment(String comment, String indentation,
- String lineDelimiter) {
- // trim comment start and end if any
- if (comment.endsWith("*/")) //$NON-NLS-1$
- comment = comment.substring(0, comment.length() - 2);
- comment = comment.trim();
- if (comment.startsWith("/*")) { //$NON-NLS-1$
- if (comment.length() > 2 && comment.charAt(2) == '*') {
- comment = comment.substring(3); // remove '/**'
- } else {
- comment = comment.substring(2); // remove '/*'
- }
- }
- // return Strings.changeIndent(comment, 0,
- // CodeFormatterUtil.getTabWidth(), indentation, lineDelimiter);
- return Strings.changeIndent(comment, 0, getTabWidth(), indentation,
- lineDelimiter);
- }
-
- public static int getTabWidth() {
- Preferences preferences = PHPeclipsePlugin.getDefault()
- .getPluginPreferences();
- return preferences
- .getInt(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_TAB_WIDTH);
- }
-
- private String createTypeTags(IDocument document, DocumentCommand command,
- String indentation, String lineDelimiter, IType type)
- throws CoreException {
- String comment = CodeGeneration.getTypeComment(type
- .getCompilationUnit(), type.getTypeQualifiedName('.'),
- lineDelimiter);
- if (comment != null) {
- return prepareTemplateComment(comment.trim(), indentation,
- lineDelimiter);
- }
- return null;
- }
-
- private String createMethodTags(IDocument document,
- DocumentCommand command, String indentation, String lineDelimiter,
- IMethod method) throws CoreException, BadLocationException {
- IRegion partition = TextUtilities.getPartition(document, fPartitioning,
- command.offset, false);
- ISourceRange sourceRange = method.getSourceRange();
- if (sourceRange == null
- || sourceRange.getOffset() != partition.getOffset())
- return null;
-
- // IMethod inheritedMethod= getInheritedMethod(method);
- // String comment= CodeGeneration.getMethodComment(method,
- // inheritedMethod, lineDelimiter);
- // if (comment != null) {
- // comment= comment.trim();
- // boolean javadocComment= comment.startsWith("/**"); //$NON-NLS-1$
- // boolean isJavaDoc= partition.getLength() >= 3 &&
- // document.get(partition.getOffset(), 3).equals("/**"); //$NON-NLS-1$
- // if (javadocComment == isJavaDoc) {
- // return prepareTemplateComment(comment, indentation, lineDelimiter);
- // }
- // }
- return null;
- }
+// private String prepareTemplateComment(String comment, String indentation,
+// String lineDelimiter) {
+// // trim comment start and end if any
+// if (comment.endsWith("*/")) //$NON-NLS-1$
+// comment = comment.substring(0, comment.length() - 2);
+// comment = comment.trim();
+// if (comment.startsWith("/*")) { //$NON-NLS-1$
+// if (comment.length() > 2 && comment.charAt(2) == '*') {
+// comment = comment.substring(3); // remove '/**'
+// } else {
+// comment = comment.substring(2); // remove '/*'
+// }
+// }
+// // return Strings.changeIndent(comment, 0,
+// // CodeFormatterUtil.getTabWidth(), indentation, lineDelimiter);
+// return Strings.changeIndent(comment, 0, getTabWidth(), indentation,
+// lineDelimiter);
+// }
+
+// public static int getTabWidth() {
+// Preferences preferences = PHPeclipsePlugin.getDefault()
+// .getPluginPreferences();
+// return preferences
+// .getInt(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_TAB_WIDTH);
+// }
+
+// private String createTypeTags(IDocument document, DocumentCommand command,
+// String indentation, String lineDelimiter, IType type)
+// throws CoreException {
+// String comment = CodeGeneration.getTypeComment(type
+// .getCompilationUnit(), type.getTypeQualifiedName('.'),
+// lineDelimiter);
+// if (comment != null) {
+// return prepareTemplateComment(comment.trim(), indentation,
+// lineDelimiter);
+// }
+// return null;
+// }
+
+// private String createMethodTags(IDocument document,
+// DocumentCommand command, String indentation, String lineDelimiter,
+// IMethod method) throws CoreException, BadLocationException {
+// IRegion partition = TextUtilities.getPartition(document, fPartitioning,
+// command.offset, false);
+// ISourceRange sourceRange = method.getSourceRange();
+// if (sourceRange == null
+// || sourceRange.getOffset() != partition.getOffset())
+// return null;
+//
+// // IMethod inheritedMethod= getInheritedMethod(method);
+// // String comment= CodeGeneration.getMethodComment(method,
+// // inheritedMethod, lineDelimiter);
+// // if (comment != null) {
+// // comment= comment.trim();
+// // boolean javadocComment= comment.startsWith("/**"); //$NON-NLS-1$
+// // boolean isJavaDoc= partition.getLength() >= 3 &&
+// // document.get(partition.getOffset(), 3).equals("/**"); //$NON-NLS-1$
+// // if (javadocComment == isJavaDoc) {
+// // return prepareTemplateComment(comment, indentation, lineDelimiter);
+// // }
+// // }
+// return null;
+// }
/**
* Returns the method inherited from, null
if method is newly
@@ -910,28 +910,28 @@ public class JavaDocAutoIndentStrategy extends
* Returns the compilation unit of the CompilationUnitEditor invoking the
* AutoIndentStrategy, might return null
on error.
*/
- private static ICompilationUnit getCompilationUnit() {
-
- IWorkbenchWindow window = PlatformUI.getWorkbench()
- .getActiveWorkbenchWindow();
- if (window == null)
- return null;
-
- IWorkbenchPage page = window.getActivePage();
- if (page == null)
- return null;
-
- IEditorPart editor = page.getActiveEditor();
- if (editor == null)
- return null;
-
- IWorkingCopyManager manager = PHPeclipsePlugin.getDefault()
- .getWorkingCopyManager();
- ICompilationUnit unit = manager.getWorkingCopy(editor.getEditorInput());
- if (unit == null)
- return null;
-
- return unit;
- }
+// private static ICompilationUnit getCompilationUnit() {
+//
+// IWorkbenchWindow window = PlatformUI.getWorkbench()
+// .getActiveWorkbenchWindow();
+// if (window == null)
+// return null;
+//
+// IWorkbenchPage page = window.getActivePage();
+// if (page == null)
+// return null;
+//
+// IEditorPart editor = page.getActiveEditor();
+// if (editor == null)
+// return null;
+//
+// IWorkingCopyManager manager = PHPeclipsePlugin.getDefault()
+// .getWorkingCopyManager();
+// ICompilationUnit unit = manager.getWorkingCopy(editor.getEditorInput());
+// if (unit == null)
+// return null;
+//
+// return unit;
+// }
}