use of com.archimatetool.editor.model.commands.EObjectFeatureCommand in project archi by archimatetool.
the class AbstractECorePropertySection method createDocumentationControl.
/**
* Create a Documentation control
*/
protected PropertySectionTextControl createDocumentationControl(Composite parent, String hint) {
// Label
Label label = createLabel(parent, Messages.AbstractECorePropertySection_2, ITabbedLayoutConstants.STANDARD_LABEL_WIDTH, SWT.NONE);
// CSS
// $NON-NLS-1$ //$NON-NLS-2$
label.setData("org.eclipse.e4.ui.css.CssClassName", "PropertiesDocumentationLabel");
// Text
StyledTextControl styledTextControl = createStyledTextControl(parent, SWT.NONE);
styledTextControl.setMessage(hint);
// CSS
// $NON-NLS-1$ //$NON-NLS-2$
styledTextControl.getControl().setData("org.eclipse.e4.ui.css.CssClassName", "PropertiesDocumentationText");
PropertySectionTextControl textDoc = new PropertySectionTextControl(styledTextControl.getControl(), IArchimatePackage.Literals.DOCUMENTABLE__DOCUMENTATION) {
@Override
protected void textChanged(String oldText, String newText) {
if (fObjects != null) {
CompoundCommand result = new CompoundCommand(Messages.AbstractECorePropertySection_3);
for (EObject eObject : fObjects) {
if (isAlive(eObject)) {
Command cmd = new EObjectFeatureCommand(Messages.AbstractECorePropertySection_3, eObject, IArchimatePackage.Literals.DOCUMENTABLE__DOCUMENTATION, newText);
if (cmd.canExecute()) {
result.add(cmd);
}
}
}
executeCommand(result.unwrap());
}
}
};
return textDoc;
}
use of com.archimatetool.editor.model.commands.EObjectFeatureCommand in project archi by archimatetool.
the class AbstractECorePropertySection method createNameControl.
// ===========================================================================================================================
// WIDGET FACTORY METHODS
// ===========================================================================================================================
/**
* Create a Name control
*/
protected PropertySectionTextControl createNameControl(Composite parent, String hint) {
// Label
Label label = createLabel(parent, Messages.AbstractECorePropertySection_0, ITabbedLayoutConstants.STANDARD_LABEL_WIDTH, SWT.CENTER);
// CSS
// $NON-NLS-1$ //$NON-NLS-2$
label.setData("org.eclipse.e4.ui.css.CssClassName", "PropertiesNameLabel");
// Text
Text textControl = createSingleTextControl(parent, SWT.NONE);
textControl.setMessage(hint);
// CSS
// $NON-NLS-1$ //$NON-NLS-2$
textControl.setData("org.eclipse.e4.ui.css.CssClassName", "PropertiesNameText");
PropertySectionTextControl textName = new PropertySectionTextControl(textControl, IArchimatePackage.Literals.NAMEABLE__NAME) {
@Override
protected void textChanged(String oldText, String newText) {
if (fObjects != null) {
CompoundCommand result = new NonNotifyingCompoundCommand(Messages.AbstractECorePropertySection_1);
for (EObject eObject : fObjects) {
if (isAlive(eObject)) {
Command cmd = new // $NON-NLS-1$
EObjectFeatureCommand(// $NON-NLS-1$
Messages.AbstractECorePropertySection_1 + " " + oldText, // $NON-NLS-1$
eObject, IArchimatePackage.Literals.NAMEABLE__NAME, newText);
if (cmd.canExecute()) {
result.add(cmd);
}
}
}
executeCommand(result.unwrap());
}
}
};
return textName;
}
use of com.archimatetool.editor.model.commands.EObjectFeatureCommand in project archi by archimatetool.
the class AccessRelationshipSection method createControls.
@Override
protected void createControls(Composite parent) {
createLabel(parent, Messages.AccessRelationshipSection_4, ITabbedLayoutConstants.STANDARD_LABEL_WIDTH, SWT.CENTER);
fComboType = new Combo(parent, SWT.READ_ONLY);
getWidgetFactory().adapt(fComboType, true, true);
fComboType.setItems(fComboTypeItems);
fComboType.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
fComboType.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
CompoundCommand result = new CompoundCommand();
for (EObject relationship : getEObjects()) {
if (isAlive(relationship)) {
Command cmd = new EObjectFeatureCommand(Messages.AccessRelationshipSection_5, relationship, IArchimatePackage.Literals.ACCESS_RELATIONSHIP__ACCESS_TYPE, fTypeValues[fComboType.getSelectionIndex()]);
if (cmd.canExecute()) {
result.add(cmd);
}
}
}
executeCommand(result.unwrap());
}
});
// Help ID
PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, HELP_ID);
}
use of com.archimatetool.editor.model.commands.EObjectFeatureCommand in project archi by archimatetool.
the class ArchimateModelSection method createPurposeControl.
private void createPurposeControl(Composite parent) {
// Label
createLabel(parent, Messages.ArchimateModelSection_2, STANDARD_LABEL_WIDTH, SWT.NONE);
// Text
StyledTextControl styledTextControl = createStyledTextControl(parent, SWT.NONE);
styledTextControl.setMessage(Messages.ArchimateModelSection_4);
fTextPurpose = new PropertySectionTextControl(styledTextControl.getControl(), IArchimatePackage.Literals.ARCHIMATE_MODEL__PURPOSE) {
@Override
protected void textChanged(String oldText, String newText) {
EObject model = getFirstSelectedObject();
if (isAlive(model)) {
Command cmd = new EObjectFeatureCommand(Messages.ArchimateModelSection_3, getFirstSelectedObject(), IArchimatePackage.Literals.ARCHIMATE_MODEL__PURPOSE, newText);
if (cmd.canExecute()) {
executeCommand(cmd);
}
}
}
};
}
use of com.archimatetool.editor.model.commands.EObjectFeatureCommand in project archi by archimatetool.
the class ViewpointSection method createControls.
@Override
protected void createControls(Composite parent) {
createLabel(parent, Messages.ViewpointSection_0, ITabbedLayoutConstants.STANDARD_LABEL_WIDTH, SWT.CENTER);
fComboViewer = new ComboViewer(new Combo(parent, SWT.READ_ONLY | SWT.BORDER));
fComboViewer.getCombo().setVisibleItemCount(12);
fComboViewer.getControl().setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
getWidgetFactory().adapt(fComboViewer.getControl(), true, true);
fComboViewer.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
if (fIsRefreshing) {
// A Viewer will get a selectionChanged event when setting it
return;
}
IViewpoint viewPoint = (IViewpoint) ((IStructuredSelection) event.getSelection()).getFirstElement();
if (viewPoint != null) {
CompoundCommand result = new CompoundCommand();
for (EObject diagramModel : getEObjects()) {
if (isAlive(diagramModel)) {
Command cmd = new EObjectFeatureCommand(Messages.ViewpointSection_1, diagramModel, IArchimatePackage.Literals.ARCHIMATE_DIAGRAM_MODEL__VIEWPOINT, viewPoint.getID());
if (cmd.canExecute()) {
result.add(cmd);
}
}
}
executeCommand(result.unwrap());
}
}
});
fComboViewer.setContentProvider(new IStructuredContentProvider() {
@Override
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
}
@Override
public void dispose() {
}
@Override
public Object[] getElements(Object inputElement) {
return ViewpointManager.INSTANCE.getAllViewpoints().toArray();
}
});
fComboViewer.setLabelProvider(new LabelProvider() {
@Override
public String getText(Object element) {
return ((IViewpoint) element).getName();
}
});
// $NON-NLS-1$
fComboViewer.setInput("");
// Help ID
PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, HELP_ID);
}
Aggregations