|
Lines 65-71
Link Here
|
| 65 |
import org.eclipse.tptp.wsdm.tooling.validation.builders.internal.GatherErrors; |
65 |
import org.eclipse.tptp.wsdm.tooling.validation.builders.internal.GatherErrors; |
| 66 |
import org.eclipse.tptp.wsdm.tooling.validation.mrt.internal.MrtDefinitionValidator; |
66 |
import org.eclipse.tptp.wsdm.tooling.validation.mrt.internal.MrtDefinitionValidator; |
| 67 |
import org.eclipse.tptp.wsdm.tooling.wizard.capability.internal.NewCapabilityWizard; |
67 |
import org.eclipse.tptp.wsdm.tooling.wizard.capability.internal.NewCapabilityWizard; |
|
|
68 |
import org.eclipse.tptp.wsdm.tooling.wizard.mrt.internal.MRTCodeGenerationDelegate; |
| 69 |
import org.eclipse.tptp.wsdm.tooling.wizard.mrt.internal.NewProjectWizard; |
| 68 |
import org.eclipse.tptp.wsdm.tooling.wizard.mrt.internal.WorkspaceCapSelector; |
70 |
import org.eclipse.tptp.wsdm.tooling.wizard.mrt.internal.WorkspaceCapSelector; |
|
|
71 |
import org.eclipse.ui.IFileEditorInput; |
| 69 |
import org.eclipse.ui.IWorkbenchPage; |
72 |
import org.eclipse.ui.IWorkbenchPage; |
| 70 |
import org.eclipse.ui.PartInitException; |
73 |
import org.eclipse.ui.PartInitException; |
| 71 |
import org.eclipse.ui.PlatformUI; |
74 |
import org.eclipse.ui.PlatformUI; |
|
Lines 148-153
Link Here
|
| 148 |
|
151 |
|
| 149 |
private Composite _newCapabilitySection; |
152 |
private Composite _newCapabilitySection; |
| 150 |
|
153 |
|
|
|
154 |
private Composite _CodeGenerationSection; |
| 155 |
|
| 151 |
private Label _errorLabel; |
156 |
private Label _errorLabel; |
| 152 |
|
157 |
|
| 153 |
/** |
158 |
/** |
|
Lines 352-368
Link Here
|
| 352 |
initMrtWidgets(); |
357 |
initMrtWidgets(); |
| 353 |
// Initialice new capability related widgets |
358 |
// Initialice new capability related widgets |
| 354 |
initNewCapWidgets(); |
359 |
initNewCapWidgets(); |
|
|
360 |
initCodeGenWidget(); |
| 355 |
} |
361 |
} |
| 356 |
|
362 |
|
| 357 |
/** |
363 |
/** |
| 358 |
* Initialize all the sections. |
364 |
* Initialize all the sections. |
| 359 |
*/ |
365 |
*/ |
| 360 |
private void initSections() { |
366 |
private void initSections() { |
| 361 |
_mrtSection = createSection(Messages.MEP_TYPE, ""); |
367 |
_mrtSection = createSection(Messages.MEP_TYPE, "",1,2); |
| 362 |
|
368 |
|
| 363 |
_newCapabilitySection = createSection(Messages.NEW_CUSTOM_CAP, |
369 |
_newCapabilitySection = createSection(Messages.NEW_CUSTOM_CAP, |
| 364 |
Messages.NEW_CUSTOM_CAP_CREATE); |
370 |
Messages.NEW_CUSTOM_CAP_CREATE); |
| 365 |
|
371 |
|
|
|
372 |
_CodeGenerationSection = createSection(Messages.MRT_CODE_GEN,Messages.MRT_CODE_GEN_TEXT); |
| 373 |
|
| 366 |
} |
374 |
} |
| 367 |
|
375 |
|
| 368 |
/** |
376 |
/** |
|
Lines 520-525
Link Here
|
| 520 |
toolkit.paintBordersFor(_newCapabilitySection); |
528 |
toolkit.paintBordersFor(_newCapabilitySection); |
| 521 |
} |
529 |
} |
| 522 |
|
530 |
|
|
|
531 |
private void initCodeGenWidget() { |
| 532 |
GridLayout layout = new GridLayout(); |
| 533 |
_CodeGenerationSection.setLayout(layout); |
| 534 |
|
| 535 |
FormToolkit toolkit = getToolkit(); |
| 536 |
|
| 537 |
// Composite to held link |
| 538 |
Composite codeGenComposite = toolkit |
| 539 |
.createComposite(_CodeGenerationSection); |
| 540 |
layout = new GridLayout(); |
| 541 |
codeGenComposite.setLayout(layout); |
| 542 |
GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING); |
| 543 |
gd.horizontalSpan = 1; |
| 544 |
codeGenComposite.setLayoutData(gd); |
| 545 |
|
| 546 |
// Hyperlink group |
| 547 |
Shell shell = getForm().getShell(); |
| 548 |
HyperlinkGroup codeGenGroup = createHyperlinkGroup(shell); |
| 549 |
|
| 550 |
// Create listener to handle code generation link |
| 551 |
IHyperlinkListener codeGenLinkListener = new IHyperlinkListener() { |
| 552 |
public void linkEntered(HyperlinkEvent event) { |
| 553 |
} |
| 554 |
|
| 555 |
public void linkExited(HyperlinkEvent event) { |
| 556 |
} |
| 557 |
|
| 558 |
public void linkActivated(HyperlinkEvent event) { |
| 559 |
IFile mrtFile = ((IFileEditorInput) _editor.getEditorInput()).getFile(); |
| 560 |
MRTCodeGenerationDelegate mrtCodeGen = new MRTCodeGenerationDelegate(mrtFile); |
| 561 |
NewProjectWizard newprjw = new NewProjectWizard(mrtCodeGen); |
| 562 |
WizardDialog wd = new WizardDialog(getForm().getShell(), newprjw); |
| 563 |
wd.create(); |
| 564 |
newprjw.setWindowTitle(Messages.NEW_CUSTOM_CAP); |
| 565 |
newprjw.addPages(); |
| 566 |
wd.open(); |
| 567 |
} |
| 568 |
}; |
| 569 |
|
| 570 |
// Create Code Generation Link |
| 571 |
Image capEditorImage = EclipseUtils.loadImage(getForm().getShell() |
| 572 |
.getDisplay(), "icons/capability.gif"); |
| 573 |
Hyperlink codeGenLink = createLink(codeGenComposite, |
| 574 |
"Code Generation", codeGenLinkListener, |
| 575 |
capEditorImage); |
| 576 |
codeGenGroup.add(codeGenLink); |
| 577 |
|
| 578 |
toolkit.paintBordersFor(_CodeGenerationSection); |
| 579 |
|
| 580 |
} |
| 581 |
|
| 523 |
// Method to create hyperlinkgroup |
582 |
// Method to create hyperlinkgroup |
| 524 |
private HyperlinkGroup createHyperlinkGroup(Shell shell) { |
583 |
private HyperlinkGroup createHyperlinkGroup(Shell shell) { |
| 525 |
HyperlinkGroup group = new HyperlinkGroup(shell.getDisplay()); |
584 |
HyperlinkGroup group = new HyperlinkGroup(shell.getDisplay()); |