Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst')
-rw-r--r--bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/StructuredTextViewerConfigurationJSDT.java5
-rw-r--r--bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/actions/messages.properties5
-rw-r--r--bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/contentassist/JSDTStructuredContentAssistProcessor.java47
-rw-r--r--bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/internal/JSPUIPluginResources.properties5
-rw-r--r--bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/internal/JsUIPlugin.java2
-rw-r--r--bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/internal/contentassist/JSDTCompletionProposal.java31
-rw-r--r--bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/internal/contentassist/JSDTContentAssistantProcessor.java5
-rw-r--r--bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/internal/contentassist/JSDTProposalCollector.java12
-rw-r--r--bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/internal/contentassist/messages.properties5
-rw-r--r--bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/internal/debug/JSBreakpointProvider.java135
-rw-r--r--bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/internal/format/FormattingStrategyJSDT.java16
-rw-r--r--bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/internal/hyperlink/ExternalFileHyperlink.java2
-rw-r--r--bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/internal/hyperlink/JSDTHyperlinkDetector.java54
-rw-r--r--bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/internal/java/refactoring/JSPJavaSelectionProvider.java4
-rw-r--r--bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/internal/java/search/JsFindOccurrencesProcessor.java5
-rw-r--r--bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/internal/java/search/JsOccurrencesSearchResult.java2
-rw-r--r--bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/internal/java/search/JsSearchQuery.java13
-rw-r--r--bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/internal/style/java/JSDTCodeScanner.java7
-rw-r--r--bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/internal/taginfo/JSDTHoverProcessor.java57
-rw-r--r--bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/internal/text/JsCharacterPairInserter.java1
-rw-r--r--bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/messages.properties5
-rw-r--r--bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/views/contentoutline/JFaceNodeAdapterForJs.java6
-rw-r--r--bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/views/contentoutline/messages.properties5
-rw-r--r--bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/views/provisional/contentoutline/JFaceNodeAdapterForJs.java5
24 files changed, 186 insertions, 248 deletions
diff --git a/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/StructuredTextViewerConfigurationJSDT.java b/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/StructuredTextViewerConfigurationJSDT.java
index a1d8070fbf..f664454fe2 100644
--- a/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/StructuredTextViewerConfigurationJSDT.java
+++ b/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/StructuredTextViewerConfigurationJSDT.java
@@ -11,6 +11,7 @@
package org.eclipse.wst.jsdt.web.ui;
import org.eclipse.jface.text.IAutoEditStrategy;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
import org.eclipse.jface.text.source.ISourceViewer;
import org.eclipse.wst.html.core.text.IHTMLPartitions;
import org.eclipse.wst.html.ui.StructuredTextViewerConfigurationHTML;
@@ -54,4 +55,8 @@ public class StructuredTextViewerConfigurationJSDT extends StructuredTextViewerC
return super.getAutoEditStrategies(sourceViewer, contentType);
}
}
+
+ protected IContentAssistProcessor[] getContentAssistProcessors(ISourceViewer sourceViewer, String partitionType) {
+ return super.getContentAssistProcessors(sourceViewer, partitionType);
+ }
}
diff --git a/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/actions/messages.properties b/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/actions/messages.properties
index c89b7618ee..15a50f2ff2 100644
--- a/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/actions/messages.properties
+++ b/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/actions/messages.properties
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright (c) 2007 IBM Corporation and others.
+# Copyright (c) 2007, 2011 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
@@ -8,6 +8,9 @@
# Contributors:
# IBM Corporation - initial API and implementation
###############################################################################
+# NLS_ENCODING=UTF-8
+# NLS_MESSAGEFORMAT_NONE
+
StandardEditorActionsAction.8=Error in Standard Editor Action :
StandardEditorActionsAction.9=Insert Text
StandardEditorActionsAction.10=before
diff --git a/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/contentassist/JSDTStructuredContentAssistProcessor.java b/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/contentassist/JSDTStructuredContentAssistProcessor.java
new file mode 100644
index 0000000000..1074790448
--- /dev/null
+++ b/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/contentassist/JSDTStructuredContentAssistProcessor.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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.web.ui.contentassist;
+
+import org.eclipse.jface.text.ITextViewer;
+import org.eclipse.jface.text.contentassist.ContentAssistant;
+import org.eclipse.jface.util.PropertyChangeEvent;
+import org.eclipse.wst.jsdt.ui.PreferenceConstants;
+import org.eclipse.wst.sse.ui.contentassist.StructuredContentAssistProcessor;
+
+/**
+ * @deprecated - use proposal computers instead
+ */
+public class JSDTStructuredContentAssistProcessor extends StructuredContentAssistProcessor {
+ /**
+ * @param assistant {@link ContentAssistant} to use
+ * @param partitionTypeID the Javascript partition type this processor is for
+ * @param viewer {@link ITextViewer} this processor is acting in
+ */
+ public JSDTStructuredContentAssistProcessor(ContentAssistant assistant,
+ String partitionTypeID, ITextViewer viewer) {
+ super(assistant, partitionTypeID, viewer, PreferenceConstants.getPreferenceStore());
+
+ }
+
+ /**
+ * @see org.eclipse.wst.sse.ui.contentassist.StructuredContentAssistProcessor#getCompletionProposalAutoActivationCharacters()
+ */
+ public char[] getCompletionProposalAutoActivationCharacters() {
+ return super.getCompletionProposalAutoActivationCharacters() != null ? super.getCompletionProposalAutoActivationCharacters() : new char[0];
+
+ }
+
+ /**
+ * @see org.eclipse.wst.sse.ui.contentassist.StructuredContentAssistProcessor#propertyChange(
+ * org.eclipse.jface.util.PropertyChangeEvent)
+ */
+ public void propertyChange(PropertyChangeEvent event) {}
+}
diff --git a/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/internal/JSPUIPluginResources.properties b/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/internal/JSPUIPluginResources.properties
index 2cb5d2733c..c1e0e5cab0 100644
--- a/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/internal/JSPUIPluginResources.properties
+++ b/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/internal/JSPUIPluginResources.properties
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright (c) 2004, 2007 IBM Corporation and others.
+# Copyright (c) 2004, 2011 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
@@ -8,6 +8,9 @@
# Contributors:
# IBM Corporation - initial API and implementation
###############################################################################
+# NLS_ENCODING=UTF-8
+# NLS_MESSAGEFORMAT_VAR
+
## The following line is a sample JSP document. Please translate only the following parts:
## Use below tags ONLY for JSP 1.1
## Welcome!
diff --git a/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/internal/JsUIPlugin.java b/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/internal/JsUIPlugin.java
index 70b836d4b3..891c549f59 100644
--- a/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/internal/JsUIPlugin.java
+++ b/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/internal/JsUIPlugin.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2008 IBM Corporation and others.
+ * Copyright (c) 2004, 2009 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
diff --git a/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/internal/contentassist/JSDTCompletionProposal.java b/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/internal/contentassist/JSDTCompletionProposal.java
index 2204dfe088..15b4f3504f 100644
--- a/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/internal/contentassist/JSDTCompletionProposal.java
+++ b/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/internal/contentassist/JSDTCompletionProposal.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2012 IBM Corporation and others.
+ * Copyright (c) 2007, 2011 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
@@ -18,8 +18,9 @@ import org.eclipse.jface.text.contentassist.ICompletionProposalExtension5;
import org.eclipse.jface.text.contentassist.IContextInformation;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
+import org.eclipse.wst.jsdt.internal.ui.text.java.AbstractJavaCompletionProposal;
import org.eclipse.wst.jsdt.internal.ui.text.java.JavaCompletionProposal;
-import org.eclipse.wst.jsdt.internal.ui.text.java.LazyJavaTypeCompletionProposal;
+import org.eclipse.wst.jsdt.internal.ui.text.java.LazyJavaCompletionProposal;
import org.eclipse.wst.jsdt.ui.text.java.IJavaCompletionProposal;
/**
@@ -56,12 +57,12 @@ public class JSDTCompletionProposal extends JavaCompletionProposal implements IJ
* <p>Uses the wrapped proposal if its lazy</p>
*/
public void apply(ITextViewer viewer, char trigger, int stateMask, int offset) {
-// if (this.fJavaCompletionProposal instanceof LazyJavaCompletionProposal) {
-// ((LazyJavaCompletionProposal) this.fJavaCompletionProposal).apply(viewer, trigger, stateMask, offset);
-// }
-// else {
+ if (this.fJavaCompletionProposal instanceof LazyJavaCompletionProposal) {
+ ((LazyJavaCompletionProposal) this.fJavaCompletionProposal).apply(viewer, trigger, stateMask, offset);
+ }
+ else {
super.apply(viewer, trigger, stateMask, offset);
-// }
+ }
}
/**
@@ -71,12 +72,12 @@ public class JSDTCompletionProposal extends JavaCompletionProposal implements IJ
*/
public Point getSelection(IDocument document) {
Point selection;
-// if (this.fJavaCompletionProposal instanceof LazyJavaCompletionProposal) {
-// selection = this.fJavaCompletionProposal.getSelection(document);
-// }
-// else {
+ if (this.fJavaCompletionProposal instanceof LazyJavaCompletionProposal) {
+ selection = this.fJavaCompletionProposal.getSelection(document);
+ }
+ else {
selection = super.getSelection(document);
-// }
+ }
return selection;
}
@@ -106,9 +107,9 @@ public class JSDTCompletionProposal extends JavaCompletionProposal implements IJ
fJavaCompletionProposal = javaCompletionProposal;
}
- protected boolean isValidPrefix(String prefix) {
- if (this.fJavaCompletionProposal instanceof LazyJavaTypeCompletionProposal) {
- return ((LazyJavaTypeCompletionProposal) this.fJavaCompletionProposal).isValidTypePrefix(prefix);
+ public boolean isValidPrefix(String prefix) {
+ if (this.fJavaCompletionProposal instanceof AbstractJavaCompletionProposal) {
+ return ((AbstractJavaCompletionProposal) this.fJavaCompletionProposal).isValidPrefix(prefix);
}
return super.isValidPrefix(prefix);
}
diff --git a/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/internal/contentassist/JSDTContentAssistantProcessor.java b/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/internal/contentassist/JSDTContentAssistantProcessor.java
index 9ada6ea775..73f21f7fe8 100644
--- a/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/internal/contentassist/JSDTContentAssistantProcessor.java
+++ b/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/internal/contentassist/JSDTContentAssistantProcessor.java
@@ -16,8 +16,8 @@ import org.eclipse.jface.text.ITextViewer;
import org.eclipse.jface.text.contentassist.ICompletionProposal;
import org.eclipse.wst.jsdt.core.IJavaScriptUnit;
import org.eclipse.wst.jsdt.web.core.javascript.IJsTranslation;
-import org.eclipse.wst.jsdt.web.core.javascript.JsTranslation;
import org.eclipse.wst.jsdt.web.core.javascript.JsTranslationAdapter;
+import org.eclipse.wst.jsdt.web.core.javascript.JsTranslationAdapterFactory;
import org.eclipse.wst.jsdt.web.ui.internal.JsUIMessages;
import org.eclipse.wst.sse.core.StructuredModelManager;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument;
@@ -72,11 +72,12 @@ public class JSDTContentAssistantProcessor extends AbstractContentAssistProcesso
fViewer = viewer;
xmlModel = (IDOMModel) StructuredModelManager.getModelManager().getExistingModelForRead(fViewer.getDocument());
IDOMDocument xmlDoc = xmlModel.getDocument();
+ JsTranslationAdapterFactory.setupAdapterFactory(xmlModel);
JsTranslationAdapter translationAdapter = (JsTranslationAdapter) xmlDoc.getAdapterFor(IJsTranslation.class);
if (translationAdapter != null) {
IJsTranslation translation = translationAdapter.getJsTranslation(true);
- fJavaPosition = ((JsTranslation)translation).getJavaScriptOffset(getDocumentPosition());
+ fJavaPosition = translation.getJavaScriptOffset(getDocumentPosition());
try {
IJavaScriptUnit cu = translation.getCompilationUnit();
// can't get java proposals w/out a compilation unit
diff --git a/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/internal/contentassist/JSDTProposalCollector.java b/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/internal/contentassist/JSDTProposalCollector.java
index cc7b354150..5c273b8800 100644
--- a/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/internal/contentassist/JSDTProposalCollector.java
+++ b/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/internal/contentassist/JSDTProposalCollector.java
@@ -23,7 +23,6 @@ import org.eclipse.wst.jsdt.ui.text.java.CompletionProposalCollector;
import org.eclipse.wst.jsdt.ui.text.java.CompletionProposalComparator;
import org.eclipse.wst.jsdt.ui.text.java.IJavaCompletionProposal;
import org.eclipse.wst.jsdt.web.core.javascript.IJsTranslation;
-import org.eclipse.wst.jsdt.web.core.javascript.JsTranslation;
/**
@@ -91,10 +90,15 @@ public class JSDTProposalCollector extends CompletionProposalCollector {
private JSDTCompletionProposal createJSDTProposal(CompletionProposal proposal) {
JSDTCompletionProposal jspProposal;
String completion = String.valueOf(proposal.getCompletion());
- // java offset
- int offset = ((JsTranslation)fTranslation).getWebPageOffset(proposal.getReplaceStart());
+
+ int webStart = fTranslation.getWebPageOffset(proposal.getReplaceStart());
+ int webLength = proposal.getReplaceEnd() - proposal.getReplaceStart();
+ proposal.setReplaceRange(webStart, webStart+webLength);
+
+ // javascript offset
+ int offset = proposal.getReplaceStart();
// replacement length
- int length = proposal.getReplaceEnd() - proposal.getReplaceStart();
+ int length = proposal.getReplaceEnd() - offset;
// translate offset from Java > JSP
// cursor position after must be calculated
int positionAfter = calculatePositionAfter(proposal, completion);
diff --git a/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/internal/contentassist/messages.properties b/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/internal/contentassist/messages.properties
index fbdf80852c..827f312536 100644
--- a/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/internal/contentassist/messages.properties
+++ b/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/internal/contentassist/messages.properties
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright (c) 2007 IBM Corporation and others.
+# Copyright (c) 2007, 2011 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
@@ -8,6 +8,9 @@
# Contributors:
# IBM Corporation - initial API and implementation
###############################################################################
+# NLS_ENCODING=UTF-8
+# NLS_MESSAGEFORMAT_NONE
+
JSDTHtmlCompletionProcessor.1=<> end with </script>
JSDTHtmlCompletionProcessor.4=Close the script tag.
JSDTHtmlCompletionProcessor.5=<> end with </script>
diff --git a/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/internal/debug/JSBreakpointProvider.java b/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/internal/debug/JSBreakpointProvider.java
deleted file mode 100644
index b723c24601..0000000000
--- a/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/internal/debug/JSBreakpointProvider.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011, 2012 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.web.ui.internal.debug;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.debug.ui.actions.IToggleBreakpointsTargetExtension;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.ITextSelection;
-import org.eclipse.jface.text.ITypedRegion;
-import org.eclipse.jface.text.TextSelection;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IEditorReference;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.wst.jsdt.web.ui.internal.Logger;
-import org.eclipse.wst.sse.ui.internal.provisional.extensions.ISourceEditingTextTools;
-import org.eclipse.wst.sse.ui.internal.provisional.extensions.breakpoint.IBreakpointProvider;
-
-public class JSBreakpointProvider implements IBreakpointProvider {
-
- private static final String SCRIPT_REGION = "org.eclipse.wst.html.SCRIPT"; //$NON-NLS-1$
- private static final String EXTENSION_POINT = "org.eclipse.wst.jsdt.web.ui.breakpointAdapter";
- IToggleBreakpointsTargetExtension[] fDelegates;
- private IEditorPart fPart;
- private ITextSelection fSelection;
-
- public JSBreakpointProvider() {
- }
-
- IToggleBreakpointsTargetExtension[] getDelegates() {
- if (fDelegates == null) {
- IConfigurationElement[] configurationElements = Platform.getExtensionRegistry().getConfigurationElementsFor(EXTENSION_POINT);
- List adapters = new ArrayList();
- for (int i = 0; i < configurationElements.length; i++) {
- Object o = null;
- try {
- o = configurationElements[i].createExecutableExtension("class");
- }
- catch (CoreException e) {
- Logger.logException(e);
- }
- if (o instanceof IToggleBreakpointsTargetExtension) {
- adapters.add(o);
- }
- }
- fDelegates = (IToggleBreakpointsTargetExtension[]) adapters.toArray(new IToggleBreakpointsTargetExtension[adapters.size()]);
- }
- return fDelegates;
- }
-
- public IStatus addBreakpoint(IDocument document, IEditorInput input, int editorLineNumber, int offset) throws CoreException {
- final IResource resource = getResource(input);
- IWorkbenchPart part = fPart == null ? getPart(input) : fPart;
- if (resource != null && offset > -1 && part != null) {
- IToggleBreakpointsTargetExtension[] delegates = getDelegates();
- if (delegates.length > 0) {
- try {
- ITextSelection selection = fSelection != null ? fSelection : new TextSelection(document.getLineOffset(editorLineNumber - 1) + offset, 1);
- ITypedRegion[] partitions = document.computePartitioning(selection.getOffset(), selection.getLength());
- boolean scriptSectionFound = false;
- for (int i = 0; i < partitions.length; i++) {
- scriptSectionFound |= SCRIPT_REGION.equals(partitions[i].getType());
- }
- if (scriptSectionFound) {
- for (int i = 0; i < delegates.length; i++) {
- delegates[i].toggleLineBreakpoints(part, selection);
- }
- }
- }
- catch (BadLocationException e) {
- }
- }
- }
- fPart = null;
- fSelection = null;
- return Status.OK_STATUS;
- }
-
- private IWorkbenchPart getPart(IEditorInput input) throws PartInitException {
- IWorkbenchWindow[] workbenchWindows = PlatformUI.getWorkbench().getWorkbenchWindows();
- for (int i = 0; i < workbenchWindows.length; i++) {
- IWorkbenchPage[] pages = workbenchWindows[i].getPages();
- for (int j = 0; j < pages.length; j++) {
- IEditorReference[] editorReferences = pages[j].getEditorReferences();
- for (int k = 0; k < editorReferences.length; k++) {
- if (editorReferences[k].getEditorInput() == input)
- return editorReferences[k].getPart(false);
- }
- }
- }
- return null;
- }
-
- public IResource getResource(IEditorInput input) {
- IResource resource = (IResource) input.getAdapter(IFile.class);
- if (resource == null) {
- resource = (IResource) input.getAdapter(IResource.class);
- }
- if (resource == null) {
- resource = ResourcesPlugin.getWorkspace().getRoot();
- }
- return resource;
- }
-
- public void setSourceEditingTextTools(ISourceEditingTextTools tool) {
- if (tool != null) {
- fPart = tool.getEditorPart();
- fSelection = tool.getSelection();
- }
- }
-
-}
diff --git a/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/internal/format/FormattingStrategyJSDT.java b/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/internal/format/FormattingStrategyJSDT.java
index cb3e189ffa..bb1bf9f388 100644
--- a/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/internal/format/FormattingStrategyJSDT.java
+++ b/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/internal/format/FormattingStrategyJSDT.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2013 IBM Corporation and others.
+ * Copyright (c) 2007, 2012 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
@@ -106,14 +106,13 @@ public class FormattingStrategyJSDT extends ContextBasedFormattingStrategy {
final TypedPosition partition = (TypedPosition) fPartitions.removeFirst();
if (document != null) {
- final Map preferences = getProjectOptions(document);
//calculate the indent of the leading <script> tag because we need to add that indent level to the JS indent level
IStructuredDocumentRegion scriptTagStartRegion = document.getRegionAtCharacterOffset(partition.offset-1);
String scriptRegionIndent = ""; //$NON-NLS-1$
if(scriptTagStartRegion != null) {
try {
int scriptRegionIndentLevel = getIndentOfLine(document,document.getLineOfOffset(scriptTagStartRegion.getStartOffset())).length();
- scriptRegionIndent = getIndentationString(preferences, scriptRegionIndentLevel);
+ scriptRegionIndent = getIndentationString(getPreferences(), scriptRegionIndentLevel);
this.startIndentLevel += scriptRegionIndentLevel;
} catch (BadLocationException e) {
Logger.logException("Could not calculate starting indent of the script region, using 0", e);//$NON-NLS-1$
@@ -164,14 +163,14 @@ public class FormattingStrategyJSDT extends ContextBasedFormattingStrategy {
* Set a default replace text that is the original contents
* with a new line and proper indentation in front
*/
- String replaceText = lineDelim + getIndentationString(preferences, startIndentLevel) + jsTextNotTranslated;
+ String replaceText = lineDelim + getIndentationString(getPreferences(), startIndentLevel) + jsTextNotTranslated;
int javaScriptOffset = ((JsTranslation) translation).getJavaScriptOffset(partition.getOffset());
// known range, proceed
if (javaScriptOffset >= 0) {
// format the translated text
- TextEdit edit = CodeFormatterUtil.format2(CodeFormatter.K_JAVASCRIPT_UNIT, jsTextTranslated, javaScriptOffset, scriptLength, startIndentLevel, lineDelim, preferences);
+ TextEdit edit = CodeFormatterUtil.format2(CodeFormatter.K_JAVASCRIPT_UNIT, jsTextTranslated, javaScriptOffset, scriptLength, startIndentLevel, lineDelim, getPreferences());
IDocument jsDoc = new Document(jsTextTranslated);
if (edit != null) {
@@ -203,7 +202,7 @@ public class FormattingStrategyJSDT extends ContextBasedFormattingStrategy {
}
edit.apply(jsDoc);
- replaceText = lineDelim + getIndentationString(preferences, startIndentLevel) + (jsDoc.get(edit.getOffset(), edit.getLength())).trim();
+ replaceText = lineDelim + getIndentationString(getPreferences(), startIndentLevel) + (jsDoc.get(edit.getOffset(), edit.getLength())).trim();
}
else {
/*
@@ -233,6 +232,11 @@ public class FormattingStrategyJSDT extends ContextBasedFormattingStrategy {
fPartitions.addLast(context.getProperty(FormattingContextProperties.CONTEXT_PARTITION));
fDocuments.addLast(context.getProperty(FormattingContextProperties.CONTEXT_MEDIUM));
startIndentLevel = FormattingStrategyJSDT.regionStartIndentLevel + 0;
+ Map projectOptions = (Map) context.getProperty(FormattingContextProperties.CONTEXT_PREFERENCES);
+ if (projectOptions == null) {
+ IDocument doc = (IDocument) context.getProperty(FormattingContextProperties.CONTEXT_MEDIUM);
+ context.setProperty(FormattingContextProperties.CONTEXT_PREFERENCES, getProjectOptions(doc));
+ }
super.formatterStarts(context);
}
diff --git a/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/internal/hyperlink/ExternalFileHyperlink.java b/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/internal/hyperlink/ExternalFileHyperlink.java
index d8905ef9f1..1182119453 100644
--- a/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/internal/hyperlink/ExternalFileHyperlink.java
+++ b/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/internal/hyperlink/ExternalFileHyperlink.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 IBM Corporation and others.
+ * Copyright (c) 2007, 2009 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
diff --git a/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/internal/hyperlink/JSDTHyperlinkDetector.java b/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/internal/hyperlink/JSDTHyperlinkDetector.java
index 6011638fbf..fd0bb7efc3 100644
--- a/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/internal/hyperlink/JSDTHyperlinkDetector.java
+++ b/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/internal/hyperlink/JSDTHyperlinkDetector.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2009 IBM Corporation and others.
+ * Copyright (c) 2007, 2012 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
@@ -21,6 +21,7 @@ import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.ITextViewer;
+import org.eclipse.jface.text.ITypedRegion;
import org.eclipse.jface.text.Region;
import org.eclipse.jface.text.hyperlink.AbstractHyperlinkDetector;
import org.eclipse.jface.text.hyperlink.IHyperlink;
@@ -35,7 +36,6 @@ import org.eclipse.wst.jsdt.core.ISourceReference;
import org.eclipse.wst.jsdt.core.JavaScriptModelException;
import org.eclipse.wst.jsdt.internal.core.JavaElement;
import org.eclipse.wst.jsdt.web.core.javascript.IJsTranslation;
-import org.eclipse.wst.jsdt.web.core.javascript.JsTranslation;
import org.eclipse.wst.jsdt.web.core.javascript.JsTranslationAdapter;
import org.eclipse.wst.jsdt.web.ui.internal.Logger;
import org.eclipse.wst.sse.core.StructuredModelManager;
@@ -52,7 +52,9 @@ import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel;
* (repeatedly) as the API evolves.
*/
public class JSDTHyperlinkDetector extends AbstractHyperlinkDetector {
- private IHyperlink createHyperlink(IJavaScriptElement element, IRegion region, IDocument document) {
+ private static final String[] PARTITION_TYPES= new String[] {"org.eclipse.wst.html.SCRIPT","org.eclipse.wst.html.SCRIPT.EVENTHANDLER"}; //$NON-NLS-1$ //$NON-NLS-2$
+
+ private IHyperlink createHyperlink(IJsTranslation jsTranslation, IJavaScriptElement element, IRegion region, IDocument document) {
IHyperlink link = null;
if (region != null) {
// open local variable in the JSP file...
@@ -80,13 +82,12 @@ public class JSDTHyperlinkDetector extends AbstractHyperlinkDetector {
// get Java range, translate coordinate to JSP
try {
ISourceRange range = null;
- IJsTranslation jspTranslation = getJsTranslation(document);
- if (jspTranslation != null) {
+ if (jsTranslation != null) {
// link to local variable definitions
if (element instanceof ILocalVariable) {
range = ((ILocalVariable) element).getNameRange();
IJavaScriptElement unit=((ILocalVariable) element).getParent();
- IJavaScriptUnit myUnit = jspTranslation.getCompilationUnit();
+ IJavaScriptUnit myUnit = jsTranslation.getCompilationUnit();
while(!(unit instanceof IJavaScriptUnit || unit instanceof IClassFile || unit==null)) {
unit = ((JavaElement) unit).getParent();
@@ -113,14 +114,14 @@ public class JSDTHyperlinkDetector extends AbstractHyperlinkDetector {
// linking to fields of the same compilation unit
else if (element.getElementType() == IJavaScriptElement.FIELD) {
Object cu = ((IField) element).getJavaScriptUnit();
- if (cu != null && cu.equals(jspTranslation.getCompilationUnit())) {
+ if (cu != null && cu.equals(jsTranslation.getCompilationUnit())) {
range = ((ISourceReference) element).getSourceRange();
}
}
// linking to methods of the same compilation unit
else if (element.getElementType() == IJavaScriptElement.METHOD) {
Object cu = ((IFunction) element).getJavaScriptUnit();
- if (cu != null && cu.equals(jspTranslation.getCompilationUnit())) {
+ if (cu != null && cu.equals(jsTranslation.getCompilationUnit())) {
range = ((ISourceReference) element).getSourceRange();
}
}
@@ -157,22 +158,37 @@ public class JSDTHyperlinkDetector extends AbstractHyperlinkDetector {
List hyperlinks = new ArrayList(0);
if (region != null && textViewer != null) {
IDocument document = textViewer.getDocument();
- IJsTranslation jsTranslation = getJsTranslation(document);
- if (jsTranslation != null) {
- IJavaScriptElement[] elements = ((JsTranslation)jsTranslation).getElementsFromWebRange(region.getOffset(), region.getOffset() + region.getLength());
- if (elements != null && elements.length > 0) {
- // create a hyperlink for each JavaScript element
- for (int i = 0; i < elements.length; ++i) {
- IJavaScriptElement element = elements[i];
- // find hyperlink range for Java element
+ try {
+ boolean proceed = false;
+ ITypedRegion[] partitions = document.computePartitioning(region.getOffset(), region.getLength());
+ for (int i = 0; i < partitions.length; i++) {
+ for (int j = 0; j < PARTITION_TYPES.length; j++) {
+ if (PARTITION_TYPES[j].equals(partitions[i].getType())) {
+ proceed = true;
+ }
+ }
+ }
+ if (proceed) {
+ IJsTranslation jsTranslation = getJsTranslation(document);
+ if (jsTranslation != null) {
+ // find hyperlink range for JavaScript elements
IRegion hyperlinkRegion = selectWord(document, region.getOffset());
- IHyperlink link = createHyperlink(element, hyperlinkRegion, document);
- if (link != null) {
- hyperlinks.add(link);
+ IJavaScriptElement[] elements = jsTranslation.getElementsFromJsRange(jsTranslation.getJavaScriptOffset(region.getOffset()), jsTranslation.getJavaScriptOffset(region.getOffset() + region.getLength()));
+ if (elements != null && elements.length > 0) {
+ // create a hyperlink for each JavaScript element
+ for (int i = 0; i < elements.length; ++i) {
+ IJavaScriptElement element = elements[i];
+ IHyperlink link = createHyperlink(jsTranslation, element, hyperlinkRegion, document);
+ if (link != null) {
+ hyperlinks.add(link);
+ }
+ }
}
}
}
}
+ catch (BadLocationException e) {
+ }
}
if (hyperlinks.size() == 0) {
return null;
diff --git a/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/internal/java/refactoring/JSPJavaSelectionProvider.java b/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/internal/java/refactoring/JSPJavaSelectionProvider.java
index d671fcf160..47cb8469a3 100644
--- a/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/internal/java/refactoring/JSPJavaSelectionProvider.java
+++ b/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/internal/java/refactoring/JSPJavaSelectionProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2001, 2008 IBM Corporation and others.
+ * Copyright (c) 2001, 2012 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
@@ -47,7 +47,7 @@ class JSPJavaSelectionProvider {
JsTranslationAdapter adapter = (JsTranslationAdapter) xmlDoc.getAdapterFor(IJsTranslation.class);
if (adapter != null) {
IJsTranslation translation = adapter.getJsTranslation(true);
- elements = translation.getElementsFromJsRange(textSelection.getOffset(), textSelection.getOffset() + textSelection.getLength());
+ elements = translation.getElementsFromJsRange(translation.getJavaScriptOffset(textSelection.getOffset()), translation.getJavaScriptOffset(textSelection.getOffset() + textSelection.getLength()));
}
}
} finally {
diff --git a/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/internal/java/search/JsFindOccurrencesProcessor.java b/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/internal/java/search/JsFindOccurrencesProcessor.java
index 7e4cc6a3f4..93ddffc77c 100644
--- a/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/internal/java/search/JsFindOccurrencesProcessor.java
+++ b/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/internal/java/search/JsFindOccurrencesProcessor.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2010 IBM Corporation and others.
+ * Copyright (c) 2005, 2012 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
@@ -17,7 +17,6 @@ import org.eclipse.jface.text.ITextSelection;
import org.eclipse.search.ui.ISearchQuery;
import org.eclipse.wst.jsdt.core.IJavaScriptElement;
import org.eclipse.wst.jsdt.web.core.javascript.IJsTranslation;
-import org.eclipse.wst.jsdt.web.core.javascript.JsTranslation;
import org.eclipse.wst.jsdt.web.core.javascript.JsTranslationAdapter;
import org.eclipse.wst.jsdt.web.core.text.IJsPartitions;
import org.eclipse.wst.sse.core.StructuredModelManager;
@@ -58,7 +57,7 @@ public class JsFindOccurrencesProcessor extends FindOccurrencesProcessor {
if (adapter != null) {
IJsTranslation translation = adapter.getJsTranslation(false);
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=102211
- elements = ((JsTranslation)translation).getElementsFromWebRange(selection.getOffset(), selection.getOffset() + selection.getLength());
+ elements = translation.getElementsFromJsRange(translation.getJavaScriptOffset(selection.getOffset()), translation.getJavaScriptOffset(selection.getOffset() + selection.getLength()));
}
}
} finally {
diff --git a/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/internal/java/search/JsOccurrencesSearchResult.java b/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/internal/java/search/JsOccurrencesSearchResult.java
index 504987ec64..6c87301c27 100644
--- a/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/internal/java/search/JsOccurrencesSearchResult.java
+++ b/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/internal/java/search/JsOccurrencesSearchResult.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2007 IBM Corporation and others.
+ * Copyright (c) 2004, 2009 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
diff --git a/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/internal/java/search/JsSearchQuery.java b/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/internal/java/search/JsSearchQuery.java
index d3807e0220..e38fba7dc9 100644
--- a/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/internal/java/search/JsSearchQuery.java
+++ b/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/internal/java/search/JsSearchQuery.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2008 IBM Corporation and others.
+ * Copyright (c) 2004, 2012 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
@@ -22,22 +22,13 @@ import org.eclipse.wst.jsdt.web.core.javascript.search.JsSearchSupport;
import org.eclipse.wst.jsdt.web.ui.internal.JsUIMessages;
import org.eclipse.wst.sse.ui.internal.search.BasicSearchQuery;
-/**
-*
-
-* Provisional API: This class/interface is part of an interim API that is still under development and expected to
-* change significantly before reaching stability. It is being made available at this early stage to solicit feedback
-* from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken
-* (repeatedly) as the API evolves.
-*
- * @author pavery
- */
public class JsSearchQuery extends BasicSearchQuery {
/** the IJavaScriptElement we are searching for in the file * */
private IJavaScriptElement fElement = null;
public JsSearchQuery(IFile file, IJavaScriptElement element) {
super(file);
+ super.setResult(new JsOccurrencesSearchResult(this));
this.fElement = element;
}
diff --git a/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/internal/style/java/JSDTCodeScanner.java b/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/internal/style/java/JSDTCodeScanner.java
index d6d50e3ea6..41b2e8797d 100644
--- a/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/internal/style/java/JSDTCodeScanner.java
+++ b/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/internal/style/java/JSDTCodeScanner.java
@@ -58,7 +58,7 @@ class JSDTCodeScanner extends org.eclipse.jface.text.rules.RuleBasedScanner {
// Add rule for multiple line comments.
rules.add(new MultiLineRule("/*", "*/", fMultiLineCommentToken));//$NON-NLS-1$ //$NON-NLS-2$
// Add rule for single line comments.
- rules.add(new NoneInclusiveEndSequenceSingleLineRule("//", "-->", fSingleLineCommentToken));//$NON-NLS-1$
+ rules.add(new SingleLineRule("//", "\n" , fSingleLineCommentToken));//$NON-NLS-1$ //$NON-NLS-2$s
// Add rule for strings and character constants.
rules.add(new SingleLineRule("\"", "\"", fStringToken, '\\'));//$NON-NLS-2$//$NON-NLS-1$
rules.add(new SingleLineRule("'", "'", fStringToken, '\\'));//$NON-NLS-2$//$NON-NLS-1$
@@ -78,10 +78,7 @@ class JSDTCodeScanner extends org.eclipse.jface.text.rules.RuleBasedScanner {
rules.add(wordRule);
//add word rule for HTML style comment delimiters
- rules.add(new WordRule(new HTMLCommentDetector(), this.fHTMLCommentBorderToken));
-
- //add rule for text after leading HTML comment delimiter
- rules.add(new NoneInclusiveStartSequenceEndOfLineRule("<!--", this.fSingleLineCommentToken));
+ rules.add(new MultiLineRule("<!--", "-->", fHTMLCommentBorderToken));//$NON-NLS-1$ //$NON-NLS-2$
IRule[] result = new IRule[rules.size()];
rules.toArray(result);
diff --git a/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/internal/taginfo/JSDTHoverProcessor.java b/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/internal/taginfo/JSDTHoverProcessor.java
index e1ee74e1a5..5a3bd0d1a2 100644
--- a/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/internal/taginfo/JSDTHoverProcessor.java
+++ b/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/internal/taginfo/JSDTHoverProcessor.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2009 IBM Corporation and others.
+ * Copyright (c) 2004, 2012 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
@@ -12,15 +12,16 @@ package org.eclipse.wst.jsdt.web.ui.internal.taginfo;
import java.io.Reader;
+import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.ITextViewer;
+import org.eclipse.jface.text.ITypedRegion;
import org.eclipse.wst.jsdt.core.IJavaScriptElement;
import org.eclipse.wst.jsdt.core.IMember;
import org.eclipse.wst.jsdt.core.JavaScriptModelException;
import org.eclipse.wst.jsdt.ui.JSdocContentAccess;
import org.eclipse.wst.jsdt.ui.JavaScriptElementLabels;
import org.eclipse.wst.jsdt.web.core.javascript.IJsTranslation;
-import org.eclipse.wst.jsdt.web.core.javascript.JsTranslation;
import org.eclipse.wst.jsdt.web.core.javascript.JsTranslationAdapter;
import org.eclipse.wst.sse.core.StructuredModelManager;
import org.eclipse.wst.sse.ui.internal.taginfo.AbstractHoverProcessor;
@@ -36,6 +37,7 @@ import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel;
* (repeatedly) as the API evolves.
*/
public class JSDTHoverProcessor extends AbstractHoverProcessor {
+ private static final String[] PARTITION_TYPES= new String[] {"org.eclipse.wst.html.SCRIPT","org.eclipse.wst.html.SCRIPT.EVENTHANDLER"}; //$NON-NLS-1$ //$NON-NLS-2$
/*
* Bulk of the work was copied from
* org.eclipse.wst.jsdt.internal.ui.text.java.hover.JavadocHover
@@ -102,36 +104,31 @@ public class JSDTHoverProcessor extends AbstractHoverProcessor {
IDOMDocument xmlDoc = xmlModel.getDocument();
JsTranslationAdapter adapter = (JsTranslationAdapter) xmlDoc.getAdapterFor(IJsTranslation.class);
if (adapter != null) {
- IJsTranslation translation = adapter.getJsTranslation(true);
- IJavaScriptElement[] result = ((JsTranslation)translation).getElementsFromWebRange(hoverRegion.getOffset(), hoverRegion.getOffset() + hoverRegion.getLength());
-// Vector filteredResults = new Vector();
-// List badFunctions = translation.getGeneratedFunctionNames();
-// boolean bad = false;
-// for(int i = 0;i<result.length;i++){
-// bad=false;
-// if(result[i] instanceof IFunction){
-// for(int j=0;j<badFunctions.size() && ! bad;j++){
-// if(((IFunction)result[i]).getElementName().equalsIgnoreCase((String)badFunctions.get(j))){
-// bad=true;
-// continue;
-// }
-// }
-// if(!bad)filteredResults.add(result[i]);
-// }
-// }
-// if(filteredResults.size()<1) return new String();
-//
-// String filteredResult =
-// translation.fixupMangledName(getHoverInfo((IJavaScriptElement[])filteredResults.toArray(new
-// IJavaScriptElement[]{})));
-// for(int i = 0;i<badFunctions.size();i++){
-// filteredResult.replace((String)badFunctions.get(i), "");
-// }
-// return filteredResult;
- return translation.fixupMangledName(getHoverInfo(result));
+ try {
+ boolean proceed = false;
+ ITypedRegion[] partitions = xmlDoc.getStructuredDocument().computePartitioning(hoverRegion.getOffset(), hoverRegion.getLength());
+ for (int i = 0; i < partitions.length; i++) {
+ for (int j = 0; j < PARTITION_TYPES.length; j++) {
+ if (PARTITION_TYPES[j].equals(partitions[i].getType())) {
+ proceed = true;
+ break;
+ }
+ }
+ }
+ if (proceed) {
+ IJsTranslation translation = adapter.getJsTranslation(true);
+ IJavaScriptElement[] result = translation.getElementsFromJsRange(translation.getJavaScriptOffset(hoverRegion.getOffset()), translation.getJavaScriptOffset(hoverRegion.getOffset() + hoverRegion.getLength()));
+
+ return translation.fixupMangledName(getHoverInfo(result));
+ }
+ }
+ catch (BadLocationException e) {
+ // do nothing
+ }
}
}
- } finally {
+ }
+ finally {
if (xmlModel != null) {
xmlModel.releaseFromRead();
}
diff --git a/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/internal/text/JsCharacterPairInserter.java b/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/internal/text/JsCharacterPairInserter.java
index 38d02d7ad7..60ebf2590b 100644
--- a/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/internal/text/JsCharacterPairInserter.java
+++ b/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/internal/text/JsCharacterPairInserter.java
@@ -202,7 +202,6 @@ public class JsCharacterPairInserter extends AbstractCharacterPairInserter imple
}
/**
- * TODO: IAN: comment me
* @param identifier
* @return
*/
diff --git a/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/messages.properties b/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/messages.properties
index c6061c4829..c7f8441876 100644
--- a/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/messages.properties
+++ b/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/messages.properties
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright (c) 2007, 2008 IBM Corporation and others.
+# Copyright (c) 2007, 2011 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
@@ -8,4 +8,7 @@
# Contributors:
# IBM Corporation - initial API and implementation
###############################################################################
+# NLS_ENCODING=UTF-8
+# NLS_MESSAGEFORMAT_NONE
+
WebProjectJsGlobalScopeContainerInitializer.0=Web Project support for JSDT
diff --git a/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/views/contentoutline/JFaceNodeAdapterForJs.java b/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/views/contentoutline/JFaceNodeAdapterForJs.java
index a9cdc46428..c295098d46 100644
--- a/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/views/contentoutline/JFaceNodeAdapterForJs.java
+++ b/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/views/contentoutline/JFaceNodeAdapterForJs.java
@@ -33,7 +33,6 @@ import org.eclipse.wst.jsdt.internal.core.SourceRefElement;
import org.eclipse.wst.jsdt.ui.JavaScriptElementLabelProvider;
import org.eclipse.wst.jsdt.ui.StandardJavaScriptElementContentProvider;
import org.eclipse.wst.jsdt.web.core.javascript.IJsTranslation;
-import org.eclipse.wst.jsdt.web.core.javascript.JsTranslation;
import org.eclipse.wst.jsdt.web.core.javascript.JsTranslationAdapter;
import org.eclipse.wst.jsdt.web.ui.internal.Logger;
import org.eclipse.wst.sse.core.StructuredModelManager;
@@ -183,11 +182,10 @@ public class JFaceNodeAdapterForJs extends JFaceNodeAdapterForHTML {
private Object[] filterChildrenForRange(IJavaScriptElement[] allChildren, Node node) {
int javaPositionEnd = ((NodeImpl) node).getEndOffset();
int javaPositionStart = ((NodeImpl) node).getStartOffset();
- IJsTranslation translation = getTranslation(node);
- javaPositionStart = ((JsTranslation)translation).getJavaScriptOffset(((NodeImpl) node).getStartOffset());
+ javaPositionStart = getTranslation(node).getJavaScriptOffset(((NodeImpl) node).getStartOffset());
if (javaPositionStart < 0)
javaPositionStart = ((NodeImpl) node).getStartOffset();
- javaPositionEnd = ((JsTranslation)translation).getJavaScriptOffset(((NodeImpl) node).getEndOffset() - 1);
+ javaPositionEnd = getTranslation(node).getJavaScriptOffset(((NodeImpl) node).getEndOffset() - 1);
if (javaPositionEnd < 0)
javaPositionEnd = ((NodeImpl) node).getEndOffset();
diff --git a/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/views/contentoutline/messages.properties b/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/views/contentoutline/messages.properties
index b36e5bef71..aa56e2446a 100644
--- a/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/views/contentoutline/messages.properties
+++ b/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/views/contentoutline/messages.properties
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright (c) 2007, 2008 IBM Corporation and others.
+# Copyright (c) 2007, 2011 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
@@ -8,4 +8,7 @@
# Contributors:
# IBM Corporation - initial API and implementation
###############################################################################
+# NLS_ENCODING=UTF-8
+# NLS_MESSAGEFORMAT_NONE
+
JsJfaceNode.1=error in JsJfaceNode... I couldn't retrieve my java element from the original page
diff --git a/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/views/provisional/contentoutline/JFaceNodeAdapterForJs.java b/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/views/provisional/contentoutline/JFaceNodeAdapterForJs.java
index 2a7a3a4edd..323e001250 100644
--- a/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/views/provisional/contentoutline/JFaceNodeAdapterForJs.java
+++ b/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/views/provisional/contentoutline/JFaceNodeAdapterForJs.java
@@ -17,7 +17,6 @@ import org.eclipse.wst.jsdt.ui.JavaScriptElementLabelProvider;
import org.eclipse.wst.jsdt.ui.StandardJavaScriptElementContentProvider;
import org.eclipse.wst.jsdt.web.core.internal.Logger;
import org.eclipse.wst.jsdt.web.core.javascript.IJsTranslation;
-import org.eclipse.wst.jsdt.web.core.javascript.JsTranslation;
import org.eclipse.wst.jsdt.web.core.javascript.JsTranslationAdapter;
import org.eclipse.wst.sse.core.StructuredModelManager;
import org.eclipse.wst.sse.core.internal.provisional.IModelManager;
@@ -86,8 +85,8 @@ public class JFaceNodeAdapterForJs extends JFaceNodeAdapterForHTML {
IJsTranslation translation = null;
if (node.getNodeType() == Node.TEXT_NODE && (node instanceof NodeImpl)) {
translation = getTranslation(node);
- startOffset = ((JsTranslation)translation).getJavaScriptOffset(((NodeImpl) node).getStartOffset());
- endOffset = ((JsTranslation)translation).getJavaScriptOffset(((NodeImpl) node).getEndOffset() - 1);
+ startOffset = translation.getJavaScriptOffset(((NodeImpl) node).getStartOffset());
+ endOffset = translation.getJavaScriptOffset(((NodeImpl) node).getEndOffset() - 1);
if (startOffset >= 0 && endOffset >= 0)
result = translation.getAllElementsInJsRange(startOffset, endOffset);
}

Back to the top