微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

org.eclipse.xtext.ui.editor.contentassist.ReplacementTextApplier的实例源码

项目:plan    文件PlanProposalProvider.java   
@Override
public void complete_ActivityElement(EObject model,RuleCall ruleCall,ContentAssistContext context,ICompletionProposalAcceptor acceptor) {
    ConfigurableCompletionProposal activityTemplate = (ConfigurableCompletionProposal) createCompletionProposal("Activity Template",context);  
    if (activityTemplate != null) {  
        activityTemplate.setTextApplier(  
                  new ReplacementTextApplier() {  
                  @Override  
                  public String getActualReplacementString(
                          ConfigurableCompletionProposal proposal) { 
                    Calendar start = GregorianCalendar.getInstance();
                    DateFormat formatter = new SimpleDateFormat("dd/MM/yyyy");
                    String startString = formatter.format(start.getTime());
                      return  "Activity activityname {\n"+
                              "\t\tstarts '"+startString+"';\n"+
                              "\t\tduration 10;\n"+
                              "\t\tcompleteness 0%;\n"+
                              "\t}";
                            }
                  }
                  );
         acceptor.accept(activityTemplate);  
    }
}
项目:plan    文件PlanProposalProvider.java   
@Override
public void completeActivity_Start(EObject model,Assignment assignment,final ContentAssistContext context,ICompletionProposalAcceptor acceptor) {
    //completeRuleCall(((RuleCall)assignment.getTerminal()),context,acceptor);
      ConfigurableCompletionProposal pickColor = (ConfigurableCompletionProposal) createCompletionProposal("Pick a date...",context);  
      if (pickColor != null) {  
                pickColor.setTextApplier(  
                  new ReplacementTextApplier() {  
                  @Override  
                  public String getActualReplacementString(  
                    ConfigurableCompletionProposal proposal) { 
                      display display = context.getViewer().getTextWidget().getdisplay();
                      Shell ns = new Shell(display);
                      ns.setLayout (new RowLayout ());
                      final DateTime calendar = new DateTime (ns,SWT.CALENDAR);
                      DateSelectionAdapter ds = new DateSelectionAdapter (calendar,ns); 

                      calendar.addSelectionListener (ds);
                      ns.pack();
                      ns.open();
                      while (!ns.isdisposed()) {
                          if (!display.readAnddispatch())
                            display.sleep();
                       }
                      return ds.dateString;

                      }

                  });
                acceptor.accept(pickColor);     
      }
}
项目:plan    文件PlanProposalProvider.java   
@Override
public void completeActivity_End(EObject model,ns); 
                      calendar.addSelectionListener (ds);
                      ns.pack();
                      ns.open();
                      while (!ns.isdisposed()) {
                          if (!display.readAnddispatch())
                            display.sleep();
                       }
                      return ds.dateString;

                      }

                  });
                acceptor.accept(pickColor);     
      }
}
项目:plan    文件PlanProposalProvider.java   
@Override
public void completeCheckPoint_End(EObject model,ns); 
                      calendar.addSelectionListener (ds);
                      ns.pack();
                      ns.open();
                      while (!ns.isdisposed()) {
                          if (!display.readAnddispatch())
                            display.sleep();
                       }
                      return ds.dateString;

                      }

                  });
                acceptor.accept(pickColor);     
      }
}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。