X-Git-Url: http://git.phpeclipse.com diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/corext/template/php/JavaContext.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/corext/template/php/JavaContext.java index 0102646..c51573a 100644 --- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/corext/template/php/JavaContext.java +++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpdt/internal/corext/template/php/JavaContext.java @@ -10,22 +10,22 @@ *******************************************************************************/ package net.sourceforge.phpdt.internal.corext.template.php; -import java.lang.reflect.InvocationTargetException; +//import java.lang.reflect.InvocationTargetException; import net.sourceforge.phpdt.core.ICompilationUnit; -import net.sourceforge.phpdt.internal.corext.Assert; -import net.sourceforge.phpdt.internal.corext.template.php.CompilationUnitCompletion.LocalVariable; +//import net.sourceforge.phpdt.internal.corext.Assert; +//import net.sourceforge.phpdt.internal.corext.template.php.CompilationUnitCompletion.LocalVariable; import net.sourceforge.phpdt.internal.corext.util.Strings; import net.sourceforge.phpdt.internal.ui.preferences.CodeFormatterPreferencePage; import net.sourceforge.phpdt.internal.ui.text.template.contentassist.MultiVariable; -import net.sourceforge.phpdt.internal.ui.util.ExceptionHandler; +//import net.sourceforge.phpdt.internal.ui.util.ExceptionHandler; import net.sourceforge.phpeclipse.PHPeclipsePlugin; import net.sourceforge.phpeclipse.ui.WebUI; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; -import org.eclipse.jface.dialogs.MessageDialog; +//import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.jface.text.BadLocationException; import org.eclipse.jface.text.Document; @@ -37,7 +37,7 @@ import org.eclipse.jface.text.templates.TemplateContextType; import org.eclipse.jface.text.templates.TemplateException; import org.eclipse.jface.text.templates.TemplateTranslator; import org.eclipse.jface.text.templates.TemplateVariable; -import org.eclipse.swt.widgets.Shell; +//import org.eclipse.swt.widgets.Shell; /** * A context for java source. @@ -275,19 +275,19 @@ public class JavaContext extends CompilationUnitContext { } } - private static void handleException(Shell shell, Exception e) { - String title = JavaTemplateMessages - .getString("JavaContext.error.title"); //$NON-NLS-1$ - if (e instanceof CoreException) - ExceptionHandler.handle((CoreException) e, shell, title, null); - else if (e instanceof InvocationTargetException) - ExceptionHandler.handle((InvocationTargetException) e, shell, - title, null); - else { - PHPeclipsePlugin.log(e); - MessageDialog.openError(shell, title, e.getMessage()); - } - } +// private static void handleException(Shell shell, Exception e) { +// String title = JavaTemplateMessages +// .getString("JavaContext.error.title"); //$NON-NLS-1$ +// if (e instanceof CoreException) +// ExceptionHandler.handle((CoreException) e, shell, title, null); +// else if (e instanceof InvocationTargetException) +// ExceptionHandler.handle((InvocationTargetException) e, shell, +// title, null); +// else { +// PHPeclipsePlugin.log(e); +// MessageDialog.openError(shell, title, e.getMessage()); +// } +// } // private CompilationUnitCompletion getCompletion() { // ICompilationUnit compilationUnit= getCompilationUnit(); @@ -334,12 +334,12 @@ public class JavaContext extends CompilationUnitContext { // public String guessArrayType() { // return firstOrNull(guessArrayTypes()); // } - private String firstOrNull(String[] strings) { - if (strings.length > 0) - return strings[0]; - else - return null; - } +// private String firstOrNull(String[] strings) { +// if (strings.length > 0) +// return strings[0]; +// else +// return null; +// } /** * Returns the name of the type of a local array, null if no @@ -378,57 +378,57 @@ public class JavaContext extends CompilationUnitContext { // // return (String[]) ret.toArray(new String[ret.size()]); // } - private String getArrayTypeFromLocalArray( - CompilationUnitCompletion completion, LocalVariable array) { - String arrayTypeName = array.typeName; - String typeName = getScalarType(arrayTypeName); - int dimension = getArrayDimension(arrayTypeName) - 1; - Assert.isTrue(dimension >= 0); - - String qualifiedName = createQualifiedTypeName(array.typePackageName, - typeName); - String innerTypeName = completion.simplifyTypeName(qualifiedName); - - return innerTypeName == null ? createArray(typeName, dimension) - : createArray(innerTypeName, dimension); - } - - private static String createArray(String type, int dimension) { - StringBuffer buffer = new StringBuffer(type); - for (int i = 0; i < dimension; i++) - buffer.append("[]"); //$NON-NLS-1$ - return buffer.toString(); - } - - private static String getScalarType(String type) { - return type.substring(0, type.indexOf('[')); - } - - private static int getArrayDimension(String type) { - - int dimension = 0; - int index = type.indexOf('['); - - while (index != -1) { - dimension++; - index = type.indexOf('[', index + 1); - } - - return dimension; - } - - private static String createQualifiedTypeName(String packageName, - String className) { - StringBuffer buffer = new StringBuffer(); - - if (packageName.length() != 0) { - buffer.append(packageName); - buffer.append('.'); - } - buffer.append(className); - - return buffer.toString(); - } +// private String getArrayTypeFromLocalArray( +// CompilationUnitCompletion completion, LocalVariable array) { +// String arrayTypeName = array.typeName; +// String typeName = getScalarType(arrayTypeName); +// int dimension = getArrayDimension(arrayTypeName) - 1; +// Assert.isTrue(dimension >= 0); +// +// String qualifiedName = createQualifiedTypeName(array.typePackageName, +// typeName); +// String innerTypeName = completion.simplifyTypeName(qualifiedName); +// +// return innerTypeName == null ? createArray(typeName, dimension) +// : createArray(innerTypeName, dimension); +// } + +// private static String createArray(String type, int dimension) { +// StringBuffer buffer = new StringBuffer(type); +// for (int i = 0; i < dimension; i++) +// buffer.append("[]"); //$NON-NLS-1$ +// return buffer.toString(); +// } + +// private static String getScalarType(String type) { +// return type.substring(0, type.indexOf('[')); +// } + +// private static int getArrayDimension(String type) { +// +// int dimension = 0; +// int index = type.indexOf('['); +// +// while (index != -1) { +// dimension++; +// index = type.indexOf('[', index + 1); +// } +// +// return dimension; +// } + +// private static String createQualifiedTypeName(String packageName, +// String className) { +// StringBuffer buffer = new StringBuffer(); +// +// if (packageName.length() != 0) { +// buffer.append(packageName); +// buffer.append('.'); +// } +// buffer.append(className); +// +// return buffer.toString(); +// } /** * Returns a proposal for a variable name of a local array element,