Search in sources :

Example 51 with ToolBarManager

use of org.eclipse.jface.action.ToolBarManager in project erlide_eclipse by erlang.

the class PresenterControlCreator method doCreateInformationControl.

@Override
protected IInformationControl doCreateInformationControl(final Shell parent) {
    if (ErlangBrowserInformationControl.isAvailable(parent)) {
        final ToolBarManager tbm = new ToolBarManager(SWT.FLAT);
        final String font = JFaceResources.DIALOG_FONT;
        final ErlangBrowserInformationControl control = new ErlangBrowserInformationControl(parent, font, tbm);
        final PresenterControlCreator.BackAction backAction = new PresenterControlCreator.BackAction(control);
        backAction.setEnabled(false);
        tbm.add(backAction);
        final PresenterControlCreator.ForwardAction forwardAction = new PresenterControlCreator.ForwardAction(control);
        tbm.add(forwardAction);
        forwardAction.setEnabled(false);
        final PresenterControlCreator.ShowInEdocViewAction showInEdocViewAction = new PresenterControlCreator.ShowInEdocViewAction(control);
        tbm.add(showInEdocViewAction);
        if (editor != null) {
            final OpenDeclarationAction openDeclarationAction = new OpenDeclarationAction(control, editor);
            tbm.add(openDeclarationAction);
            final SimpleSelectionProvider selectionProvider = new SimpleSelectionProvider();
            final OpenEdocInExternalBrowserAction openEdocInExternalBrowserAction = new OpenEdocInExternalBrowserAction(editor.getSite(), null);
            openEdocInExternalBrowserAction.setSpecialSelectionProvider(selectionProvider);
            selectionProvider.addSelectionChangedListener(openEdocInExternalBrowserAction);
            final ImageDescriptor descriptor = ErlideImage.OBJS_EXTERNALBROWSER.getDescriptor();
            openEdocInExternalBrowserAction.setImageDescriptor(descriptor);
            openEdocInExternalBrowserAction.setDisabledImageDescriptor(descriptor);
            selectionProvider.setSelection(new StructuredSelection());
            tbm.add(openEdocInExternalBrowserAction);
            // OpenExternalBrowserAction openExternalJavadocAction = new
            // OpenExternalBrowserAction(
            // parent.getDisplay(), selectionProvider);
            // selectionProvider
            // .addSelectionChangedListener(openExternalJavadocAction);
            // selectionProvider.setSelection(new
            // StructuredSelection());
            // tbm.add(openExternalJavadocAction);
            final IInputChangedListener inputChangeListener = newInput -> {
                backAction.update();
                forwardAction.update();
                if (newInput == null) {
                    selectionProvider.setSelection(new StructuredSelection());
                } else if (newInput instanceof ErlangBrowserInformationControlInput) {
                    final ErlangBrowserInformationControlInput input = (ErlangBrowserInformationControlInput) newInput;
                    final Object inputElement = input.getInputElement();
                    selectionProvider.setSelection(new StructuredSelection(inputElement));
                    final boolean hasInputElement = inputElement != null;
                    showInEdocViewAction.setEnabled(hasInputElement);
                    openDeclarationAction.setEnabled(hasInputElement);
                    openEdocInExternalBrowserAction.setInput(newInput);
                    openEdocInExternalBrowserAction.setEnabled(hasInputElement);
                }
            };
            control.addInputChangeListener(inputChangeListener);
        }
        tbm.update(true);
        return control;
    }
    return new DefaultInformationControl(parent, EditorsUI.getTooltipAffordanceString(), new ErlInformationPresenter(true));
}
Also used : JFaceResources(org.eclipse.jface.resource.JFaceResources) AbstractErlangEditor(org.erlide.ui.editors.erl.AbstractErlangEditor) EditorUtility(org.erlide.ui.editors.util.EditorUtility) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) DefaultInformationControl(org.eclipse.jface.text.DefaultInformationControl) SimpleSelectionProvider(org.erlide.ui.editors.erl.SimpleSelectionProvider) IInputChangedListener(org.eclipse.jface.text.IInputChangedListener) PartInitException(org.eclipse.ui.PartInitException) OpenResult(org.erlide.engine.services.search.OpenResult) ErlideUIPlugin(org.erlide.ui.internal.ErlideUIPlugin) ErlideImage(org.erlide.ui.ErlideImage) Shell(org.eclipse.swt.widgets.Shell) PlatformUI(org.eclipse.ui.PlatformUI) Action(org.eclipse.jface.action.Action) IInformationControl(org.eclipse.jface.text.IInformationControl) ErlLogger(org.erlide.util.ErlLogger) ImageDescriptor(org.eclipse.jface.resource.ImageDescriptor) EditorsUI(org.eclipse.ui.editors.text.EditorsUI) ISharedImages(org.eclipse.ui.ISharedImages) AbstractReusableInformationControlCreator(org.eclipse.jface.text.AbstractReusableInformationControlCreator) IErlElement(org.erlide.engine.model.IErlElement) EdocView(org.erlide.ui.views.EdocView) SWT(org.eclipse.swt.SWT) ToolBarManager(org.eclipse.jface.action.ToolBarManager) OpenUtils(org.erlide.ui.actions.OpenUtils) DefaultInformationControl(org.eclipse.jface.text.DefaultInformationControl) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) ToolBarManager(org.eclipse.jface.action.ToolBarManager) SimpleSelectionProvider(org.erlide.ui.editors.erl.SimpleSelectionProvider) ImageDescriptor(org.eclipse.jface.resource.ImageDescriptor) IInputChangedListener(org.eclipse.jface.text.IInputChangedListener)

Example 52 with ToolBarManager

use of org.eclipse.jface.action.ToolBarManager in project uiautomatorviewer by yangzaiCN.

the class UiAutomatorViewer method createContents.

/**
 * Create contents of the application window.
 *
 * @param parent
 */
