use of org.eclipse.draw2d.ActionEvent in project whole by wholeplatform.
the class AbstractPart method createToggleListener.
protected ActionListener createToggleListener() {
return new ActionListener() {
public void actionPerformed(ActionEvent event) {
EditPartViewer viewer = getViewer();
IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
for (Iterator<?> i = selection.iterator(); i.hasNext(); ) {
EditPart selectedPart = (EditPart) i.next();
if (isDescendant(selectedPart))
viewer.deselect(selectedPart);
}
if (isDescendant(viewer.getFocusEditPart()))
viewer.setFocus(null);
}
};
}
use of org.eclipse.draw2d.ActionEvent in project archi by archimatetool.
the class ToolEntryEditPart method createFigure.
@Override
public IFigure createFigure() {
customLabel = new DetailedLabelFigure();
Clickable button = new ToolEntryToggle(customLabel);
button.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent event) {
getPaletteViewer().setActiveTool(getToolEntry());
}
});
return button;
}
use of org.eclipse.draw2d.ActionEvent in project whole by wholeplatform.
the class EnvironmentPart method createFigure.
protected IFigure createFigure() {
Environment entity = getModelEntity();
return new EnvironmentFigure(new ActionListener() {
public void actionPerformed(ActionEvent event) {
Environment entity = getModelEntity();
ModelTransactionCommand command = new ModelTransactionCommand(entity);
try {
command.begin();
IBindingManager bm = entity.getBindingManager().getValue();
if (Matcher.match(EnvironmentEntityDescriptorEnum.Bindings, entity.getBindings()))
entity.setBindings((BindingsModel) BindingManagerFactory.instance.createFlatScopedBindingsModel(bm));
else
entity.setBindings((BindingsModel) BindingManagerFactory.instance.createFlatBindingsModel(bm));
command.commit();
getViewer().getEditDomain().getCommandStack().execute(command);
} catch (Exception e) {
command.rollbackIfNeeded();
}
}
}, Matcher.matchImpl(EnvironmentEntityDescriptorEnum.ScopedBindings, entity.getBindings()));
}
Aggregations