コード例 #1
0
 public boolean handleEvent(Text text, TextEvent event) {
   if (text.getElement(LiveParseFlag.class).liveParse) {
     throw new RuntimeException("assert");
   }
   switchModes(text, null, text.getContent());
   doNotupdate = true;
   fChangeListener.valueChanges((IModelElement) null);
   doNotupdate = false;
   for (ITextEventListener listener :
       ((CompoundText) text).getTexts().get(0).getAllElements(ITextEventListener.class)) {
     listener.handleEvent(text, event);
   }
   return true;
 }
コード例 #2
0
 /**
  * Switches the given view from live parsing to normal model view and vice versa. To switch from
  * live parse to normal model, value must not be null and the view must be flagged live parse. To
  * switch from model to live parse, value must be null and the view must not be flagged live
  * parse.
  *
  * @param view The view to switch.
  * @param value The new model or null.
  * @param content The textual representation of the current model, used when switching to live
  *     parse.
  */
 private void switchModes(Text view, IModelElement value, String content) {
   IValueChangeListener<IModelElement> changeListener =
       view.getElement(IValueChangeListener.class);
   if (value == null && !view.getElement(LiveParseFlag.class).liveParse) {
     ((CompoundText) view)
         .replaceText(
             ((CompoundText) view).getTexts().get(0),
             createLiveParseView(changeListener, content));
     view.getElement(LiveParseFlag.class).liveParse = true;
   } else if (value != null && view.getElement(LiveParseFlag.class).liveParse) {
     ((CompoundText) view)
         .replaceText(
             ((CompoundText) view).getTexts().get(0), super.createView(value, changeListener));
     view.getElement(LiveParseFlag.class).liveParse = false;
   } else {
     if (!view.getElement(LiveParseFlag.class).liveParse) {
       super.updateView(((CompoundText) view).getTexts().get(0), value);
     } else {
       ((CompoundText) view)
           .replaceText(
               ((CompoundText) view).getTexts().get(0),
               createLiveParseView(changeListener, content));
       view.getElement(LiveParseFlag.class).liveParse = true;
     }
   }
 }
コード例 #3
0
 public boolean verifyEvent(Text text, TextEvent event) {
   return ExpressionTemplate.this.verifyEvent(text.getContent(), event);
 }