public class GiveFeedbackWizard extends Wizard implements MyWizard{ private Feedback feedback; @Inject DatabaseAccessService dbservice; @Inject CustomerService custService; @Inject @Named(IServiceConstants.ACTIVE_SHELL) Shell shell; public GiveFeedbackWizard(){ feedback = TICDModelFactory.eINSTANCE.createFeedback(); setWindowTitle("Customer Feedback"); // I know the following doesn't work as the fields haven't been injected yet addPage(new FeedbackFirstWizardPage(feedback, dbservice)); addPage(new FeedbackRatingWizardPage(feedback)); addPage(new FeedbackTextWizardPage(feedback)); } @Override public boolean performFinish() { System.out.println(feedback); Customer activeCustomer = custService.getActiveCustomer(); activeCustomer.getFeedbacks().add(feedback); dbservice.saveCustomer(activeCustomer); return true; } }
public void createWizard(WizardTypes type) { IEclipseContext ctx = EclipseContextFactory.getServiceContext(Activator.getContext()); switch(type){ case CUSTOMER: wizard = ContextInjectionFactory.make(CreateCustomerWizard.class, ctx); // wizard.setDBAccessService(dbservice); // wizard.setCustomerService(custService); break; case BOOKING: // TODO create and return BookingWizard wizard = null; break; case FEEDBACK: // TODO create and return FeedbackWizard wizard = ContextInjectionFactory.make(GiveFeedbackWizard.class, ctx); // wizard.setDBAccessService(dbservice); // wizard.setCustomerService(custService); break; default: wizard = null; break; } }