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 129638 Details for
Bug 241552
JavaScript function arguments should be displayed in the HTML editor
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Content assist in web pages now obeys the preference for adding method params
patchFor241552 (text/plain), 10.85 KB, created by
Chris Jaun
on 2009-03-23 16:30:53 EDT
(
hide
)
Description:
Content assist in web pages now obeys the preference for adding method params
Filename:
MIME Type:
Creator:
Chris Jaun
Created:
2009-03-23 16:30:53 EDT
Size:
10.85 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.wst.jsdt.ui >Index: src/org/eclipse/wst/jsdt/ui/text/java/CompletionProposalCollector.java >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/ui/text/java/CompletionProposalCollector.java,v >retrieving revision 1.6 >diff -u -r1.6 CompletionProposalCollector.java >--- src/org/eclipse/wst/jsdt/ui/text/java/CompletionProposalCollector.java 14 May 2008 15:44:20 -0000 1.6 >+++ src/org/eclipse/wst/jsdt/ui/text/java/CompletionProposalCollector.java 23 Mar 2009 20:30:25 -0000 >@@ -21,6 +21,7 @@ > import org.eclipse.core.runtime.IStatus; > import org.eclipse.core.runtime.Platform; > import org.eclipse.core.runtime.Status; >+import org.eclipse.jface.preference.IPreferenceStore; > import org.eclipse.jface.resource.ImageDescriptor; > import org.eclipse.jface.text.contentassist.IContextInformation; > import org.eclipse.swt.graphics.Image; >@@ -38,6 +39,7 @@ > import org.eclipse.wst.jsdt.internal.ui.text.java.AnonymousTypeCompletionProposal; > import org.eclipse.wst.jsdt.internal.ui.text.java.AnonymousTypeProposalInfo; > import org.eclipse.wst.jsdt.internal.ui.text.java.FieldProposalInfo; >+import org.eclipse.wst.jsdt.internal.ui.text.java.FilledArgumentNamesMethodProposal; > import org.eclipse.wst.jsdt.internal.ui.text.java.GetterSetterCompletionProposal; > import org.eclipse.wst.jsdt.internal.ui.text.java.JavaCompletionProposal; > import org.eclipse.wst.jsdt.internal.ui.text.java.JavaMethodCompletionProposal; >@@ -46,10 +48,12 @@ > import org.eclipse.wst.jsdt.internal.ui.text.java.MethodDeclarationCompletionProposal; > import org.eclipse.wst.jsdt.internal.ui.text.java.MethodProposalInfo; > import org.eclipse.wst.jsdt.internal.ui.text.java.OverrideCompletionProposal; >+import org.eclipse.wst.jsdt.internal.ui.text.java.ParameterGuessingProposal; > import org.eclipse.wst.jsdt.internal.ui.text.java.ProposalContextInformation; > import org.eclipse.wst.jsdt.internal.ui.text.javadoc.JavadocInlineTagCompletionProposal; > import org.eclipse.wst.jsdt.internal.ui.text.javadoc.JavadocLinkTypeCompletionProposal; > import org.eclipse.wst.jsdt.internal.ui.viewsupport.ImageDescriptorRegistry; >+import org.eclipse.wst.jsdt.ui.PreferenceConstants; > > /** > * JavaScript UI implementation of <code>CompletionRequestor</code>. Produces >@@ -724,7 +728,25 @@ > } > > private IJavaCompletionProposal createMethodReferenceProposal(CompletionProposal methodProposal) { >- LazyJavaCompletionProposal proposal= new JavaMethodCompletionProposal(methodProposal, getInvocationContext()); >+ IPreferenceStore preferenceStore= JavaScriptPlugin.getDefault().getPreferenceStore(); >+ LazyJavaCompletionProposal proposal = null; >+ >+ if(preferenceStore.getBoolean(PreferenceConstants.CODEASSIST_FILL_ARGUMENT_NAMES)) { >+ String completion= String.valueOf(methodProposal.getCompletion()); >+ // normal behavior if this is not a normal completion or has no parameters >+ if ((completion.length() == 0) || ((completion.length() == 1) && completion.charAt(0) == ')') || Signature.getParameterCount(methodProposal.getSignature()) == 0 || getContext().isInJsdoc()) { >+ proposal= new JavaMethodCompletionProposal(methodProposal, getInvocationContext()); >+ } else { >+ if (preferenceStore.getBoolean(PreferenceConstants.CODEASSIST_GUESS_METHOD_ARGUMENTS)) >+ proposal = new ParameterGuessingProposal(methodProposal, getInvocationContext()); >+ else >+ proposal = new FilledArgumentNamesMethodProposal(methodProposal, getInvocationContext()); >+ } >+ } >+ >+ if(proposal == null) >+ proposal= new JavaMethodCompletionProposal(methodProposal, getInvocationContext()); >+ > adaptLength(proposal, methodProposal); > return proposal; > } >Index: src/org/eclipse/wst/jsdt/internal/ui/text/java/JavaCompletionProposalComputer.java >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/ui/text/java/JavaCompletionProposalComputer.java,v >retrieving revision 1.6 >diff -u -r1.6 JavaCompletionProposalComputer.java >--- src/org/eclipse/wst/jsdt/internal/ui/text/java/JavaCompletionProposalComputer.java 14 May 2008 15:43:49 -0000 1.6 >+++ src/org/eclipse/wst/jsdt/internal/ui/text/java/JavaCompletionProposalComputer.java 23 Mar 2009 20:30:24 -0000 >@@ -218,10 +218,9 @@ > * Creates the collector used to get proposals from core. > */ > protected CompletionProposalCollector createCollector(JavaContentAssistInvocationContext context) { >- if (PreferenceConstants.getPreferenceStore().getBoolean(PreferenceConstants.CODEASSIST_FILL_ARGUMENT_NAMES)) >- return new FillArgumentNamesCompletionProposalCollector(context); >- else >- return new CompletionProposalCollector(context.getCompilationUnit()); >+ CompletionProposalCollector collector = new CompletionProposalCollector(context.getCompilationUnit()); >+ collector.setInvocationContext(context); >+ return collector; > } > > /* >Index: src/org/eclipse/wst/jsdt/internal/ui/text/java/FillArgumentNamesCompletionProposalCollector.java >=================================================================== >RCS file: src/org/eclipse/wst/jsdt/internal/ui/text/java/FillArgumentNamesCompletionProposalCollector.java >diff -N src/org/eclipse/wst/jsdt/internal/ui/text/java/FillArgumentNamesCompletionProposalCollector.java >--- src/org/eclipse/wst/jsdt/internal/ui/text/java/FillArgumentNamesCompletionProposalCollector.java 30 Apr 2008 21:32:13 -0000 1.5 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,114 +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.text.java; >- >-import org.eclipse.jface.preference.IPreferenceStore; >-import org.eclipse.wst.jsdt.core.CompletionProposal; >-import org.eclipse.wst.jsdt.core.IJavaScriptUnit; >-import org.eclipse.wst.jsdt.core.IJavaScriptProject; >-import org.eclipse.wst.jsdt.core.JavaScriptCore; >-import org.eclipse.wst.jsdt.core.Signature; >-import org.eclipse.wst.jsdt.internal.ui.JavaScriptPlugin; >-import org.eclipse.wst.jsdt.ui.PreferenceConstants; >-import org.eclipse.wst.jsdt.ui.text.java.CompletionProposalCollector; >-import org.eclipse.wst.jsdt.ui.text.java.IJavaCompletionProposal; >-import org.eclipse.wst.jsdt.ui.text.java.JavaContentAssistInvocationContext; >- >-/** >- * Completion proposal collector which creates proposals with >- * filled in argument names. >- * <p> >- * This collector is used when >- * {@link PreferenceConstants#CODEASSIST_FILL_ARGUMENT_NAMES} is enabled. >- * <p/> >- */ >-public final class FillArgumentNamesCompletionProposalCollector extends CompletionProposalCollector { >- >- private final boolean fIsGuessArguments; >- >- public FillArgumentNamesCompletionProposalCollector(JavaContentAssistInvocationContext context) { >- super(context.getCompilationUnit()); >- setInvocationContext(context); >- IPreferenceStore preferenceStore= JavaScriptPlugin.getDefault().getPreferenceStore(); >- fIsGuessArguments= preferenceStore.getBoolean(PreferenceConstants.CODEASSIST_GUESS_METHOD_ARGUMENTS); >- } >- >- /* >- * @see org.eclipse.wst.jsdt.internal.ui.text.java.ResultCollector#createJavaCompletionProposal(org.eclipse.wst.jsdt.core.CompletionProposal) >- */ >- protected IJavaCompletionProposal createJavaCompletionProposal(CompletionProposal proposal) { >- switch (proposal.getKind()) { >- case CompletionProposal.METHOD_REF: >- return createMethodReferenceProposal(proposal); >- case CompletionProposal.TYPE_REF: >- return createTypeProposal(proposal); >- default: >- return super.createJavaCompletionProposal(proposal); >- } >- } >- >- private IJavaCompletionProposal createMethodReferenceProposal(CompletionProposal methodProposal) { >- String completion= String.valueOf(methodProposal.getCompletion()); >- // super class' behavior if this is not a normal completion or has no >- // parameters >- if ((completion.length() == 0) || ((completion.length() == 1) && completion.charAt(0) == ')') || Signature.getParameterCount(methodProposal.getSignature()) == 0 || getContext().isInJsdoc()) >- return super.createJavaCompletionProposal(methodProposal); >- >- LazyJavaCompletionProposal proposal; >- IJavaScriptUnit compilationUnit= getCompilationUnit(); >- if (compilationUnit != null && fIsGuessArguments) >- proposal= new ParameterGuessingProposal(methodProposal, getInvocationContext()); >- else >- proposal= new FilledArgumentNamesMethodProposal(methodProposal, getInvocationContext()); >- return proposal; >- } >- >- /* >- * @see org.eclipse.wst.jsdt.internal.ui.text.java.ResultCollector#createTypeCompletion(org.eclipse.wst.jsdt.core.CompletionProposal) >- */ >- private IJavaCompletionProposal createTypeProposal(CompletionProposal typeProposal) { >- final IJavaScriptUnit cu= getCompilationUnit(); >- if (cu == null || getContext().isInJsdoc()) >- return super.createJavaCompletionProposal(typeProposal); >- >- IJavaScriptProject project= cu.getJavaScriptProject(); >- if (!shouldProposeGenerics(project)) >- return super.createJavaCompletionProposal(typeProposal); >- >- char[] completion= typeProposal.getCompletion(); >- // don't add parameters for import-completions nor for proposals with an empty completion (e.g. inside the type argument list) >- if (completion.length > 0 && (completion[completion.length - 1] == ';' || completion[completion.length - 1] == '.')) >- return super.createJavaCompletionProposal(typeProposal); >- >- LazyJavaCompletionProposal newProposal= new LazyGenericTypeProposal(typeProposal, getInvocationContext()); >- return newProposal; >- } >- >- /** >- * Returns <code>true</code> if generic proposals should be allowed, >- * <code>false</code> if not. Note that even though code (in a library) >- * may be referenced that uses generics, it is still possible that the >- * current source does not allow generics. >- * >- * @param project the Java project >- * @return <code>true</code> if the generic proposals should be allowed, >- * <code>false</code> if not >- */ >- private final boolean shouldProposeGenerics(IJavaScriptProject project) { >- String sourceVersion; >- if (project != null) >- sourceVersion= project.getOption(JavaScriptCore.COMPILER_SOURCE, true); >- else >- sourceVersion= JavaScriptCore.getOption(JavaScriptCore.COMPILER_SOURCE); >- >- return sourceVersion != null && JavaScriptCore.VERSION_1_5.compareTo(sourceVersion) <= 0; >- } >-}
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
Flags:
thatnitind
:
iplog+
Actions:
View
|
Diff
Attachments on
bug 241552
: 129638