@Override
protected Control createContents(Composite parent) {
    UiAutomatorModel.createInstance(this);
    Composite basePane = new Composite(parent, SWT.NONE);
    basePane.setLayout(new GridLayout(2, false));
    mScreenshotCanvas = new Canvas(basePane, SWT.NONE);
    mScreenshotCanvas.addMouseListener(new MouseAdapter() {

        @Override
        public void mouseUp(MouseEvent e) {
            UiAutomatorModel.getModel().toggleExploreMode();
        }
    });
    mScreenshotCanvas.setBackground(getShell().getDisplay().getSystemColor(SWT.COLOR_BLACK));
    mScreenshotCanvas.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 3));
    mScreenshotCanvas.addPaintListener(new PaintListener() {

        @Override
        public void paintControl(PaintEvent e) {
            if (mCachedScaleImage != null) {
                // shifting the image here, so that there's a border around screen shot
                // this makes highlighting red rectangles on the screen shot edges more visible
                e.gc.drawImage(mCachedScaleImage, IMG_BORDER, IMG_BORDER);
                Rectangle rect = UiAutomatorModel.getModel().getCurrentDrawingRect();
                if (rect != null) {
                    e.gc.setForeground(e.gc.getDevice().getSystemColor(SWT.COLOR_RED));
                    if (UiAutomatorModel.getModel().isExploreMode()) {
                        // when we highlight nodes dynamically on mouse move,
                        // use dashed borders
                        e.gc.setLineStyle(SWT.LINE_DASH);
                        e.gc.setLineWidth(1);
                    } else {
                        // when highlighting nodes on tree node selection,
                        // use solid borders
                        e.gc.setLineStyle(SWT.LINE_SOLID);
                        e.gc.setLineWidth(2);
                    }
                    e.gc.drawRectangle(IMG_BORDER + getScaledSize(rect.x), IMG_BORDER + getScaledSize(rect.y), getScaledSize(rect.width), getScaledSize(rect.height));
                }
            }
        }
    });
    mScreenshotCanvas.addMouseMoveListener(new MouseMoveListener() {

        @Override
        public void mouseMove(MouseEvent e) {
            if (UiAutomatorModel.getModel().isExploreMode()) {
                UiAutomatorModel.getModel().updateSelectionForCoordinates(getInverseScaledSize(e.x - IMG_BORDER), getInverseScaledSize(e.y - IMG_BORDER));
            }
        }
    });
    mScreenshotCanvas.setBackgroundImage(ImageHelper.loadImageDescriptorFromResource("images/logo.png").createImage());
    ToolBarManager toolBarManager = new ToolBarManager(SWT.FLAT);
    toolBarManager.add(mOpenFilesAction);
    toolBarManager.add(mExpandAllAction);
    toolBarManager.add(mScreenshotAction);
    toolBarManager.createControl(basePane);
    mTreeViewer = new TreeViewer(basePane, SWT.BORDER);
    Tree tree = mTreeViewer.getTree();
    GridData gd_Tree = new GridData(SWT.FILL, SWT.FILL, false, true, 1, 1);
    gd_Tree.widthHint = 350;
    tree.setLayoutData(gd_Tree);
    mTreeViewer.setContentProvider(new BasicTreeNodeContentProvider());
    // default LabelProvider uses toString() to generate text to display
    mTreeViewer.setLabelProvider(new LabelProvider());
    mTreeViewer.addSelectionChangedListener(new ISelectionChangedListener() {

        @Override
        public void selectionChanged(SelectionChangedEvent event) {
            if (event.getSelection().isEmpty()) {
                UiAutomatorModel.getModel().setSelectedNode(null);
            } else if (event.getSelection() instanceof IStructuredSelection) {
                IStructuredSelection selection = (IStructuredSelection) event.getSelection();
                Object o = selection.toArray()[0];
                if (o instanceof BasicTreeNode) {
                    UiAutomatorModel.getModel().setSelectedNode((BasicTreeNode) o);
                }
            }
        }
    });
    // move focus so that it's not on tool bar (looks weird)
    tree.setFocus();
    Group grpNodeDetail = new Group(basePane, SWT.NONE);
    grpNodeDetail.setLayout(new FillLayout(SWT.HORIZONTAL));
    GridData gd_grpNodeDetail = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_grpNodeDetail.heightHint = FIXED_DETAIL_VIEW_HEIGHT;
    gd_grpNodeDetail.minimumHeight = FIXED_DETAIL_VIEW_HEIGHT;
    gd_grpNodeDetail.widthHint = FIXED_RHS_WIDTH;
    gd_grpNodeDetail.minimumWidth = FIXED_RHS_WIDTH;
    grpNodeDetail.setLayoutData(gd_grpNodeDetail);
    grpNodeDetail.setText("Node Detail");
    Composite tableContainer = new Composite(grpNodeDetail, SWT.NONE);
    tableContainer.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
    TableColumnLayout columnLayout = new TableColumnLayout();
    tableContainer.setLayout(columnLayout);
    mTableViewer = new TableViewer(tableContainer, SWT.BORDER | SWT.FULL_SELECTION);
    Table table = mTableViewer.getTable();
    table.setLinesVisible(true);
    // use ArrayContentProvider here, it assumes the input to the TableViewer
    // is an array, where each element represents a row in the table
    mTableViewer.setContentProvider(new ArrayContentProvider());
    TableViewerColumn tableViewerColumnKey = new TableViewerColumn(mTableViewer, SWT.NONE);
    TableColumn tblclmnKey = tableViewerColumnKey.getColumn();
    tableViewerColumnKey.setLabelProvider(new ColumnLabelProvider() {

        @Override
        public String getText(Object element) {
            if (element instanceof AttributePair) {
                // first column, shows the attribute name
                return ((AttributePair) element).key;
            }
            return super.getText(element);
        }
    });
    columnLayout.setColumnData(tblclmnKey, new ColumnWeightData(1, ColumnWeightData.MINIMUM_WIDTH, true));
    TableViewerColumn tableViewerColumnValue = new TableViewerColumn(mTableViewer, SWT.NONE);
    tableViewerColumnValue.setEditingSupport(new AttributeTableEditingSupport(mTableViewer));
    TableColumn tblclmnValue = tableViewerColumnValue.getColumn();
    columnLayout.setColumnData(tblclmnValue, new ColumnWeightData(2, ColumnWeightData.MINIMUM_WIDTH, true));
    tableViewerColumnValue.setLabelProvider(new ColumnLabelProvider() {

        @Override
        public String getText(Object element) {
            if (element instanceof AttributePair) {
                // second column, shows the attribute value
                return ((AttributePair) element).value;
            }
            return super.getText(element);
        }
    });
    return basePane;
}
Also used : ColumnWeightData(org.eclipse.jface.viewers.ColumnWeightData) Group(org.eclipse.swt.widgets.Group) TreeViewer(org.eclipse.jface.viewers.TreeViewer) Rectangle(org.eclipse.swt.graphics.Rectangle) AttributePair(com.android.uiautomator.tree.AttributePair) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) ToolBarManager(org.eclipse.jface.action.ToolBarManager) BasicTreeNode(com.android.uiautomator.tree.BasicTreeNode) ColumnLabelProvider(org.eclipse.jface.viewers.ColumnLabelProvider) GridLayout(org.eclipse.swt.layout.GridLayout) TableColumnLayout(org.eclipse.jface.layout.TableColumnLayout) BasicTreeNodeContentProvider(com.android.uiautomator.tree.BasicTreeNodeContentProvider) Tree(org.eclipse.swt.widgets.Tree) TableViewerColumn(org.eclipse.jface.viewers.TableViewerColumn) MouseEvent(org.eclipse.swt.events.MouseEvent) PaintEvent(org.eclipse.swt.events.PaintEvent) Table(org.eclipse.swt.widgets.Table) Composite(org.eclipse.swt.widgets.Composite) PaintListener(org.eclipse.swt.events.PaintListener) Canvas(org.eclipse.swt.widgets.Canvas) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) MouseAdapter(org.eclipse.swt.events.MouseAdapter) FillLayout(org.eclipse.swt.layout.FillLayout) TableColumn(org.eclipse.swt.widgets.TableColumn) MouseMoveListener(org.eclipse.swt.events.MouseMoveListener) GridData(org.eclipse.swt.layout.GridData) ArrayContentProvider(org.eclipse.jface.viewers.ArrayContentProvider) ColumnLabelProvider(org.eclipse.jface.viewers.ColumnLabelProvider) LabelProvider(org.eclipse.jface.viewers.LabelProvider) TableViewer(org.eclipse.jface.viewers.TableViewer)

