public void initializeFrom(ILaunchConfiguration configuration) { try { comp.getApplyTemplateCheck() .setSelection(configuration.getAttribute(IJ2SLauchingConfiguration.APPLY_TEMPLATE, true)); comp.updateTemaplteCheck(); comp.getTemplateCodeText() .setText(configuration.getAttribute(IJ2SLauchingConfiguration.VELOCITY_CODE, "")); comp.getOutputFileText() .setText(configuration.getAttribute(IJ2SLauchingConfiguration.OUTPUT_FILE_NAME, "")); comp.selectTemplateByName( configuration.getAttribute(IJ2SLauchingConfiguration.TEMPLATE_NAME, "")); } catch (CoreException e) { e.printStackTrace(); } }
public void performApply(ILaunchConfigurationWorkingCopy c) { // if(templateCodeDirty ) { // try { // templateCodeDirty=false; // comp.doSaveTemplateAs("Template code modified! \nIf you whish to save the changes, please // enter the name\nof new template."); // } catch (Exception e) { // e.printStackTrace(); // } // } boolean applyTemplate = comp.getApplyTemplateCheck().getSelection(); String templateCode = comp.getTemplateCodeText().getText(); int selIdx = comp.getTemplateCombo().getSelectionIndex(); String templateName = selIdx == -1 ? "" : comp.getTemplateCombo().getItems()[selIdx]; String outputFileNameTemplate = comp.getOutputFileText().getText(); c.setAttribute(IJ2SLauchingConfiguration.APPLY_TEMPLATE, applyTemplate); c.setAttribute(IJ2SLauchingConfiguration.VELOCITY_CODE, templateCode); c.setAttribute(IJ2SLauchingConfiguration.OUTPUT_FILE_NAME, outputFileNameTemplate); c.setAttribute(IJ2SLauchingConfiguration.TEMPLATE_NAME, templateName); }