Update of /cvsroot/woproject/woproject/projects/wolips/plugins/org.objectstyle.wolips.wodclipse/java/org/objectstyle/wolips/wodclipse/wod
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5924/java/org/objectstyle/wolips/wodclipse/wod
Modified Files:
WodEditor.java
Log Message:
editor interaction refactored
Index: WodEditor.java
===================================================================
RCS file: /cvsroot/woproject/woproject/projects/wolips/plugins/org.objectstyle.wolips.wodclipse/java/org/objectstyle/wolips/wodclipse/wod/WodEditor.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- WodEditor.java 29 Oct 2005 00:00:45 -0000 1.3
+++ WodEditor.java 26 Dec 2005 14:37:15 -0000 1.4
@@ -63,6 +63,9 @@
import org.eclipse.ui.texteditor.ContentAssistAction;
import org.eclipse.ui.texteditor.ITextEditorActionDefinitionIds;
import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
+import org.objectstyle.wolips.components.editor.EditorInteraction;
+import org.objectstyle.wolips.components.editor.IEmbeddedEditor;
+import org.objectstyle.wolips.components.editor.IWebobjectTagListener;
import org.objectstyle.wolips.htmleditor.HtmleditorPlugin;
import org.objectstyle.wolips.locate.LocateException;
import org.objectstyle.wolips.locate.result.LocalizedComponentsLocateResult;
@@ -74,8 +77,9 @@
/**
* @author mike
+ * @author uli
*/
-public class WodEditor extends TextEditor {
+public class WodEditor extends TextEditor implements IEmbeddedEditor, IWebobjectTagListener {
private WodContentOutlinePage myContentOutlinePage;
private IEditorInput myInput;
private LocalizedComponentsLocateResult myComponentsLocateResults;
@@ -135,25 +139,29 @@
myInput = _input;
}
- public void selectTagNamed(String _webobjectTagName) {
- try {
- IDocument document = getDocumentProvider().getDocument(getEditorInput());
- WodScanner wodScanner = WodScanner.wodScannerForDocument(document);
- RulePosition elementNameRulePosition = wodScanner.firstRulePositionOfTypeWithText(ElementNameRule.class, _webobjectTagName);
- if (elementNameRulePosition != null) {
- IRegion region = document.getLineInformationOfOffset(elementNameRulePosition.getTokenOffset());
- setHighlightRange(region.getOffset(), region.getLength(), true);
- }
- }
- catch (BadLocationException e) {
- WodclipsePlugin.getDefault().log(e);
- }
- }
-
public LocalizedComponentsLocateResult getComponentsLocateResults() throws CoreException, LocateException {
if (myComponentsLocateResults == null) {
myComponentsLocateResults = WodModelUtils.findComponents((IFileEditorInput)myInput);
}
return myComponentsLocateResults;
}
+
+ public void initEditorInteraction(EditorInteraction editorInteraction) {
+ editorInteraction.setWebObjectTagListener(this);
+ }
+
+ public void webObjectTagSelected(String name) {
+ try {
+ IDocument document = getDocumentProvider().getDocument(getEditorInput());
+ WodScanner wodScanner = WodScanner.wodScannerForDocument(document);
+ RulePosition elementNameRulePosition = wodScanner.firstRulePositionOfTypeWithText(ElementNameRule.class, name);
+ if (elementNameRulePosition != null) {
+ IRegion region = document.getLineInformationOfOffset(elementNameRulePosition.getTokenOffset());
+ setHighlightRange(region.getOffset(), region.getLength(), true);
+ }
+ }
+ catch (BadLocationException e) {
+ WodclipsePlugin.getDefault().log(e);
+ }
+ }
}
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.