Example 53 with ToolBarManager

use of org.eclipse.jface.action.ToolBarManager in project mylyn.docs by eclipse.

the class ShowCheatSheetCommand method execute.

public Object execute(ExecutionEvent event) throws ExecutionException {
    // $NON-NLS-1$
    Object activeFocusControl = HandlerUtil.getVariable(event, "activeFocusControl");
    if (activeFocusControl instanceof Control) {
        Control control = (Control) activeFocusControl;
        MarkupLanguage markupLanguage = (MarkupLanguage) control.getData(MarkupLanguage.class.getName());
        ISourceViewer viewer = (ISourceViewer) control.getData(ISourceViewer.class.getName());
        if (markupLanguage != null && viewer != null) {
            ToolBarManager toolBarManager = new ToolBarManager();
            toolBarManager.add(new ContextHelpAction());
            final InformationPresenter informationPresenter = InformationPresenterUtil.getHtmlInformationPresenter(viewer, new InformationPresenterUtil.SizeConstraint(50, 200, true, true), toolBarManager, computeCheatSheet(markupLanguage));
            // show information asynchronously since on Eclipse 3.4 it will disappear otherwise
            Display.getCurrent().asyncExec(new Runnable() {

                public void run() {
                    informationPresenter.showInformation();
                }
            });
        }
    }
    return null;
}
Also used : InformationPresenterUtil(org.eclipse.mylyn.internal.wikitext.ui.util.InformationPresenterUtil) Control(org.eclipse.swt.widgets.Control) MarkupLanguage(org.eclipse.mylyn.wikitext.parser.markup.MarkupLanguage) ISourceViewer(org.eclipse.jface.text.source.ISourceViewer) InformationPresenter(org.eclipse.jface.text.information.InformationPresenter) ToolBarManager(org.eclipse.jface.action.ToolBarManager) ContextHelpAction(org.eclipse.mylyn.internal.wikitext.ui.editor.actions.ContextHelpAction)

Example 54 with ToolBarManager

use of org.eclipse.jface.action.ToolBarManager in project rap by entirej.

the class EJRWTLineChartRecordBlockRenderer method buildGuiComponent.

