@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); } }
@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); } }
@Override public void completeActivity_End(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); } }
@Override public void completeCheckPoint_End(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); } }