Search in sources :

Example 11 with ActionEvent

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);
        }
    };
}
Also used : ActionListener(org.eclipse.draw2d.ActionListener) ActionEvent(org.eclipse.draw2d.ActionEvent) AbstractGraphicalEditPart(org.eclipse.gef.editparts.AbstractGraphicalEditPart) AccessibleEditPart(org.eclipse.gef.AccessibleEditPart) AbstractEditPart(org.eclipse.gef.editparts.AbstractEditPart) EditPart(org.eclipse.gef.EditPart) EditPartViewer(org.eclipse.gef.EditPartViewer) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection)

Example 12 with ActionEvent

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;
}
Also used : ActionListener(org.eclipse.draw2d.ActionListener) Clickable(org.eclipse.draw2d.Clickable) ActionEvent(org.eclipse.draw2d.ActionEvent)

Example 13 with ActionEvent

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()));
}
Also used : ModelTransactionCommand(org.whole.lang.ui.commands.ModelTransactionCommand) ActionListener(org.eclipse.draw2d.ActionListener) ActionEvent(org.eclipse.draw2d.ActionEvent) IBindingManager(org.whole.lang.bindings.IBindingManager) Environment(org.whole.lang.environment.model.Environment) EnvironmentFigure(org.whole.lang.environment.ui.figures.EnvironmentFigure)

Aggregations

ActionEvent (org.eclipse.draw2d.ActionEvent)13 ActionListener (org.eclipse.draw2d.ActionListener)12 Clickable (org.eclipse.draw2d.Clickable)3 Orientable (org.eclipse.draw2d.Orientable)2 SimpleHtmlFigure (org.talend.commons.ui.utils.workbench.gef.SimpleHtmlFigure)2 Field (java.lang.reflect.Field)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Map (java.util.Map)1 Figure (org.eclipse.draw2d.Figure)1 IFigure (org.eclipse.draw2d.IFigure)1 ImageFigure (org.eclipse.draw2d.ImageFigure)1 RoundedRectangle (org.eclipse.draw2d.RoundedRectangle)1 ToolbarLayout (org.eclipse.draw2d.ToolbarLayout)1 Dimension (org.eclipse.draw2d.geometry.Dimension)1 AccessibleEditPart (org.eclipse.gef.AccessibleEditPart)1 EditPart (org.eclipse.gef.EditPart)1 EditPartViewer (org.eclipse.gef.EditPartViewer)1 AbstractEditPart (org.eclipse.gef.editparts.AbstractEditPart)1 AbstractGraphicalEditPart (org.eclipse.gef.editparts.AbstractGraphicalEditPart)1