X-Git-Url: http://secure.phpeclipse.com diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/text/phpdoc/JavaDocAutoIndentStrategy.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/text/phpdoc/JavaDocAutoIndentStrategy.java index 8f33483..a4afa5d 100644 --- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/ui/text/phpdoc/JavaDocAutoIndentStrategy.java +++ b/net.sourceforge.phpeclipse.ui/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.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.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 net.sourceforge.phpeclipse.ui.WebUI; -import org.eclipse.core.runtime.CoreException; +//import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.Preferences; import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.jface.text.BadLocationException; @@ -37,8 +37,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; @@ -175,24 +175,24 @@ public class JavaDocAutoIndentStrategy extends * 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); - } +// 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 = WebUI.getDefault() @@ -201,43 +201,43 @@ public class JavaDocAutoIndentStrategy extends .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 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 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 @@ -911,28 +911,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 = WebUI.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 = WebUI.getDefault() +// .getWorkingCopyManager(); +// ICompilationUnit unit = manager.getWorkingCopy(editor.getEditorInput()); +// if (unit == null) +// return null; +// +// return unit; +// } }