use of org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider in project InformationSystem by ObeoNetwork.
the class TransitionPropertiesEditionPartForm method createToFlatComboViewer.
/**
* @param parent the parent composite
* @param widgetFactory factory to use to instanciante widget of the form
*/
protected Composite createToFlatComboViewer(Composite parent, FormToolkit widgetFactory) {
createDescription(parent, StatemachineViewsRepository.Transition.Properties.to, StatemachineMessages.TransitionPropertiesEditionPart_ToLabel);
to = new EObjectFlatComboViewer(parent, !propertiesEditionComponent.isRequired(StatemachineViewsRepository.Transition.Properties.to, StatemachineViewsRepository.FORM_KIND));
widgetFactory.adapt(to);
to.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
GridData toData = new GridData(GridData.FILL_HORIZONTAL);
to.setLayoutData(toData);
to.addSelectionChangedListener(new ISelectionChangedListener() {
/**
* {@inheritDoc}
*
* @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent)
*/
public void selectionChanged(SelectionChangedEvent event) {
if (propertiesEditionComponent != null)
propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(TransitionPropertiesEditionPartForm.this, StatemachineViewsRepository.Transition.Properties.to, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.SET, null, getTo()));
}
});
to.setID(StatemachineViewsRepository.Transition.Properties.to);
// $NON-NLS-1$
FormUtils.createHelpButton(widgetFactory, parent, propertiesEditionComponent.getHelpContent(StatemachineViewsRepository.Transition.Properties.to, StatemachineViewsRepository.FORM_KIND), null);
// End of user code
return parent;
}
use of org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider in project InformationSystem by ObeoNetwork.
the class FinalStatePropertiesEditionPartImpl method createKeywordsMultiValuedEditor.
protected Composite createKeywordsMultiValuedEditor(Composite parent) {
keywords = SWTUtils.createScrollableText(parent, SWT.BORDER | SWT.READ_ONLY);
GridData keywordsData = new GridData(GridData.FILL_HORIZONTAL);
keywordsData.horizontalSpan = 2;
keywords.setLayoutData(keywordsData);
EditingUtils.setID(keywords, StatemachineViewsRepository.FinalState.Properties.keywords);
// $NON-NLS-1$
EditingUtils.setEEFtype(keywords, "eef::MultiValuedEditor::field");
editKeywords = new Button(parent, SWT.NONE);
editKeywords.setText(getDescription(StatemachineViewsRepository.FinalState.Properties.keywords, StatemachineMessages.FinalStatePropertiesEditionPart_KeywordsLabel));
GridData editKeywordsData = new GridData();
editKeywords.setLayoutData(editKeywordsData);
editKeywords.addSelectionListener(new SelectionAdapter() {
/**
* {@inheritDoc}
*
* @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
*/
public void widgetSelected(SelectionEvent e) {
EEFFeatureEditorDialog dialog = new EEFFeatureEditorDialog(// $NON-NLS-1$
keywords.getShell(), // $NON-NLS-1$
"FinalState", // $NON-NLS-1$
new AdapterFactoryLabelProvider(adapterFactory), keywordsList, EnvironmentPackage.eINSTANCE.getObeoDSMObject_Keywords().getEType(), null, false, true, null, null);
if (dialog.open() == Window.OK) {
keywordsList = dialog.getResult();
if (keywordsList == null) {
keywordsList = new BasicEList();
}
keywords.setText(keywordsList.toString());
propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(FinalStatePropertiesEditionPartImpl.this, StatemachineViewsRepository.FinalState.Properties.keywords, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.SET, null, new BasicEList(keywordsList)));
setHasChanged(true);
}
}
});
EditingUtils.setID(editKeywords, StatemachineViewsRepository.FinalState.Properties.keywords);
// $NON-NLS-1$
EditingUtils.setEEFtype(editKeywords, "eef::MultiValuedEditor::browsebutton");
// End of user code
return parent;
}
use of org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider in project InformationSystem by ObeoNetwork.
the class StateMachineEditor method createPages.
/**
* This is the method used by the framework to install your own controls.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
@Override
public void createPages() {
// Creates the model from the editor input
//
createModel();
//
if (!getEditingDomain().getResourceSet().getResources().isEmpty()) {
// Create a page for the selection tree view.
//
Tree tree = new Tree(getContainer(), SWT.MULTI);
selectionViewer = new TreeViewer(tree);
setCurrentViewer(selectionViewer);
selectionViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));
selectionViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
selectionViewer.setInput(editingDomain.getResourceSet());
selectionViewer.setSelection(new StructuredSelection(editingDomain.getResourceSet().getResources().get(0)), true);
selectionViewer.addDoubleClickListener(new OpenWizardOnDoubleClick(editingDomain, adapterFactory));
new AdapterFactoryTreeEditor(selectionViewer.getTree(), adapterFactory);
createContextMenuFor(selectionViewer);
int pageIndex = addPage(tree);
setPageText(pageIndex, getString("_UI_SelectionPage_label"));
getSite().getShell().getDisplay().asyncExec(new Runnable() {
public void run() {
setActivePage(0);
}
});
}
// Ensures that this editor will only display the page's tab
// area if there are more than one page
//
getContainer().addControlListener(new ControlAdapter() {
boolean guard = false;
@Override
public void controlResized(ControlEvent event) {
if (!guard) {
guard = true;
hideTabs();
guard = false;
}
}
});
getSite().getShell().getDisplay().asyncExec(new Runnable() {
public void run() {
updateProblemIndication();
}
});
}
use of org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider in project InformationSystem by ObeoNetwork.
the class StatePropertiesEditionPartImpl method createKeywordsMultiValuedEditor.
protected Composite createKeywordsMultiValuedEditor(Composite parent) {
keywords = SWTUtils.createScrollableText(parent, SWT.BORDER | SWT.READ_ONLY);
GridData keywordsData = new GridData(GridData.FILL_HORIZONTAL);
keywordsData.horizontalSpan = 2;
keywords.setLayoutData(keywordsData);
EditingUtils.setID(keywords, StatemachineViewsRepository.State.Properties.keywords);
// $NON-NLS-1$
EditingUtils.setEEFtype(keywords, "eef::MultiValuedEditor::field");
editKeywords = new Button(parent, SWT.NONE);
editKeywords.setText(getDescription(StatemachineViewsRepository.State.Properties.keywords, StatemachineMessages.StatePropertiesEditionPart_KeywordsLabel));
GridData editKeywordsData = new GridData();
editKeywords.setLayoutData(editKeywordsData);
editKeywords.addSelectionListener(new SelectionAdapter() {
/**
* {@inheritDoc}
*
* @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
*/
public void widgetSelected(SelectionEvent e) {
EEFFeatureEditorDialog dialog = new EEFFeatureEditorDialog(// $NON-NLS-1$
keywords.getShell(), // $NON-NLS-1$
"State", // $NON-NLS-1$
new AdapterFactoryLabelProvider(adapterFactory), keywordsList, EnvironmentPackage.eINSTANCE.getObeoDSMObject_Keywords().getEType(), null, false, true, null, null);
if (dialog.open() == Window.OK) {
keywordsList = dialog.getResult();
if (keywordsList == null) {
keywordsList = new BasicEList();
}
keywords.setText(keywordsList.toString());
propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(StatePropertiesEditionPartImpl.this, StatemachineViewsRepository.State.Properties.keywords, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.SET, null, new BasicEList(keywordsList)));
setHasChanged(true);
}
}
});
EditingUtils.setID(editKeywords, StatemachineViewsRepository.State.Properties.keywords);
// $NON-NLS-1$
EditingUtils.setEEFtype(editKeywords, "eef::MultiValuedEditor::browsebutton");
// End of user code
return parent;
}
use of org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider in project InformationSystem by ObeoNetwork.
the class TransitionPropertiesEditionPartImpl method createFromFlatComboViewer.
/**
* @param parent the parent composite
*/
protected Composite createFromFlatComboViewer(Composite parent) {
createDescription(parent, StatemachineViewsRepository.Transition.Properties.from, StatemachineMessages.TransitionPropertiesEditionPart_FromLabel);
from = new EObjectFlatComboViewer(parent, !propertiesEditionComponent.isRequired(StatemachineViewsRepository.Transition.Properties.from, StatemachineViewsRepository.SWT_KIND));
from.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
from.addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(TransitionPropertiesEditionPartImpl.this, StatemachineViewsRepository.Transition.Properties.from, PropertiesEditionEvent.CHANGE, PropertiesEditionEvent.SET, null, getFrom()));
}
});
GridData fromData = new GridData(GridData.FILL_HORIZONTAL);
from.setLayoutData(fromData);
from.setID(StatemachineViewsRepository.Transition.Properties.from);
// $NON-NLS-1$
SWTUtils.createHelpButton(parent, propertiesEditionComponent.getHelpContent(StatemachineViewsRepository.Transition.Properties.from, StatemachineViewsRepository.SWT_KIND), null);
// End of user code
return parent;
}
Aggregations