@NotNull protected DefaultActionGroup collectToolbarActions(@Nullable List<AnAction> viewerActions) { DefaultActionGroup group = new DefaultActionGroup(); List<AnAction> navigationActions = ContainerUtil.<AnAction>list(new MyPrevDifferenceAction(), new MyNextDifferenceAction()); DiffUtil.addActionBlock(group, navigationActions); DiffUtil.addActionBlock(group, viewerActions); List<AnAction> requestContextActions = myRequest.getUserData(DiffUserDataKeys.CONTEXT_ACTIONS); DiffUtil.addActionBlock(group, requestContextActions); List<AnAction> contextActions = myContext.getUserData(DiffUserDataKeys.CONTEXT_ACTIONS); DiffUtil.addActionBlock(group, contextActions); return group; }
public MergeRequestProcessor(@Nullable Project project, @NotNull MergeRequest request) { myProject = project; myRequest = request; myContext = new MyDiffContext(); myContext.putUserData(DiffUserDataKeys.PLACE, DiffPlaces.MERGE); myAvailableTools = DiffManagerEx.getInstance().getMergeTools(); myMainPanel = new MyPanel(); myContentPanel = new Wrapper(); myToolbarPanel = new Wrapper(); myToolbarPanel.setFocusable(true); myToolbarStatusPanel = new Wrapper(); myPanel = JBUI.Panels.simplePanel(myMainPanel); JPanel topPanel = JBUI.Panels.simplePanel(myToolbarPanel).addToRight(myToolbarStatusPanel); myMainPanel.add(topPanel, BorderLayout.NORTH); myMainPanel.add(myContentPanel, BorderLayout.CENTER); myMainPanel.setFocusTraversalPolicyProvider(true); myMainPanel.setFocusTraversalPolicy(new MyFocusTraversalPolicy()); MergeTool.MergeViewer viewer; try { viewer = getFittedTool().createComponent(myContext, myRequest); } catch (Throwable e) { LOG.error(e); viewer = ErrorMergeTool.INSTANCE.createComponent(myContext, myRequest); } myViewer = viewer; updateBottomActions(); }
public <T> void putContextUserData(@NotNull Key<T> key, @Nullable T value) { myContext.putUserData(key, value); }
@Nullable public <T> T getContextUserData(@NotNull Key<T> key) { return myContext.getUserData(key); }