@Override
public void buildGuiComponent(EJRWTEntireJGridPane blockCanvas) {
    EJFrameworkExtensionProperties appProp = EJCoreProperties.getInstance().getApplicationDefinedProperties();
    if (appProp != null) {
        EJFrameworkExtensionProperties propertyGroup = appProp.getPropertyGroup(EJRWTSingleRecordBlockDefinitionProperties.ACTION_GROUP);
        if (propertyGroup != null) {
            addActionKeyinfo(propertyGroup.getStringProperty(EJRWTSingleRecordBlockDefinitionProperties.ACTION_QUERY_KEY), EJRWTSingleRecordBlockDefinitionProperties.ACTION_QUERY_KEY);
            addActionKeyinfo(propertyGroup.getStringProperty(EJRWTSingleRecordBlockDefinitionProperties.ACTION_INSERT_KEY), EJRWTSingleRecordBlockDefinitionProperties.ACTION_INSERT_KEY);
            addActionKeyinfo(propertyGroup.getStringProperty(EJRWTSingleRecordBlockDefinitionProperties.ACTION_UPDATE_KEY), EJRWTSingleRecordBlockDefinitionProperties.ACTION_UPDATE_KEY);
            addActionKeyinfo(propertyGroup.getStringProperty(EJRWTSingleRecordBlockDefinitionProperties.ACTION_DELETE_KEY), EJRWTSingleRecordBlockDefinitionProperties.ACTION_DELETE_KEY);
            addActionKeyinfo(propertyGroup.getStringProperty(EJRWTSingleRecordBlockDefinitionProperties.ACTION_REFRESH_KEY), EJRWTSingleRecordBlockDefinitionProperties.ACTION_REFRESH_KEY);
        }
    }
    EJBlockProperties blockProperties = _block.getProperties();
    EJMainScreenProperties mainScreenProperties = blockProperties.getMainScreenProperties();
    GridData gridData = new GridData(GridData.FILL_BOTH);
    gridData.widthHint = mainScreenProperties.getWidth();
    gridData.heightHint = mainScreenProperties.getHeight();
    gridData.horizontalSpan = mainScreenProperties.getHorizontalSpan();
    gridData.verticalSpan = mainScreenProperties.getVerticalSpan();
    gridData.grabExcessHorizontalSpace = mainScreenProperties.canExpandHorizontally();
    gridData.grabExcessVerticalSpace = mainScreenProperties.canExpandVertically();
    if (gridData.grabExcessHorizontalSpace) {
        gridData.minimumWidth = mainScreenProperties.getWidth();
    }
    if (gridData.grabExcessVerticalSpace) {
        gridData.minimumHeight = mainScreenProperties.getHeight();
    }
    _rendererProp = blockProperties.getBlockRendererProperties();
    blockCanvas.setLayoutData(gridData);
    EJFrameworkExtensionProperties sectionProperties = null;
    if (_rendererProp != null) {
        sectionProperties = _rendererProp.getPropertyGroup(EJRWTSingleRecordBlockDefinitionProperties.ITEM_GROUP_TITLE_BAR);
    }
    if (sectionProperties != null && sectionProperties.getStringProperty(EJRWTSingleRecordBlockDefinitionProperties.ITEM_GROUP_TITLE_BAR_MODE) != null && !EJRWTSingleRecordBlockDefinitionProperties.ITEM_GROUP_TITLE_BAR_MODE_GROUP.equals(sectionProperties.getStringProperty(EJRWTSingleRecordBlockDefinitionProperties.ITEM_GROUP_TITLE_BAR_MODE))) {
        int style = ExpandableComposite.TITLE_BAR;
        String mode = sectionProperties.getStringProperty(EJRWTSingleRecordBlockDefinitionProperties.ITEM_GROUP_TITLE_BAR_MODE);
        if (EJRWTSingleRecordBlockDefinitionProperties.ITEM_GROUP_TITLE_BAR_MODE_TWISTIE.equals(mode)) {
            style = style | ExpandableComposite.TWISTIE;
        } else if (EJRWTSingleRecordBlockDefinitionProperties.ITEM_GROUP_TITLE_BAR_MODE_TREE_NODE.equals(mode)) {
            style = style | ExpandableComposite.TREE_NODE;
        }
        if (sectionProperties.getBooleanProperty(EJRWTSingleRecordBlockDefinitionProperties.ITEM_GROUP_TITLE_BAR_EXPANDED, true)) {
            style = style | ExpandableComposite.EXPANDED;
        }
        Section section = toolkit.createSection(blockCanvas, style);
        section.setLayoutData(gridData);
        String title = sectionProperties.getStringProperty(EJRWTSingleRecordBlockDefinitionProperties.ITEM_GROUP_TITLE_BAR_TITLE);
        if (title != null) {
            section.setText(title);
        }
        EJRWTImageRetriever.getGraphicsProvider().rendererSection(section);
        String frameTitle = mainScreenProperties.getFrameTitle();
        if (mainScreenProperties.getDisplayFrame() && frameTitle != null && frameTitle.length() > 0) {
            Group group = new Group(section, SWT.NONE);
            group.setData(EJ_RWT.CUSTOM_VARIANT, EJ_RWT.CSS_CV_ITEM_GROUP);
            group.setLayout(new FillLayout());
            group.setLayoutData(gridData);
            hookKeyListener(group);
            group.setText(frameTitle);
            _mainPane = new EJRWTEntireJGridPane(group, 1, mainScreenProperties.getDisplayFrame() ? SWT.BORDER : SWT.NONE);
            _mainPane.setData(EJ_RWT.CUSTOM_VARIANT, EJ_RWT.CSS_CV_ITEM_GROUP);
            section.setClient(group);
        } else {
            _mainPane = new EJRWTEntireJGridPane(section, 1);
            _mainPane.setLayoutData(gridData);
            _mainPane.cleanLayoutHorizontal();
            _mainPane.setData(EJ_RWT.CUSTOM_VARIANT, EJ_RWT.CSS_CV_ITEM_GROUP);
            section.setClient(_mainPane);
        }
        final EJFrameworkExtensionPropertyList propertyList = sectionProperties.getPropertyList(EJRWTSingleRecordBlockDefinitionProperties.ITEM_GROUP_TITLE_BAR_ACTIONS);
        if (propertyList != null && propertyList.getAllListEntries().size() > 0) {
            ToolBarManager toolBarManager = new ToolBarManager(SWT.FLAT);
            final ToolBar toolbar = toolBarManager.createControl(section);
            final Cursor handCursor = new Cursor(Display.getCurrent(), SWT.CURSOR_HAND);
            toolbar.setCursor(handCursor);
            // Cursor needs to be explicitly disposed
            toolbar.addDisposeListener(new DisposeListener() {

                @Override
                public void widgetDisposed(DisposeEvent e) {
                    if (handCursor != null && handCursor.isDisposed() == false) {
                        handCursor.dispose();
                    }
                }
            });
            List<EJFrameworkExtensionPropertyListEntry> allListEntries = propertyList.getAllListEntries();
            for (EJFrameworkExtensionPropertyListEntry entry : allListEntries) {
                final String actionID = entry.getProperty(EJRWTSingleRecordBlockDefinitionProperties.ITEM_GROUP_TITLE_BAR_ACTION_ID);
                String actionImage = entry.getProperty(EJRWTSingleRecordBlockDefinitionProperties.ITEM_GROUP_TITLE_BAR_ACTION_IMAGE);
                String actionName = entry.getProperty(EJRWTSingleRecordBlockDefinitionProperties.ITEM_GROUP_TITLE_BAR_ACTION_NAME);
                String actionTooltip = entry.getProperty(EJRWTSingleRecordBlockDefinitionProperties.ITEM_GROUP_TITLE_BAR_ACTION_TOOLTIP);
                if (actionID != null) {
                    Action action = new Action(actionID, IAction.AS_PUSH_BUTTON) {

                        @Override
                        public void runWithEvent(Event event) {
                            _block.executeActionCommand(actionID, EJScreenType.MAIN);
                        }
                    };
                    if (actionName != null) {
                        action.setText(actionName);
                    }
                    if (actionTooltip != null) {
                        action.setDescription(actionTooltip);
                    }
                    if (actionImage != null && actionImage.length() > 0) {
                        action.setImageDescriptor((EJRWTImageRetriever.createDescriptor(actionImage)));
                    }
                    toolBarManager.add(action);
                }
            }
            toolBarManager.update(true);
            section.setTextClient(toolbar);
        }
    } else {
        String frameTitle = mainScreenProperties.getFrameTitle();
        if (mainScreenProperties.getDisplayFrame() && frameTitle != null && frameTitle.length() > 0) {
            Group group = new Group(blockCanvas, SWT.NONE);
            group.setData(EJ_RWT.CUSTOM_VARIANT, EJ_RWT.CSS_CV_ITEM_GROUP);
            group.setLayout(new FillLayout());
            group.setLayoutData(gridData);
            hookKeyListener(group);
            group.setText(frameTitle);
            _mainPane = new EJRWTEntireJGridPane(group, 1, mainScreenProperties.getDisplayFrame() ? SWT.BORDER : SWT.NONE);
            _mainPane.setData(EJ_RWT.CUSTOM_VARIANT, EJ_RWT.CSS_CV_ITEM_GROUP);
        } else {
            _mainPane = new EJRWTEntireJGridPane(blockCanvas, 1);
            _mainPane.setLayoutData(gridData);
            _mainPane.cleanLayout();
            _mainPane.setData(EJ_RWT.CUSTOM_VARIANT, EJ_RWT.CSS_CV_ITEM_GROUP);
        }
    }
    hookKeyListener(_mainPane);
    int style = SWT.NONE;
    Collection<EJItemGroupProperties> allItemGroupProperties = _block.getProperties().getScreenItemGroupContainer(EJScreenType.MAIN).getAllItemGroupProperties();
    {
        _chartView = null;
        if (allItemGroupProperties.size() > 0) {
            EJItemGroupProperties displayProperties = allItemGroupProperties.iterator().next();
            if (displayProperties.dispayGroupFrame() && displayProperties.getFrameTitle() != null && displayProperties.getFrameTitle().length() > 0) {
                Group group = new Group(_mainPane, SWT.NONE);
                group.setLayout(new FillLayout());
                group.setText(displayProperties.getFrameTitle());
                group.setLayoutData(new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL));
                _chartView = new LineChart(group, style) {

                    protected void action(String method, org.eclipse.rap.json.JsonObject parameters) {
                        processAction(method, parameters);
                    }
                };
            } else {
                _chartView = new LineChart(_mainPane, displayProperties.dispayGroupFrame() ? style | SWT.BORDER : style) {

                    protected void action(String method, org.eclipse.rap.json.JsonObject parameters) {
                        processAction(method, parameters);
                    }
                };
                _chartView.setLayoutData(new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL));
            }
        } else {
            _chartView = new LineChart(_mainPane, style) {

                protected void action(String method, org.eclipse.rap.json.JsonObject parameters) {
                    processAction(method, parameters);
                }
            };
            _chartView.setLayoutData(new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL));
        }
    }
    _chartView.addFocusListener(new FocusListener() {

        @Override
        public void focusLost(FocusEvent arg0) {
            setHasFocus(false);
        }

        @Override
        public void focusGained(FocusEvent arg0) {
            setHasFocus(true);
        }
    });
    _mainPane.addMouseListener(new MouseAdapter() {

        @Override
        public void mouseDown(MouseEvent arg0) {
            if (!_chartView.isFocusControl()) {
                setHasFocus(true);
            }
        }
    });
    _chartView.addMouseListener(new MouseAdapter() {

        @Override
        public void mouseDown(MouseEvent arg0) {
            if (!_chartView.isFocusControl()) {
                setHasFocus(true);
            }
        }
    });
    for (EJItemGroupProperties groupProperties : allItemGroupProperties) {
        Collection<EJScreenItemProperties> itemProperties = groupProperties.getAllItemProperties();
        for (EJScreenItemProperties screenItemProperties : itemProperties) {
            EJCoreMainScreenItemProperties mainScreenItemProperties = (EJCoreMainScreenItemProperties) screenItemProperties;
            String visualAttribute = mainScreenItemProperties.getBlockRendererRequiredProperties().getStringProperty(VISUAL_ATTRIBUTE_PROPERTY);
            EJScreenItemController item = _block.getScreenItem(EJScreenType.MAIN, mainScreenItemProperties.getReferencedItemName());
            EJRWTAppItemRenderer itemRenderer = (EJRWTAppItemRenderer) item.getManagedItemRenderer().getUnmanagedRenderer();
            if (visualAttribute != null) {
                EJCoreVisualAttributeProperties va = EJCoreProperties.getInstance().getVisualAttributesContainer().getVisualAttributeProperties(visualAttribute);
                if (va != null) {
                    itemRenderer.setInitialVisualAttribute(va);
                }
            }
            if (item.getProperties().getVisualAttributeProperties() != null) {
                itemRenderer.setVisualAttribute(item.getProperties().getVisualAttributeProperties());
            }
        }
    }
    appItemRenderer = null;
    final EJItemController blockItemController = _block.getBlockItemController(xAxisColumn);
    String itemRendererName = blockItemController.getProperties().getItemRendererName();
    if (itemRendererName != null) {
        EJScreenItemController itemController = new EJScreenItemController() {

            @Override
            public boolean validateFromLov() {
                // TODO Auto-generated method stub
                return false;
            }

            @Override
            public void setItemLovMapping(String lovMapping) {
            // TODO Auto-generated method stub
            }

            @Override
            public void removeItemValueChangedListener(EJScreenItemValueChangedListener listener) {
            // TODO Auto-generated method stub
            }

            @Override
            public void removeItemFocusListener(EJItemFocusListener listener) {
            // TODO Auto-generated method stub
            }

            @Override
            public void itemValueChaged(Object newValue) {
            // TODO Auto-generated method stub
            }

            @Override
            public void itemFocusLost() {
            // TODO Auto-generated method stub
            }

            @Override
            public void itemFocusGained() {
            // TODO Auto-generated method stub
            }

            @Override
            public boolean isVisible() {
                // TODO Auto-generated method stub
                return false;
            }

            @Override
            public boolean isSpacerItem() {
                // TODO Auto-generated method stub
                return false;
            }

            @Override
            public void initialiseRenderer() {
            // TODO Auto-generated method stub
            }

            @Override
            public void initialise(EJBlockItemRendererRegister blockItemRegister) {
            // TODO Auto-generated method stub
            }

            @Override
            public EJScreenType getScreenType() {
                // TODO Auto-generated method stub
                return null;
            }

            @Override
            public EJItemProperties getReferencedItemProperties() {
                return blockItemController.getProperties();
            }

            @Override
            public EJScreenItemProperties getProperties() {
                // TODO Auto-generated method stub
                return null;
            }

            @Override
            public String getName() {
                // TODO Auto-generated method stub
                return null;
            }

            @Override
            public EJManagedItemRendererWrapper getManagedItemRenderer() {
                // TODO Auto-generated method stub
                return null;
            }

            @Override
            public EJBlockItemRendererRegister getItemRendererRegister() {
                // TODO Auto-generated method stub
                return null;
            }

            @Override
            public EJItemRenderer getItemRenderer() {
                // TODO Auto-generated method stub
                return null;
            }

            @Override
            public EJItemLovController getItemLovController() {
                // TODO Auto-generated method stub
                return null;
            }

            @Override
            public EJInternalForm getForm() {
                // TODO Auto-generated method stub
                return _block.getForm();
            }

            @Override
            public EJInternalBlock getBlock() {
                return _block.getBlock();
            }

            @Override
            public void gainFocus() {
            // TODO Auto-generated method stub
            }

            @Override
            public void executeActionCommand() {
            // TODO Auto-generated method stub
            }

            @Override
            public void addItemValueChangedListener(EJScreenItemValueChangedListener listener) {
            // TODO Auto-generated method stub
            }

            @Override
            public void addItemFocusListener(EJItemFocusListener listener) {
            // TODO Auto-generated method stub
            }
        };
        EJManagedItemRendererWrapper renderer = EJRendererFactory.getInstance().getItemRenderer(itemController, new EJCoreMainScreenItemProperties(_block.getProperties(), false));
        if (renderer != null && renderer.getUnmanagedRenderer() instanceof EJRWTAppItemRenderer) {
            appItemRenderer = (EJRWTAppItemRenderer) renderer.getUnmanagedRenderer();
        }
    }
    refresh();
}
Also used : Group(org.eclipse.swt.widgets.Group) DisposeListener(org.eclipse.swt.events.DisposeListener) EJRWTDeleteAction(org.entirej.applicationframework.rwt.application.components.actions.EJRWTDeleteAction) EJRWTQueryAction(org.entirej.applicationframework.rwt.application.components.actions.EJRWTQueryAction) EJRWTUpdateAction(org.entirej.applicationframework.rwt.application.components.actions.EJRWTUpdateAction) EJRWTInsertAction(org.entirej.applicationframework.rwt.application.components.actions.EJRWTInsertAction) IAction(org.eclipse.jface.action.IAction) Action(org.eclipse.jface.action.Action) EJItemGroupProperties(org.entirej.framework.core.properties.interfaces.EJItemGroupProperties) EJBlockItemRendererRegister(org.entirej.framework.core.renderers.registry.EJBlockItemRendererRegister) EJCoreMainScreenItemProperties(org.entirej.framework.core.properties.EJCoreMainScreenItemProperties) JsonObject(org.eclipse.rap.json.JsonObject) Cursor(org.eclipse.swt.graphics.Cursor) DisposeEvent(org.eclipse.swt.events.DisposeEvent) FocusEvent(org.eclipse.swt.events.FocusEvent) ToolBarManager(org.eclipse.jface.action.ToolBarManager) EJScreenItemProperties(org.entirej.framework.core.properties.interfaces.EJScreenItemProperties) EJScreenItemValueChangedListener(org.entirej.framework.core.renderers.eventhandlers.EJScreenItemValueChangedListener) EJFrameworkExtensionProperties(org.entirej.framework.core.properties.definitions.interfaces.EJFrameworkExtensionProperties) EJFrameworkExtensionPropertyList(org.entirej.framework.core.properties.definitions.interfaces.EJFrameworkExtensionPropertyList) MouseEvent(org.eclipse.swt.events.MouseEvent) EJItemFocusListener(org.entirej.framework.core.renderers.eventhandlers.EJItemFocusListener) MouseAdapter(org.eclipse.swt.events.MouseAdapter) FillLayout(org.eclipse.swt.layout.FillLayout) Section(org.eclipse.ui.forms.widgets.Section) EJRWTAppItemRenderer(org.entirej.applicationframework.rwt.renderer.interfaces.EJRWTAppItemRenderer) EJFrameworkExtensionPropertyListEntry(org.entirej.framework.core.properties.definitions.interfaces.EJFrameworkExtensionPropertyListEntry) EJScreenItemController(org.entirej.framework.core.interfaces.EJScreenItemController) EJManagedItemRendererWrapper(org.entirej.framework.core.renderers.EJManagedItemRendererWrapper) EJBlockProperties(org.entirej.framework.core.properties.interfaces.EJBlockProperties) EJItemController(org.entirej.framework.core.data.controllers.EJItemController) GridData(org.eclipse.swt.layout.GridData) ToolBar(org.eclipse.swt.widgets.ToolBar) FocusEvent(org.eclipse.swt.events.FocusEvent) KeyEvent(org.eclipse.swt.events.KeyEvent) MouseEvent(org.eclipse.swt.events.MouseEvent) DisposeEvent(org.eclipse.swt.events.DisposeEvent) Event(org.eclipse.swt.widgets.Event) JsonObject(org.eclipse.rap.json.JsonObject) EJMainScreenProperties(org.entirej.framework.core.properties.interfaces.EJMainScreenProperties) EJItemFocusListener(org.entirej.framework.core.renderers.eventhandlers.EJItemFocusListener) FocusListener(org.eclipse.swt.events.FocusListener) EJRWTEntireJGridPane(org.entirej.applicationframework.rwt.layout.EJRWTEntireJGridPane) LineChart(org.eclipse.rap.chartjs.line.LineChart) EJCoreVisualAttributeProperties(org.entirej.framework.core.properties.EJCoreVisualAttributeProperties)

