use of org.yakindu.sct.domain.extension.IDomain in project statecharts by Yakindu.
the class ContentProposalHandler method initProposalProvidersOnDemand.
protected void initProposalProvidersOnDemand() {
if (proposalProviders == null && getSelectedView() != null) {
IDomain domain = DomainRegistry.getDomain(getSelectedView().getElement());
Injector injector = domain.getInjector(IDomain.FEATURE_EDITOR);
injector.injectMembers(this);
}
}
use of org.yakindu.sct.domain.extension.IDomain in project statecharts by Yakindu.
the class DomainWizardPage method createControl.
public void createControl(Composite parent) {
final Composite composite = new Composite(parent, SWT.NONE);
GridDataFactory.fillDefaults().grab(true, true).applyTo(composite);
GridLayoutFactory.fillDefaults().applyTo(composite);
final Group domainSelectionGroup = new Group(composite, SWT.NONE);
domainSelectionGroup.setText("Select the statechart domain:");
GridLayoutFactory.fillDefaults().numColumns(2).applyTo(domainSelectionGroup);
GridDataFactory.fillDefaults().grab(true, true).applyTo(domainSelectionGroup);
Label spacer = new Label(domainSelectionGroup, SWT.NONE);
GridDataFactory.fillDefaults().span(2, 1).applyTo(spacer);
image = new Label(domainSelectionGroup, SWT.NONE);
GridDataFactory.fillDefaults().grab(false, false).applyTo(image);
domainCombo = new ComboViewer(domainSelectionGroup, SWT.READ_ONLY);
GridDataFactory.fillDefaults().grab(true, false).align(SWT.FILL, SWT.CENTER).applyTo(domainCombo.getCombo());
domainCombo.setContentProvider(new ArrayContentProvider());
domainCombo.setLabelProvider(new LabelProvider() {
@Override
public String getText(Object element) {
return ((IDomain) element).getName();
}
});
domainCombo.setInput(domainDescriptors);
description = new Label(domainSelectionGroup, SWT.WRAP);
GridDataFactory.fillDefaults().grab(true, false).span(2, 1).applyTo(description);
setControl(composite);
domainCombo.addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
IDomain domain = unwrap(event.getSelection());
description.setText(domain.getDescription());
image.setImage(asImage(domain));
domainSelectionGroup.layout();
}
private Image asImage(IDomain domain) {
ImageRegistry imageRegistry = DiagramActivator.getDefault().getImageRegistry();
Image image = imageRegistry.get(domain.getImagePath().toString());
if (image == null)
imageRegistry.put(domain.getImagePath().toString(), ImageDescriptor.createFromURL(domain.getImagePath()).createImage());
return imageRegistry.get(domain.getImagePath().toString());
}
});
trySelectDefaultDomain();
IConfigurationElement[] configurationElements = Platform.getExtensionRegistry().getConfigurationElementsFor("org.yakindu.sct.ui.wizard.create.contribution");
if (configurationElements.length > 0) {
Label spacer2 = new Label(domainSelectionGroup, SWT.NONE);
GridDataFactory.fillDefaults().span(2, 1).applyTo(spacer2);
for (IConfigurationElement iConfigurationElement : configurationElements) {
try {
CreationWizardContribution contribution = (CreationWizardContribution) iConfigurationElement.createExecutableExtension("class");
contribution.toDomainWizardPage(composite);
} catch (CoreException e) {
e.printStackTrace();
}
}
}
}
use of org.yakindu.sct.domain.extension.IDomain in project statecharts by Yakindu.
the class StatechartPropertySection method createDomainCombo.
protected void createDomainCombo(Composite leftColumn) {
Label label = getToolkit().createLabel(leftColumn, "Statechart domain");
GridDataFactory.fillDefaults().span(2, 1).align(SWT.FILL, SWT.CENTER).applyTo(label);
domainCombo = new ComboViewer(leftColumn);
GridDataFactory.fillDefaults().span(1, 1).align(SWT.FILL, SWT.CENTER).applyTo(domainCombo.getCombo());
Label spacer = getToolkit().createLabel(leftColumn, "");
GridDataFactory.fillDefaults().applyTo(spacer);
domainCombo.setContentProvider(new ArrayContentProvider());
domainCombo.setLabelProvider(new LabelProvider() {
@Override
public String getText(Object element) {
return ((IDomain) element).getName();
}
});
List<IDomain> domains = DomainRegistry.getDomains();
for (IDomain domainDescriptor : domains) {
domainCombo.add(domainDescriptor);
}
if (domains.size() <= 1) {
domainCombo.getControl().setEnabled(false);
}
}
use of org.yakindu.sct.domain.extension.IDomain in project statecharts by Yakindu.
the class StatechartDiagramEditor method getEditorInjector.
protected Injector getEditorInjector() {
IDomain domain = DomainRegistry.getDomain(getDiagram().getElement());
Injector injector = domain.getInjector(IDomain.FEATURE_EDITOR);
return injector;
}
use of org.yakindu.sct.domain.extension.IDomain in project statecharts by Yakindu.
the class PlugableXtextLabelEditPart method init.
private void init(String target) {
IDomain domain = DomainRegistry.getDomain(resolveSemanticElement());
injector = domain.getInjector(IDomain.FEATURE_EDITOR, target);
}
Aggregations