Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 77217 Details for
Bug 200067
[templates] code assist no longer suggests templates for method completions as it did in 3.2
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Fix
patch2.txt (text/plain), 7.57 KB, created by
Dani Megert
on 2007-08-29 04:02:52 EDT
(
hide
)
Description:
Fix
Filename:
MIME Type:
Creator:
Dani Megert
Created:
2007-08-29 04:02:52 EDT
Size:
7.57 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.ui >Index: core extension/org/eclipse/jdt/internal/corext/template/java/JavaContext.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/template/java/JavaContext.java,v >retrieving revision 1.75 >diff -u -r1.75 JavaContext.java >--- core extension/org/eclipse/jdt/internal/corext/template/java/JavaContext.java 29 May 2007 18:41:36 -0000 1.75 >+++ core extension/org/eclipse/jdt/internal/corext/template/java/JavaContext.java 29 Aug 2007 08:03:43 -0000 >@@ -205,7 +205,7 @@ > int start= getCompletionOffset(); > int end= getCompletionOffset() + getCompletionLength(); > >- while (start != 0 && isTempalteNamePart(document.getChar(start - 1))) >+ while (start != 0 && Character.isUnicodeIdentifierPart(document.getChar(start - 1))) > start--; > > while (start != end && Character.isWhitespace(document.getChar(start))) >@@ -221,17 +221,6 @@ > } > } > >- /** >- * Tells whether the given character can be part of a template name. >- * >- * @param ch the character to test >- * @return <code>true</code> if the given character can be part of a template name >- * @since 3.3 >- */ >- private boolean isTempalteNamePart(char ch) { >- return !Character.isWhitespace(ch) && ch != '(' && ch != ')' && ch != '{' && ch != '}' && ch != ';'; >- } >- > /* > * @see org.eclipse.jdt.internal.corext.template.DocumentTemplateContext#getEnd() > */ >Index: core extension/org/eclipse/jdt/internal/corext/template/java/JavaDocContext.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/template/java/JavaDocContext.java,v >retrieving revision 1.27 >diff -u -r1.27 JavaDocContext.java >--- core extension/org/eclipse/jdt/internal/corext/template/java/JavaDocContext.java 4 Sep 2006 13:23:34 -0000 1.27 >+++ core extension/org/eclipse/jdt/internal/corext/template/java/JavaDocContext.java 29 Aug 2007 08:03:43 -0000 >@@ -99,10 +99,10 @@ > if ((start != 0) && (document.getChar(start - 1) == HTML_TAG_END)) > start--; > >- while ((start != 0) && !Character.isWhitespace(document.getChar(start - 1))) >+ while ((start != 0) && Character.isUnicodeIdentifierPart(document.getChar(start - 1))) > start--; > >- if ((start != 0) && !Character.isWhitespace(document.getChar(start - 1))) >+ if ((start != 0) && Character.isUnicodeIdentifierStart(document.getChar(start - 1))) > start--; > > // include html and javadoc tags >@@ -120,7 +120,7 @@ > int start= getCompletionOffset(); > int end= getCompletionOffset() + getCompletionLength(); > >- while (start != 0 && !Character.isWhitespace(document.getChar(start - 1))) >+ while (start != 0 && Character.isUnicodeIdentifierPart(document.getChar(start - 1))) > start--; > > while (start != end && Character.isWhitespace(document.getChar(start))) >Index: ui/org/eclipse/jdt/internal/ui/preferences/PreferencesMessages.properties >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/PreferencesMessages.properties,v >retrieving revision 1.430.2.1 >diff -u -r1.430.2.1 PreferencesMessages.properties >--- ui/org/eclipse/jdt/internal/ui/preferences/PreferencesMessages.properties 26 Jul 2007 13:55:38 -0000 1.430.2.1 >+++ ui/org/eclipse/jdt/internal/ui/preferences/PreferencesMessages.properties 29 Aug 2007 08:03:44 -0000 >@@ -800,7 +800,7 @@ > > # edit template dialog > EditTemplateDialog_error_noname=Template name cannot be empty. >-EditTemplateDialog_error_spaces=Template name cannot contain spaces. >+EditTemplateDialog_error_spaces=Template name contains invalid characters. > EditTemplateDialog_title_new=New Template > EditTemplateDialog_title_edit=Edit Template > >Index: ui/org/eclipse/jdt/internal/ui/preferences/EditTemplateDialog.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/EditTemplateDialog.java,v >retrieving revision 1.86 >diff -u -r1.86 EditTemplateDialog.java >--- ui/org/eclipse/jdt/internal/ui/preferences/EditTemplateDialog.java 11 Dec 2006 10:33:22 -0000 1.86 >+++ ui/org/eclipse/jdt/internal/ui/preferences/EditTemplateDialog.java 29 Aug 2007 08:03:44 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2006 IBM Corporation and others. >+ * Copyright (c) 2000, 2007 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 >@@ -73,6 +73,8 @@ > import org.eclipse.ui.texteditor.ITextEditorActionConstants; > import org.eclipse.ui.texteditor.IUpdate; > >+import org.eclipse.jdt.internal.corext.template.java.JavaDocContextType; >+ > import org.eclipse.jdt.ui.IContextMenuConstants; > import org.eclipse.jdt.ui.PreferenceConstants; > import org.eclipse.jdt.ui.text.IJavaPartitions; >@@ -201,8 +203,7 @@ > public void create() { > super.create(); > updateStatusAndButtons(); >- boolean isEmpty= fNameText != null && fNameText.getText().length() == 0; >- getButton(IDialogConstants.OK_ID).setEnabled(!isEmpty); >+ getButton(IDialogConstants.OK_ID).setEnabled(getStatus().isOK()); > } > > /* >@@ -310,7 +311,7 @@ > protected void doTextWidgetChanged(Widget w) { > if (w == fNameText) { > fSuppressError= false; >- updateStatusAndButtons(); >+ updateStatusAndButtons(); > } else if (w == fContextCombo) { > String contextId= getContextId(); > fTemplateProcessor.setContextType(fContextTypeRegistry.getContextType(contextId)); >@@ -318,6 +319,7 @@ > String prefix= getPrefix(); > document.set(prefix + getPattern()); > fPatternEditor.setVisibleRegion(prefix.length(), document.getLength() - prefix.length()); >+ updateStatusAndButtons(); > } else if (w == fDescriptionText) { > // nothing > } >@@ -562,13 +564,43 @@ > if (!fSuppressError && isEmpty) { > status= new StatusInfo(); > status.setError(PreferencesMessages.EditTemplateDialog_error_noname); >- } else if (fNameText != null && fNameText.getText().indexOf(' ') > -1) { >+ } else if (fNameText != null && !isValidTemplateName(fNameText.getText())) { > status= new StatusInfo(); > status.setError(PreferencesMessages.EditTemplateDialog_error_spaces); > } > updateStatus(status); > } >- >+ >+ /** >+ * Checks whether the given string is a valid >+ * template name. >+ * >+ * @param name the string to test >+ * @return <code>true</code> if the name is valid >+ * @since 3.3.1 >+ */ >+ private boolean isValidTemplateName(String name) { >+ int nameLength= name.length(); >+ if (nameLength == 0) >+ return true; >+ >+ char firstChar= name.charAt(0); >+ boolean isJavadocTemplate= JavaDocContextType.NAME.equals(getContextId()); >+ if (!Character.isUnicodeIdentifierStart(firstChar) && !(isJavadocTemplate && (firstChar == '<' || firstChar == '@'))) >+ return false; >+ >+ if (nameLength == 1) >+ return true; >+ >+ for (int i= 1; i < nameLength - 1; i++) { >+ if (!Character.isUnicodeIdentifierPart(name.charAt(i))) >+ return false; >+ } >+ >+ char lastChar= name.charAt(nameLength - 1); >+ return Character.isUnicodeIdentifierPart(lastChar) || isJavadocTemplate && lastChar == '>'; >+ } >+ > /* > * @see org.eclipse.jface.window.Window#configureShell(Shell) > */
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 200067
: 77217