Example 55 with ToolBarManager

use of org.eclipse.jface.action.ToolBarManager in project rap by entirej.

the class EJRWTPieChartRecordBlockRenderer method buildGuiComponent.

@Override
public void buildGuiComponent(EJRWTEntireJGridPane blockCanvas) {
    EJFrameworkExtensionProperties appProp = EJCoreProperties.getInstance().getApplicationDefinedProperties();
    if (appProp != null) {
        EJFrameworkExtensionProperties propertyGroup = appProp.getPropertyGroup(EJRWTSingleRecordBlockDefinitionProperties.ACTION_GROUP);
        if (propertyGroup != null) {
            addActionKeyinfo(propertyGroup.getStringProperty(EJRWTSingleRecordBlockDefinitionProperties.ACTION_QUERY_KEY), EJRWTSingleRecordBlockDefinitionProperties.ACTION_QUERY_KEY);
            addActionKeyinfo(propertyGroup.getStringProperty(EJRWTSingleRecordBlockDefinitionProperties.ACTION_INSERT_KEY), EJRWTSingleRecordBlockDefinitionProperties.ACTION_INSERT_KEY);
            addActionKeyinfo(propertyGroup.getStringProperty(EJRWTSingleRecordBlockDefinitionProperties.ACTION_UPDATE_KEY), EJRWTSingleRecordBlockDefinitionProperties.ACTION_UPDATE_KEY);
            addActionKeyinfo(propertyGroup.getStringProperty(EJRWTSingleRecordBlockDefinitionProperties.ACTION_DELETE_KEY), EJRWTSingleRecordBlockDefinitionProperties.ACTION_DELETE_KEY);
            addActionKeyinfo(propertyGroup.getStringProperty(EJRWTSingleRecordBlockDefinitionProperties.ACTION_REFRESH_KEY), EJRWTSingleRecordBlockDefinitionProperties.ACTION_REFRESH_KEY);
        }
    }
    EJBlockProperties blockProperties = _block.getProperties();
    EJMainScreenProperties mainScreenProperties = blockProperties.getMainScreenProperties();
    GridData gridData = new GridData(GridData.FILL_BOTH);
    gridData.widthHint = mainScreenProperties.getWidth();
    gridData.heightHint = mainScreenProperties.getHeight();
    gridData.horizontalSpan = mainScreenProperties.getHorizontalSpan();
    gridData.verticalSpan = mainScreenProperties.getVerticalSpan();
    gridData.grabExcessHorizontalSpace = mainScreenProperties.canExpandHorizontally();
    gridData.grabExcessVerticalSpace = mainScreenProperties.canExpandVertically();
    if (gridData.grabExcessHorizontalSpace) {
        gridData.minimumWidth = mainScreenProperties.getWidth();
    }
    if (gridData.grabExcessVerticalSpace) {
        gridData.minimumHeight = mainScreenProperties.getHeight();
    }
    _rendererProp = blockProperties.getBlockRendererProperties();
    blockCanvas.setLayoutData(gridData);
    EJFrameworkExtensionProperties sectionProperties = null;
    if (_rendererProp != null) {
        sectionProperties = _rendererProp.getPropertyGroup(EJRWTSingleRecordBlockDefinitionProperties.ITEM_GROUP_TITLE_BAR);
    }
    if (sectionProperties != null && sectionProperties.getStringProperty(EJRWTSingleRecordBlockDefinitionProperties.ITEM_GROUP_TITLE_BAR_MODE) != null && !EJRWTSingleRecordBlockDefinitionProperties.ITEM_GROUP_TITLE_BAR_MODE_GROUP.equals(sectionProperties.getStringProperty(EJRWTSingleRecordBlockDefinitionProperties.ITEM_GROUP_TITLE_BAR_MODE))) {
        int style = ExpandableComposite.TITLE_BAR;
        String mode = sectionProperties.getStringProperty(EJRWTSingleRecordBlockDefinitionProperties.ITEM_GROUP_TITLE_BAR_MODE);
        if (EJRWTSingleRecordBlockDefinitionProperties.ITEM_GROUP_TITLE_BAR_MODE_TWISTIE.equals(mode)) {
            style = style | ExpandableComposite.TWISTIE;
        } else if (EJRWTSingleRecordBlockDefinitionProperties.ITEM_GROUP_TITLE_BAR_MODE_TREE_NODE.equals(mode)) {
            style = style | ExpandableComposite.TREE_NODE;
        }
        if (sectionProperties.getBooleanProperty(EJRWTSingleRecordBlockDefinitionProperties.ITEM_GROUP_TITLE_BAR_EXPANDED, true)) {
            style = style | ExpandableComposite.EXPANDED;
        }
        Section section = toolkit.createSection(blockCanvas, style);
        section.setLayoutData(gridData);
        String title = sectionProperties.getStringProperty(EJRWTSingleRecordBlockDefinitionProperties.ITEM_GROUP_TITLE_BAR_TITLE);
        if (title != null) {
            section.setText(title);
        }
        EJRWTImageRetriever.getGraphicsProvider().rendererSection(section);
        String frameTitle = mainScreenProperties.getFrameTitle();
        if (mainScreenProperties.getDisplayFrame() && frameTitle != null && frameTitle.length() > 0) {
            Group group = new Group(section, SWT.NONE);
            group.setData(EJ_RWT.CUSTOM_VARIANT, EJ_RWT.CSS_CV_ITEM_GROUP);
            group.setLayout(new FillLayout());
            group.setLayoutData(gridData);
            hookKeyListener(group);
            group.setText(frameTitle);
            _mainPane = new EJRWTEntireJGridPane(group, 1, mainScreenProperties.getDisplayFrame() ? SWT.BORDER : SWT.NONE);
            _mainPane.setData(EJ_RWT.CUSTOM_VARIANT, EJ_RWT.CSS_CV_ITEM_GROUP);
            section.setClient(group);
        } else {
            _mainPane = new EJRWTEntireJGridPane(section, 1);
            _mainPane.setLayoutData(gridData);
            _mainPane.cleanLayoutHorizontal();
            _mainPane.setData(EJ_RWT.CUSTOM_VARIANT, EJ_RWT.CSS_CV_ITEM_GROUP);
            section.setClient(_mainPane);
        }
        final EJFrameworkExtensionPropertyList propertyList = sectionProperties.getPropertyList(EJRWTSingleRecordBlockDefinitionProperties.ITEM_GROUP_TITLE_BAR_ACTIONS);
        if (propertyList != null && propertyList.getAllListEntries().size() > 0) {
            ToolBarManager toolBarManager = new ToolBarManager(SWT.FLAT);
            final ToolBar toolbar = toolBarManager.createControl(section);
            final Cursor handCursor = new Cursor(Display.getCurrent(), SWT.CURSOR_HAND);
            toolbar.setCursor(handCursor);
            // Cursor needs to be explicitly disposed
            toolbar.addDisposeListener(new DisposeListener() {

                @Override
                public void widgetDisposed(DisposeEvent e) {
                    if (handCursor != null && handCursor.isDisposed() == false) {
                        handCursor.dispose();
                    }
                }
            });
            List<EJFrameworkExtensionPropertyListEntry> allListEntries = propertyList.getAllListEntries();
            for (EJFrameworkExtensionPropertyListEntry entry : allListEntries) {
                final String actionID = entry.getProperty(EJRWTSingleRecordBlockDefinitionProperties.ITEM_GROUP_TITLE_BAR_ACTION_ID);
                String actionImage = entry.getProperty(EJRWTSingleRecordBlockDefinitionProperties.ITEM_GROUP_TITLE_BAR_ACTION_IMAGE);
                String actionName = entry.getProperty(EJRWTSingleRecordBlockDefinitionProperties.ITEM_GROUP_TITLE_BAR_ACTION_NAME);
                String actionTooltip = entry.getProperty(EJRWTSingleRecordBlockDefinitionProperties.ITEM_GROUP_TITLE_BAR_ACTION_TOOLTIP);
                if (actionID != null) {
                    Action action = new Action(actionID, IAction.AS_PUSH_BUTTON) {

                        @Override
                        public void runWithEvent(Event event) {
                            _block.executeActionCommand(actionID, EJScreenType.MAIN);
                        }
                    };
                    if (actionName != null) {
                        action.setText(actionName);
                    }
                    if (actionTooltip != null) {
                        action.setDescription(actionTooltip);
                    }
                    if (actionImage != null && actionImage.length() > 0) {
                        action.setImageDescriptor((EJRWTImageRetriever.createDescriptor(actionImage)));
                    }
                    toolBarManager.add(action);
                }
            }
            toolBarManager.update(true);
            section.setTextClient(toolbar);
        }
    } else {
        String frameTitle = mainScreenProperties.getFrameTitle();
        if (mainScreenProperties.getDisplayFrame() && frameTitle != null && frameTitle.length() > 0) {
            Group group = new Group(blockCanvas, SWT.NONE);
            group.setData(EJ_RWT.CUSTOM_VARIANT, EJ_RWT.CSS_CV_ITEM_GROUP);
            group.setLayout(new FillLayout());
            group.setLayoutData(gridData);
            hookKeyListener(group);
            group.setText(frameTitle);
            _mainPane = new EJRWTEntireJGridPane(group, 1, mainScreenProperties.getDisplayFrame() ? SWT.BORDER : SWT.NONE);
            _mainPane.setData(EJ_RWT.CUSTOM_VARIANT, EJ_RWT.CSS_CV_ITEM_GROUP);
        } else {
            _mainPane = new EJRWTEntireJGridPane(blockCanvas, 1);
            _mainPane.setLayoutData(gridData);
            _mainPane.cleanLayout();
            _mainPane.setData(EJ_RWT.CUSTOM_VARIANT, EJ_RWT.CSS_CV_ITEM_GROUP);
        }
    }
    hookKeyListener(_mainPane);
    int style = SWT.NONE;
    Collection<EJItemGroupProperties> allItemGroupProperties = _block.getProperties().getScreenItemGroupContainer(EJScreenType.MAIN).getAllItemGroupProperties();
    {
        _chartView = null;
        if (allItemGroupProperties.size() > 0) {
            EJItemGroupProperties displayProperties = allItemGroupProperties.iterator().next();
            if (displayProperties.dispayGroupFrame() && displayProperties.getFrameTitle() != null && displayProperties.getFrameTitle().length() > 0) {
                Group group = new Group(_mainPane, SWT.NONE);
                group.setLayout(new FillLayout());
                group.setText(displayProperties.getFrameTitle());
                group.setLayoutData(new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL));
                _chartView = new PieChart(group, style) {

                    protected void action(String method, org.eclipse.rap.json.JsonObject parameters) {
                        processAction(method, parameters);
                    }
                };
            } else {
                _chartView = new PieChart(_mainPane, displayProperties.dispayGroupFrame() ? style | SWT.BORDER : style) {

                    protected void action(String method, org.eclipse.rap.json.JsonObject parameters) {
                        processAction(method, parameters);
                    }
                };
                _chartView.setLayoutData(new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL));
            }
        } else {
            _chartView = new PieChart(_mainPane, style) {

                protected void action(String method, org.eclipse.rap.json.JsonObject parameters) {
                    processAction(method, parameters);
                }
            };
            _chartView.setLayoutData(new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL));
        }
    }
    _chartView.addFocusListener(new FocusListener() {

        @Override
        public void focusLost(FocusEvent arg0) {
            setHasFocus(false);
        }

        @Override
        public void focusGained(FocusEvent arg0) {
            setHasFocus(true);
        }
    });
    _mainPane.addMouseListener(new MouseAdapter() {

        @Override
        public void mouseDown(MouseEvent arg0) {
            if (!_chartView.isFocusControl()) {
                setHasFocus(true);
            }
        }
    });
    _chartView.addMouseListener(new MouseAdapter() {

        @Override
        public void mouseDown(MouseEvent arg0) {
            if (!_chartView.isFocusControl()) {
                setHasFocus(true);
            }
        }
    });
    for (EJItemGroupProperties groupProperties : allItemGroupProperties) {
        Collection<EJScreenItemProperties> itemProperties = groupProperties.getAllItemProperties();
        for (EJScreenItemProperties screenItemProperties : itemProperties) {
            EJCoreMainScreenItemProperties mainScreenItemProperties = (EJCoreMainScreenItemProperties) screenItemProperties;
            String visualAttribute = mainScreenItemProperties.getBlockRendererRequiredProperties().getStringProperty(VISUAL_ATTRIBUTE_PROPERTY);
            EJScreenItemController item = _block.getScreenItem(EJScreenType.MAIN, mainScreenItemProperties.getReferencedItemName());
            EJRWTAppItemRenderer itemRenderer = (EJRWTAppItemRenderer) item.getManagedItemRenderer().getUnmanagedRenderer();
            if (visualAttribute != null) {
                EJCoreVisualAttributeProperties va = EJCoreProperties.getInstance().getVisualAttributesContainer().getVisualAttributeProperties(visualAttribute);
                if (va != null) {
                    itemRenderer.setInitialVisualAttribute(va);
                }
            }
            if (item.getProperties().getVisualAttributeProperties() != null) {
                itemRenderer.setVisualAttribute(item.getProperties().getVisualAttributeProperties());
            }
        }
    }
    refresh();
}
Also used : Group(org.eclipse.swt.widgets.Group) DisposeListener(org.eclipse.swt.events.DisposeListener) IAction(org.eclipse.jface.action.IAction) EJRWTDeleteAction(org.entirej.applicationframework.rwt.application.components.actions.EJRWTDeleteAction) EJRWTQueryAction(org.entirej.applicationframework.rwt.application.components.actions.EJRWTQueryAction) EJRWTUpdateAction(org.entirej.applicationframework.rwt.application.components.actions.EJRWTUpdateAction) EJRWTInsertAction(org.entirej.applicationframework.rwt.application.components.actions.EJRWTInsertAction) Action(org.eclipse.jface.action.Action) EJItemGroupProperties(org.entirej.framework.core.properties.interfaces.EJItemGroupProperties) EJCoreMainScreenItemProperties(org.entirej.framework.core.properties.EJCoreMainScreenItemProperties) JsonObject(org.eclipse.rap.json.JsonObject) Cursor(org.eclipse.swt.graphics.Cursor) DisposeEvent(org.eclipse.swt.events.DisposeEvent) FocusEvent(org.eclipse.swt.events.FocusEvent) ToolBarManager(org.eclipse.jface.action.ToolBarManager) PieChart(org.eclipse.rap.chartjs.pie.PieChart) EJScreenItemProperties(org.entirej.framework.core.properties.interfaces.EJScreenItemProperties) EJFrameworkExtensionProperties(org.entirej.framework.core.properties.definitions.interfaces.EJFrameworkExtensionProperties) EJFrameworkExtensionPropertyList(org.entirej.framework.core.properties.definitions.interfaces.EJFrameworkExtensionPropertyList) MouseEvent(org.eclipse.swt.events.MouseEvent) MouseAdapter(org.eclipse.swt.events.MouseAdapter) FillLayout(org.eclipse.swt.layout.FillLayout) Section(org.eclipse.ui.forms.widgets.Section) EJRWTAppItemRenderer(org.entirej.applicationframework.rwt.renderer.interfaces.EJRWTAppItemRenderer) EJFrameworkExtensionPropertyListEntry(org.entirej.framework.core.properties.definitions.interfaces.EJFrameworkExtensionPropertyListEntry) EJScreenItemController(org.entirej.framework.core.interfaces.EJScreenItemController) EJBlockProperties(org.entirej.framework.core.properties.interfaces.EJBlockProperties) GridData(org.eclipse.swt.layout.GridData) ToolBar(org.eclipse.swt.widgets.ToolBar) DisposeEvent(org.eclipse.swt.events.DisposeEvent) FocusEvent(org.eclipse.swt.events.FocusEvent) KeyEvent(org.eclipse.swt.events.KeyEvent) MouseEvent(org.eclipse.swt.events.MouseEvent) Event(org.eclipse.swt.widgets.Event) EJMainScreenProperties(org.entirej.framework.core.properties.interfaces.EJMainScreenProperties) FocusListener(org.eclipse.swt.events.FocusListener) EJRWTEntireJGridPane(org.entirej.applicationframework.rwt.layout.EJRWTEntireJGridPane) EJCoreVisualAttributeProperties(org.entirej.framework.core.properties.EJCoreVisualAttributeProperties)

Aggregations

ToolBarManager (org.eclipse.jface.action.ToolBarManager)237 Composite (org.eclipse.swt.widgets.Composite)86 ToolBar (org.eclipse.swt.widgets.ToolBar)80 Action (org.eclipse.jface.action.Action)70 GridData (org.eclipse.swt.layout.GridData)62 IToolBarManager (org.eclipse.jface.action.IToolBarManager)61 Control (org.eclipse.swt.widgets.Control)51 GridLayout (org.eclipse.swt.layout.GridLayout)49 Separator (org.eclipse.jface.action.Separator)39 List (java.util.List)35 SWT (org.eclipse.swt.SWT)33 ArrayList (java.util.ArrayList)32 IAction (org.eclipse.jface.action.IAction)29 IMenuManager (org.eclipse.jface.action.IMenuManager)27 IContributionItem (org.eclipse.jface.action.IContributionItem)25 MenuManager (org.eclipse.jface.action.MenuManager)25 Images (name.abuchen.portfolio.ui.Images)24 Messages (name.abuchen.portfolio.ui.Messages)24 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)24 Inject (javax.inject.Inject)23