Author: dazarov
Date: 2011-07-01 18:01:41 -0400 (Fri, 01 Jul 2011)
New Revision: 32534
Added:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/actions/SelectRulerAction.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/actions/xpl/
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/actions/xpl/SelectAnnotationRulerAction.java
trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/JBDSQuickAssistProcessor.java
Modified:
trunk/common/plugins/org.jboss.tools.common.model.ui/plugin.xml
trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/MarkerAnnotationInfo.java
trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/XMLTextViewerConfiguration.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/HTMLTextViewerConfiguration.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/JSPTextViewerConfiguration.java
Log:
https://issues.jboss.org/browse/JBIDE-9209
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/plugin.xml
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/plugin.xml 2011-07-01 21:22:43
UTC (rev 32533)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/plugin.xml 2011-07-01 22:01:41
UTC (rev 32534)
@@ -467,5 +467,37 @@
<provider
class="org.jboss.tools.common.model.ui.attribute.adapter.JavaClassContentAssistProvider"/>
<provider
class="org.jboss.tools.common.model.ui.attribute.adapter.PropertiesContentAssistProvider"/>
</extension>
-
+<extension
+ point="org.eclipse.ui.editorActions">
+ <editorContribution
+ targetID="org.jboss.tools.jst.jsp.jspeditor.HTMLTextEditor"
+
id="org.jboss.tools.jst.jsp.jspeditor.HTMLTextEditor.ruler.actions">
+ <action
+ label="SelectRulerAction.label"
+
class="org.jboss.tools.common.model.ui.actions.SelectRulerAction"
+ actionID="Rulerselect"
+
id="org.jboss.tools.common.model.ui.actions.SelectRulerAction">
+ </action>
+ </editorContribution>
+ <editorContribution
+ targetID="org.jboss.tools.jst.jsp.jspeditor.JSPTextEditor"
+
id="org.jboss.tools.jst.jsp.jspeditor.JSPTextEditor.ruler.actions">
+ <action
+ label="SelectRulerAction.label"
+
class="org.jboss.tools.common.model.ui.actions.SelectRulerAction"
+ actionID="Rulerselect"
+
id="org.jboss.tools.common.model.ui.actions.SelectRulerAction">
+ </action>
+ </editorContribution>
+ <editorContribution
+
targetID="org.jboss.tools.common.model.ui.editor.EditorPartWrapper"
+
id="org.jboss.tools.common.model.ui.editor.EditorPartWrapper.ruler.actions">
+ <action
+ label="SelectRulerAction.label"
+
class="org.jboss.tools.common.model.ui.actions.SelectRulerAction"
+ actionID="Rulerselect"
+
id="org.jboss.tools.common.model.ui.actions.SelectRulerAction">
+ </action>
+ </editorContribution>
+</extension>
</plugin>
Added:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/actions/SelectRulerAction.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/actions/SelectRulerAction.java
(rev 0)
+++
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/actions/SelectRulerAction.java 2011-07-01
22:01:41 UTC (rev 32534)
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.common.model.ui.actions;
+
+import java.util.ResourceBundle;
+
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.text.source.IVerticalRulerInfo;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.ui.texteditor.AbstractRulerActionDelegate;
+import org.eclipse.ui.texteditor.ITextEditor;
+import org.jboss.tools.common.model.ui.actions.xpl.SelectAnnotationRulerAction;
+
+public class SelectRulerAction extends AbstractRulerActionDelegate {
+ private IAction action=null;
+
+ @Override
+ protected IAction createAction(ITextEditor editor, IVerticalRulerInfo rulerInfo) {
+ if(action == null)
+ action = new
SelectAnnotationRulerAction(ResourceBundle.getBundle("org.eclipse.jdt.internal.ui.javaeditor.ConstructedJavaEditorMessages"),
"JavaSelectAnnotationRulerAction.", editor, rulerInfo); //$NON-NLS-1$
+ return action;
+ }
+
+ public void mouseUp(MouseEvent e) {
+ super.mouseUp(e);
+ if(action != null && action.isEnabled())
+ action.run();
+ }
+}
Property changes on:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/actions/SelectRulerAction.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/actions/xpl/SelectAnnotationRulerAction.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/actions/xpl/SelectAnnotationRulerAction.java
(rev 0)
+++
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/actions/xpl/SelectAnnotationRulerAction.java 2011-07-01
22:01:41 UTC (rev 32534)
@@ -0,0 +1,118 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 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
+ *
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ * Exadel, Inc.
+ * Red Hat, Inc.
+ *******************************************************************************/
+package org.jboss.tools.common.model.ui.actions.xpl;
+
+import java.util.Iterator;
+import java.util.ResourceBundle;
+
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.ITextOperationTarget;
+import org.eclipse.jface.text.Position;
+import org.eclipse.jface.text.source.Annotation;
+import org.eclipse.jface.text.source.IAnnotationAccessExtension;
+import org.eclipse.jface.text.source.ISourceViewer;
+import org.eclipse.jface.text.source.IVerticalRulerInfo;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.ui.texteditor.AbstractMarkerAnnotationModel;
+import org.eclipse.ui.texteditor.ITextEditor;
+import org.eclipse.ui.texteditor.ITextEditorExtension;
+import org.eclipse.ui.texteditor.SelectMarkerRulerAction;
+
+public class SelectAnnotationRulerAction extends SelectMarkerRulerAction {
+
+ private ITextEditor fTextEditor;
+ private Position fPosition;
+ private boolean fHasCorrection;
+ private ResourceBundle fBundle;
+
+ public SelectAnnotationRulerAction(ResourceBundle bundle, String prefix, ITextEditor
editor, IVerticalRulerInfo ruler) {
+ super(bundle, prefix, editor, ruler);
+ fBundle= bundle;
+ fTextEditor= editor;
+ }
+
+ @Override
+ public void run() {
+ runWithEvent(null);
+ }
+
+ @Override
+ public void runWithEvent(Event event) {
+
+ if (fHasCorrection) {
+ ITextOperationTarget operation= (ITextOperationTarget)
fTextEditor.getAdapter(ITextOperationTarget.class);
+ final int opCode= ISourceViewer.QUICK_ASSIST;
+ if (operation != null && operation.canDoOperation(opCode)) {
+ fTextEditor.selectAndReveal(fPosition.getOffset(), fPosition.getLength());
+ operation.doOperation(opCode);
+ }
+ return;
+ }
+
+ super.run();
+ }
+
+ @Override
+ public void update() {
+ findAnnotation();
+ setEnabled(true);
+ if (fHasCorrection) {
+ initialize(fBundle, "SelectAnnotationRulerAction.QuickFix."); //$NON-NLS-1$
+ return;
+ }
+
+ initialize(fBundle, "SelectAnnotationRulerAction.GotoAnnotation.");
//$NON-NLS-1$;
+ super.update();
+ }
+
+ private void findAnnotation() {
+ fPosition= null;
+ fHasCorrection= false;
+
+ AbstractMarkerAnnotationModel model= getAnnotationModel();
+ IAnnotationAccessExtension annotationAccess= getAnnotationAccessExtension();
+
+ IDocument document= getDocument();
+ if (model == null)
+ return ;
+
+ Iterator<Annotation> iter= model.getAnnotationIterator();
+ int layer= Integer.MIN_VALUE;
+
+ while (iter.hasNext()) {
+ Annotation annotation= iter.next();
+ if (annotation.isMarkedDeleted())
+ continue;
+
+ int annotationLayer= layer;
+ if (annotationAccess != null) {
+ annotationLayer= annotationAccess.getLayer(annotation);
+ if (annotationLayer < layer)
+ continue;
+ }
+
+ Position position= model.getPosition(annotation);
+ if (!includesRulerLine(position, document))
+ continue;
+
+ boolean isReadOnly= fTextEditor instanceof ITextEditorExtension &&
((ITextEditorExtension)fTextEditor).isEditorInputReadOnly();
+ if (!isReadOnly) {
+ fPosition= position;
+ fHasCorrection= true;
+ layer= annotationLayer;
+ continue;
+ }
+ }
+ }
+
+}
Property changes on:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/actions/xpl/SelectAnnotationRulerAction.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added:
trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/JBDSQuickAssistProcessor.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/JBDSQuickAssistProcessor.java
(rev 0)
+++
trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/JBDSQuickAssistProcessor.java 2011-07-01
22:01:41 UTC (rev 32534)
@@ -0,0 +1,77 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.common.text.xml;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.jface.text.Position;
+import org.eclipse.jface.text.contentassist.ICompletionProposal;
+import org.eclipse.jface.text.quickassist.IQuickAssistInvocationContext;
+import org.eclipse.jface.text.quickassist.IQuickAssistProcessor;
+import org.eclipse.jface.text.source.Annotation;
+import org.eclipse.jface.text.source.IAnnotationModel;
+import org.eclipse.ui.texteditor.SimpleMarkerAnnotation;
+import org.eclipse.wst.sse.ui.internal.reconcile.TemporaryAnnotation;
+import org.jboss.tools.common.text.xml.MarkerAnnotationInfo.AnnotationInfo;
+
+public class JBDSQuickAssistProcessor implements IQuickAssistProcessor {
+
+ public String getErrorMessage() {
+ return null;
+ }
+
+ public boolean canFix(Annotation annotation) {
+ if(annotation instanceof SimpleMarkerAnnotation || annotation instanceof
TemporaryAnnotation)
+ return true;
+ return false;
+ }
+
+ public boolean canAssist(IQuickAssistInvocationContext invocationContext) {
+ return false;
+ }
+
+ public ICompletionProposal[] computeQuickAssistProposals(IQuickAssistInvocationContext
invocationContext) {
+ List<AnnotationInfo> all = new ArrayList<AnnotationInfo>();
+ List<AnnotationInfo> high = new ArrayList<AnnotationInfo>();
+ List<AnnotationInfo> low = new ArrayList<AnnotationInfo>();
+
+ IAnnotationModel model = invocationContext.getSourceViewer().getAnnotationModel();
+ if (model != null) {
+ Iterator<Annotation> iterator = model.getAnnotationIterator();
+ while (iterator.hasNext()) {
+ Annotation annotation = (Annotation) iterator.next();
+ if (!canFix(annotation))
+ continue;
+
+ Position position = model.getPosition(annotation);
+
+ if (position.overlapsWith(invocationContext.getOffset(), 1)) {
+ AnnotationInfo info = new AnnotationInfo(annotation, position);
+ if(info.isTop())
+ high.add(info);
+ else
+ low.add(info);
+ }
+ }
+ all.addAll(high);
+ all.addAll(low);
+ }
+ MarkerAnnotationInfo mai = new MarkerAnnotationInfo(all,
invocationContext.getSourceViewer());
+ List<ICompletionProposal> proposals = new
ArrayList<ICompletionProposal>();
+ for(AnnotationInfo info : all){
+ proposals.addAll(mai.getCompletionProposals(info));
+ }
+ return proposals.toArray(new ICompletionProposal[]{});
+ }
+
+}
Property changes on:
trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/JBDSQuickAssistProcessor.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified:
trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/MarkerAnnotationInfo.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/MarkerAnnotationInfo.java 2011-07-01
21:22:43 UTC (rev 32533)
+++
trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/MarkerAnnotationInfo.java 2011-07-01
22:01:41 UTC (rev 32534)
@@ -22,7 +22,7 @@
import org.eclipse.jface.text.quickassist.IQuickAssistProcessor;
import org.eclipse.jface.text.quickassist.IQuickFixableAnnotation;
import org.eclipse.jface.text.source.Annotation;
-import org.eclipse.jface.text.source.SourceViewer;
+import org.eclipse.jface.text.source.ISourceViewer;
import org.eclipse.ui.IMarkerResolution;
import org.eclipse.ui.ide.IDE;
import org.eclipse.ui.texteditor.SimpleMarkerAnnotation;
@@ -32,9 +32,9 @@
public class MarkerAnnotationInfo {
public final List<AnnotationInfo> infos;
- public final SourceViewer viewer;
+ public final ISourceViewer viewer;
- public MarkerAnnotationInfo(List<AnnotationInfo> infos, SourceViewer textViewer)
{
+ public MarkerAnnotationInfo(List<AnnotationInfo> infos, ISourceViewer textViewer)
{
this.infos = infos;
this.viewer = textViewer;
}
Modified:
trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/XMLTextViewerConfiguration.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/XMLTextViewerConfiguration.java 2011-07-01
21:22:43 UTC (rev 32533)
+++
trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/XMLTextViewerConfiguration.java 2011-07-01
22:01:41 UTC (rev 32534)
@@ -19,19 +19,31 @@
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Plugin;
+import org.eclipse.jface.preference.PreferenceConverter;
+import org.eclipse.jface.text.DefaultInformationControl;
+import org.eclipse.jface.text.IInformationControl;
+import org.eclipse.jface.text.IInformationControlCreator;
import org.eclipse.jface.text.ITextHover;
import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
import org.eclipse.jface.text.hyperlink.IHyperlinkDetector;
+import org.eclipse.jface.text.quickassist.IQuickAssistAssistant;
+import org.eclipse.jface.text.quickassist.QuickAssistAssistant;
import org.eclipse.jface.text.source.ISourceViewer;
import org.eclipse.jface.text.source.SourceViewerConfiguration;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.RGB;
+import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.texteditor.AbstractDecoratedTextEditorPreferenceConstants;
import org.eclipse.wst.sse.ui.StructuredTextViewerConfiguration;
import org.eclipse.wst.sse.ui.contentassist.CompletionProposalInvocationContext;
import org.eclipse.wst.sse.ui.internal.SSEUIPlugin;
+import org.eclipse.wst.sse.ui.internal.derived.HTMLTextPresenter;
+import org.eclipse.wst.sse.ui.internal.preferences.EditorPreferenceNames;
import org.eclipse.wst.sse.ui.internal.taginfo.AnnotationHoverProcessor;
import org.eclipse.wst.sse.ui.internal.taginfo.BestMatchHover;
import org.eclipse.wst.sse.ui.internal.taginfo.ProblemAnnotationHoverProcessor;
import org.eclipse.wst.sse.ui.internal.taginfo.TextHoverManager;
+import org.eclipse.wst.sse.ui.internal.util.EditorUtility;
import org.eclipse.wst.xml.ui.StructuredTextViewerConfigurationXML;
import
org.eclipse.wst.xml.ui.internal.contentassist.XMLStructuredContentAssistProcessor;
import org.jboss.tools.common.text.xml.contentassist.ProposalSorter;
@@ -189,5 +201,44 @@
return super.getTextHover(sourceViewer, contentType, stateMask);
}
+
+ private IQuickAssistAssistant fQuickAssistant = null;
+
+ private Color getColor(String key) {
+ RGB rgb = PreferenceConverter.getColor(fPreferenceStore, key);
+ return EditorUtility.getColor(rgb);
+ }
+
+ @Override
+ public IQuickAssistAssistant getQuickAssistAssistant(ISourceViewer sourceViewer) {
+ if (fQuickAssistant == null) {
+ IQuickAssistAssistant assistant = new QuickAssistAssistant();
+ assistant.setQuickAssistProcessor(new JBDSQuickAssistProcessor());
+ assistant.setInformationControlCreator(getQuickAssistAssistantInformationControlCreator());
+ if (fPreferenceStore != null) {
+ Color color = getColor(EditorPreferenceNames.CODEASSIST_PROPOSALS_BACKGROUND);
+ assistant.setProposalSelectorBackground(color);
+
+ color = getColor(EditorPreferenceNames.CODEASSIST_PROPOSALS_FOREGROUND);
+ assistant.setProposalSelectorForeground(color);
+ }
+ fQuickAssistant = assistant;
+ }
+ return fQuickAssistant;
+ }
+
+ /**
+ * Returns the information control creator for the quick assist assistant.
+ *
+ * @return the information control creator
+ */
+ private IInformationControlCreator getQuickAssistAssistantInformationControlCreator() {
+ return new IInformationControlCreator() {
+ public IInformationControl createInformationControl(Shell parent) {
+ return new DefaultInformationControl(parent, new HTMLTextPresenter(true));
+ }
+ };
+ }
+
}
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/HTMLTextViewerConfiguration.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/HTMLTextViewerConfiguration.java 2011-07-01
21:22:43 UTC (rev 32533)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/HTMLTextViewerConfiguration.java 2011-07-01
22:01:41 UTC (rev 32534)
@@ -21,14 +21,24 @@
import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Platform;
+import org.eclipse.jdt.internal.ui.text.correction.JavaCorrectionAssistant;
+import org.eclipse.jface.preference.PreferenceConverter;
+import org.eclipse.jface.text.DefaultInformationControl;
+import org.eclipse.jface.text.IInformationControl;
+import org.eclipse.jface.text.IInformationControlCreator;
import org.eclipse.jface.text.ITextHover;
import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
import org.eclipse.jface.text.formatter.IContentFormatter;
import org.eclipse.jface.text.formatter.MultiPassContentFormatter;
import org.eclipse.jface.text.hyperlink.IHyperlinkDetector;
import org.eclipse.jface.text.information.IInformationProvider;
+import org.eclipse.jface.text.quickassist.IQuickAssistAssistant;
+import org.eclipse.jface.text.quickassist.QuickAssistAssistant;
import org.eclipse.jface.text.source.ISourceViewer;
import org.eclipse.jface.util.PropertyChangeEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.RGB;
+import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.texteditor.AbstractDecoratedTextEditorPreferenceConstants;
import org.eclipse.wst.html.core.text.IHTMLPartitions;
import org.eclipse.wst.html.ui.StructuredTextViewerConfigurationHTML;
@@ -36,11 +46,16 @@
import org.eclipse.wst.sse.ui.contentassist.CompletionProposalInvocationContext;
import org.eclipse.wst.sse.ui.internal.ExtendedConfigurationBuilder;
import org.eclipse.wst.sse.ui.internal.SSEUIPlugin;
+import org.eclipse.wst.sse.ui.internal.correction.CompoundQuickAssistProcessor;
+import org.eclipse.wst.sse.ui.internal.derived.HTMLTextPresenter;
import org.eclipse.wst.sse.ui.internal.format.StructuredFormattingStrategy;
+import org.eclipse.wst.sse.ui.internal.preferences.EditorPreferenceNames;
import org.eclipse.wst.sse.ui.internal.taginfo.AnnotationHoverProcessor;
import org.eclipse.wst.sse.ui.internal.taginfo.ProblemAnnotationHoverProcessor;
import org.eclipse.wst.sse.ui.internal.taginfo.TextHoverManager;
+import org.eclipse.wst.sse.ui.internal.util.EditorUtility;
import org.jboss.tools.common.text.ext.hyperlink.HyperlinkDetector;
+import org.jboss.tools.common.text.xml.JBDSQuickAssistProcessor;
import org.jboss.tools.common.text.xml.contentassist.ProposalSorter;
import org.jboss.tools.common.text.xml.xpl.MarkerProblemAnnotationHoverProcessor;
import org.jboss.tools.jst.jsp.format.HTMLFormatProcessor;
@@ -256,4 +271,43 @@
}
return contentAssisteProcessors;
}
+
+ private IQuickAssistAssistant fQuickAssistant = null;
+
+ private Color getColor(String key) {
+ RGB rgb = PreferenceConverter.getColor(fPreferenceStore, key);
+ return EditorUtility.getColor(rgb);
+ }
+
+ @Override
+ public IQuickAssistAssistant getQuickAssistAssistant(ISourceViewer sourceViewer) {
+ if (fQuickAssistant == null) {
+ IQuickAssistAssistant assistant = new QuickAssistAssistant();
+ assistant.setQuickAssistProcessor(new JBDSQuickAssistProcessor());
+ assistant.setInformationControlCreator(getQuickAssistAssistantInformationControlCreator());
+
+ if (fPreferenceStore != null) {
+ Color color = getColor(EditorPreferenceNames.CODEASSIST_PROPOSALS_BACKGROUND);
+ assistant.setProposalSelectorBackground(color);
+
+ color = getColor(EditorPreferenceNames.CODEASSIST_PROPOSALS_FOREGROUND);
+ assistant.setProposalSelectorForeground(color);
+ }
+ fQuickAssistant = assistant;
+ }
+ return fQuickAssistant;
+ }
+
+ /**
+ * Returns the information control creator for the quick assist assistant.
+ *
+ * @return the information control creator
+ */
+ private IInformationControlCreator getQuickAssistAssistantInformationControlCreator() {
+ return new IInformationControlCreator() {
+ public IInformationControl createInformationControl(Shell parent) {
+ return new DefaultInformationControl(parent, new HTMLTextPresenter(true));
+ }
+ };
+ }
}
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/JSPTextViewerConfiguration.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/JSPTextViewerConfiguration.java 2011-07-01
21:22:43 UTC (rev 32533)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/JSPTextViewerConfiguration.java 2011-07-01
22:01:41 UTC (rev 32534)
@@ -15,20 +15,33 @@
import java.util.List;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.preference.PreferenceConverter;
+import org.eclipse.jface.text.DefaultInformationControl;
+import org.eclipse.jface.text.IInformationControl;
+import org.eclipse.jface.text.IInformationControlCreator;
import org.eclipse.jface.text.ITextHover;
import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
import org.eclipse.jface.text.hyperlink.IHyperlinkDetector;
+import org.eclipse.jface.text.quickassist.IQuickAssistAssistant;
+import org.eclipse.jface.text.quickassist.QuickAssistAssistant;
import org.eclipse.jface.text.source.ISourceViewer;
import org.eclipse.jst.jsp.core.text.IJSPPartitions;
import org.eclipse.jst.jsp.ui.StructuredTextViewerConfigurationJSP;
import
org.eclipse.jst.jsp.ui.internal.contentassist.JSPStructuredContentAssistProcessor;
import org.eclipse.jst.jsp.ui.internal.style.jspel.LineStyleProviderForJSPEL;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.RGB;
+import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.texteditor.AbstractDecoratedTextEditorPreferenceConstants;
import org.eclipse.wst.sse.ui.contentassist.CompletionProposalInvocationContext;
import org.eclipse.wst.sse.ui.internal.SSEUIPlugin;
+import org.eclipse.wst.sse.ui.internal.derived.HTMLTextPresenter;
+import org.eclipse.wst.sse.ui.internal.preferences.EditorPreferenceNames;
import org.eclipse.wst.sse.ui.internal.provisional.style.LineStyleProvider;
import org.eclipse.wst.sse.ui.internal.taginfo.TextHoverManager;
+import org.eclipse.wst.sse.ui.internal.util.EditorUtility;
import org.jboss.tools.common.text.ext.hyperlink.HyperlinkDetector;
+import org.jboss.tools.common.text.xml.JBDSQuickAssistProcessor;
import org.jboss.tools.common.text.xml.contentassist.ProposalSorter;
import org.jboss.tools.common.text.xml.xpl.MarkerProblemAnnotationHoverProcessor;
@@ -178,5 +191,44 @@
return super.getTextHover(sourceViewer, contentType, stateMask);
}
+
+ private IQuickAssistAssistant fQuickAssistant = null;
+
+ private Color getColor(String key) {
+ RGB rgb = PreferenceConverter.getColor(fPreferenceStore, key);
+ return EditorUtility.getColor(rgb);
+ }
+
+ @Override
+ public IQuickAssistAssistant getQuickAssistAssistant(ISourceViewer sourceViewer) {
+ if (fQuickAssistant == null) {
+ IQuickAssistAssistant assistant = new QuickAssistAssistant();
+ assistant.setQuickAssistProcessor(new JBDSQuickAssistProcessor());
+ assistant.setInformationControlCreator(getQuickAssistAssistantInformationControlCreator());
+ if (fPreferenceStore != null) {
+ Color color = getColor(EditorPreferenceNames.CODEASSIST_PROPOSALS_BACKGROUND);
+ assistant.setProposalSelectorBackground(color);
+
+ color = getColor(EditorPreferenceNames.CODEASSIST_PROPOSALS_FOREGROUND);
+ assistant.setProposalSelectorForeground(color);
+ }
+ fQuickAssistant = assistant;
+ }
+ return fQuickAssistant;
+ }
+
+ /**
+ * Returns the information control creator for the quick assist assistant.
+ *
+ * @return the information control creator
+ */
+ private IInformationControlCreator getQuickAssistAssistantInformationControlCreator() {
+ return new IInformationControlCreator() {
+ public IInformationControl createInformationControl(Shell parent) {
+ return new DefaultInformationControl(parent, new HTMLTextPresenter(true));
+ }
+ };
+ }
+
}
\ No newline at end of file