|
Lines 14-19
Link Here
|
| 14 |
|
14 |
|
| 15 |
import java.util.Arrays; |
15 |
import java.util.Arrays; |
| 16 |
|
16 |
|
|
|
17 |
import org.eclipse.core.resources.IFile; |
| 17 |
import org.eclipse.emf.ecore.resource.Resource; |
18 |
import org.eclipse.emf.ecore.resource.Resource; |
| 18 |
import org.eclipse.emf.edit.domain.EditingDomain; |
19 |
import org.eclipse.emf.edit.domain.EditingDomain; |
| 19 |
import org.eclipse.jface.action.Action; |
20 |
import org.eclipse.jface.action.Action; |
|
Lines 39-44
Link Here
|
| 39 |
import org.eclipse.swt.widgets.Listener; |
40 |
import org.eclipse.swt.widgets.Listener; |
| 40 |
import org.eclipse.swt.widgets.Shell; |
41 |
import org.eclipse.swt.widgets.Shell; |
| 41 |
import org.eclipse.swt.widgets.Text; |
42 |
import org.eclipse.swt.widgets.Text; |
|
|
43 |
import org.eclipse.tptp.wsdm.tooling.codegen.mrt.internal.MRTCodeGenerationDelegate; |
| 44 |
import org.eclipse.tptp.wsdm.tooling.codegen.mrt.internal.NewProjectWizard; |
| 42 |
import org.eclipse.tptp.wsdm.tooling.editor.internal.Category; |
45 |
import org.eclipse.tptp.wsdm.tooling.editor.internal.Category; |
| 43 |
import org.eclipse.tptp.wsdm.tooling.model.capabilities.Capability; |
46 |
import org.eclipse.tptp.wsdm.tooling.model.capabilities.Capability; |
| 44 |
import org.eclipse.tptp.wsdm.tooling.model.manageableResourceType.ManageableResourceType; |
47 |
import org.eclipse.tptp.wsdm.tooling.model.manageableResourceType.ManageableResourceType; |
|
Lines 47-52
Link Here
|
| 47 |
import org.eclipse.tptp.wsdm.tooling.util.internal.MrtUtils; |
50 |
import org.eclipse.tptp.wsdm.tooling.util.internal.MrtUtils; |
| 48 |
import org.eclipse.tptp.wsdm.tooling.wizard.capability.internal.NewCapabilityWizard; |
51 |
import org.eclipse.tptp.wsdm.tooling.wizard.capability.internal.NewCapabilityWizard; |
| 49 |
import org.eclipse.tptp.wsdm.tooling.wizard.mrt.internal.CapabilitySelectionDialog; |
52 |
import org.eclipse.tptp.wsdm.tooling.wizard.mrt.internal.CapabilitySelectionDialog; |
|
|
53 |
import org.eclipse.ui.IFileEditorInput; |
| 50 |
import org.eclipse.ui.IPropertyListener; |
54 |
import org.eclipse.ui.IPropertyListener; |
| 51 |
import org.eclipse.ui.forms.HyperlinkGroup; |
55 |
import org.eclipse.ui.forms.HyperlinkGroup; |
| 52 |
import org.eclipse.ui.forms.events.HyperlinkEvent; |
56 |
import org.eclipse.ui.forms.events.HyperlinkEvent; |
|
Lines 108-133
Link Here
|
| 108 |
|
112 |
|
| 109 |
protected Capability _selectedCapForDelete; |
113 |
protected Capability _selectedCapForDelete; |
| 110 |
|
114 |
|
|
|
115 |
private Composite _CodeGenerationSection; |
| 116 |
|
| 111 |
/** |
117 |
/** |
| 112 |
* Creates the Manageable Resource Type Definition page to implement |
118 |
* Creates the Manageable Resource Type Definition page to implement |
| 113 |
* specified capabilities |
119 |
* specified capabilities |
| 114 |
* |
120 |
* |
| 115 |
* @param parent - |
121 |
* @param parent - UI Composite to be used |
| 116 |
* UI Composite to be used |
122 |
* @param formTitle - Title of the page |
| 117 |
* @param formTitle - |
123 |
* @param editingDomain - Handle to the context of the editor |
| 118 |
* Title of the page |
124 |
* @param mrt - Manageable Resource Type definition |
| 119 |
* @param editingDomain - |
125 |
* @param allCapsPassed - All capabilities from workspace |
| 120 |
* Handle to the context of the editor |
126 |
* @param mrtCaps1 - Capabilities implemented by the manageable resource type |
| 121 |
* @param mrt - |
127 |
* @param containerName - Containing project for the manageable resource type |
| 122 |
* Manageable Resource Type definition |
128 |
* @param editor - Handle to the editor |
| 123 |
* @param allCapsPassed - |
|
|
| 124 |
* All capabilities from workspace |
| 125 |
* @param mrtCaps1 - |
| 126 |
* Capabilities implemented by the manageable resource type |
| 127 |
* @param containerName - |
| 128 |
* Containing project for the manageable resource type |
| 129 |
* @param editor - |
| 130 |
* Handle to the editor |
| 131 |
*/ |
129 |
*/ |
| 132 |
public MrtPrototypeForm(Composite parent, String formTitle, |
130 |
public MrtPrototypeForm(Composite parent, String formTitle, |
| 133 |
EditingDomain editingDomain, MrtEditor editor) |
131 |
EditingDomain editingDomain, MrtEditor editor) |
|
Lines 202-207
Link Here
|
| 202 |
initMrtWidgets(); |
200 |
initMrtWidgets(); |
| 203 |
// Initialice new capability related widgets |
201 |
// Initialice new capability related widgets |
| 204 |
initNewCapWidgets(); |
202 |
initNewCapWidgets(); |
|
|
203 |
initCodeGenWidget(); |
| 205 |
} |
204 |
} |
| 206 |
|
205 |
|
| 207 |
/** |
206 |
/** |
|
Lines 209-219
Link Here
|
| 209 |
*/ |
208 |
*/ |
| 210 |
private void initSections() |
209 |
private void initSections() |
| 211 |
{ |
210 |
{ |
| 212 |
_mrtSection = createSection(Messages.MEP_TYPE, ""); |
211 |
//_mrtSection = createSection(Messages.MEP_TYPE, ""); |
| 213 |
|
212 |
_mrtSection = createSection(Messages.MEP_TYPE, "",1,2); |
|
|
213 |
|
| 214 |
_newCapabilitySection = createSection(Messages.NEW_CUSTOM_CAP, |
214 |
_newCapabilitySection = createSection(Messages.NEW_CUSTOM_CAP, |
| 215 |
Messages.NEW_CUSTOM_CAP_CREATE); |
215 |
Messages.NEW_CUSTOM_CAP_CREATE); |
| 216 |
|
216 |
|
|
|
217 |
_CodeGenerationSection = createSection(Messages.MRT_CODE_GEN,Messages.MRT_CODE_GEN_TEXT); |
| 217 |
} |
218 |
} |
| 218 |
|
219 |
|
| 219 |
/** |
220 |
/** |
|
Lines 376-381
Link Here
|
| 376 |
toolkit.paintBordersFor(_newCapabilitySection); |
377 |
toolkit.paintBordersFor(_newCapabilitySection); |
| 377 |
} |
378 |
} |
| 378 |
|
379 |
|
|
|
380 |
private void initCodeGenWidget() { |
| 381 |
GridLayout layout = new GridLayout(); |
| 382 |
_CodeGenerationSection.setLayout(layout); |
| 383 |
|
| 384 |
FormToolkit toolkit = getToolkit(); |
| 385 |
|
| 386 |
// Composite to held link |
| 387 |
Composite codeGenComposite = toolkit |
| 388 |
.createComposite(_CodeGenerationSection); |
| 389 |
layout = new GridLayout(); |
| 390 |
codeGenComposite.setLayout(layout); |
| 391 |
GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING); |
| 392 |
gd.horizontalSpan = 1; |
| 393 |
codeGenComposite.setLayoutData(gd); |
| 394 |
|
| 395 |
// Hyperlink group |
| 396 |
Shell shell = getForm().getShell(); |
| 397 |
HyperlinkGroup codeGenGroup = createHyperlinkGroup(shell); |
| 398 |
|
| 399 |
// Create listener to handle code generation link |
| 400 |
IHyperlinkListener codeGenLinkListener = new IHyperlinkListener() { |
| 401 |
public void linkEntered(HyperlinkEvent event) { |
| 402 |
} |
| 403 |
|
| 404 |
public void linkExited(HyperlinkEvent event) { |
| 405 |
} |
| 406 |
|
| 407 |
public void linkActivated(HyperlinkEvent event) { |
| 408 |
IFile mrtFile = ((IFileEditorInput) _editor.getEditorInput()).getFile(); |
| 409 |
MRTCodeGenerationDelegate mrtCodeGen = new MRTCodeGenerationDelegate(mrtFile); |
| 410 |
NewProjectWizard newprjw = new NewProjectWizard(mrtCodeGen); |
| 411 |
WizardDialog wd = new WizardDialog(getForm().getShell(), newprjw); |
| 412 |
newprjw.setWindowTitle(Messages.MRT_CODE_GEN); |
| 413 |
wd.open(); |
| 414 |
} |
| 415 |
}; |
| 416 |
|
| 417 |
// Create Code Generation Link |
| 418 |
Image capEditorImage = EclipseUtils.loadImage(getForm().getShell() |
| 419 |
.getDisplay(), "icons/capability.gif"); |
| 420 |
Hyperlink codeGenLink = createLink(codeGenComposite, |
| 421 |
"Code Generation", codeGenLinkListener, |
| 422 |
capEditorImage); |
| 423 |
codeGenGroup.add(codeGenLink); |
| 424 |
|
| 425 |
toolkit.paintBordersFor(_CodeGenerationSection); |
| 426 |
|
| 427 |
} |
| 428 |
|
| 379 |
// Method to create hyperlinkgroup |
429 |
// Method to create hyperlinkgroup |
| 380 |
private HyperlinkGroup createHyperlinkGroup(Shell shell) |
430 |
private HyperlinkGroup createHyperlinkGroup(Shell shell) |
| 381 |
{ |
431 |
{ |