Author: mareshkau
Date: 2008-07-24 14:30:45 -0400 (Thu, 24 Jul 2008)
New Revision: 9277
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/SelectionManager.java
Log:
JBIDE-2505
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java 2008-07-24
18:28:52 UTC (rev 9276)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java 2008-07-24
18:30:45 UTC (rev 9277)
@@ -760,7 +760,7 @@
selectionManager.refreshVisualSelection();
} catch (Exception ex) {
- VpePlugin.reportProblem(ex);
+ VpePlugin.getPluginLog().logError(ex);
}
// VpeTemplate template = TemplateManagingUtil
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/SelectionManager.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/SelectionManager.java 2008-07-24
18:28:52 UTC (rev 9276)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/SelectionManager.java 2008-07-24
18:30:45 UTC (rev 9277)
@@ -239,6 +239,11 @@
IStructuredModel model = null;
try {
+ //checks for null, for case when we close editor and background update job is running
+ if(getSourceEditor().getTextViewer()==null) {
+
+ return;
+ }
//gets source model for read, model should be released see JBIDE-2219
model = StructuredModelManager.getModelManager()
.getExistingModelForRead(getSourceEditor().getTextViewer().getDocument());
@@ -313,9 +318,16 @@
NodeImpl targetSourceNode = (NodeImpl)nodeData.getSourceNode();
String sourceNodeValue = nodeData.getSourceNode().getNodeValue();
ITextRegion valueRegion = targetSourceNode.getValueRegion();
+ if(valueRegion==null) {
+ return;
+ }
ITextRegion nameRegion = targetSourceNode.getNameRegion();
int offcetReferenceToSourceNode =
focusOffcetInSourceDocument-valueRegion.getStart()-targetSourceNode.getStartOffset()+nameRegion.getStart()-1;
- selectionController.getSelection(nsISelectionController.SELECTION_NORMAL).collapse(visualNode,
offcetReferenceToSourceNode);
+
+ if(offcetReferenceToSourceNode<visualNode.getNodeValue().length()){
+
+ selectionController.getSelection(nsISelectionController.SELECTION_NORMAL).collapse(visualNode,
offcetReferenceToSourceNode);
+ }
}
}
/**
Show replies by date