/** * Returns a <code>ToolBarManager</code> if the given parent is a * <code>CompareViewerPane</code> or <code>null</code> otherwise. * * @param parent a <code>Composite</code> or <code>null</code> * @return a <code>ToolBarManager</code> if the given parent is a <code>CompareViewerPane</code> otherwise <code>null</code> */ public static ToolBarManager getToolBarManager(Composite parent) { if (parent instanceof CompareViewerPane) { CompareViewerPane pane= (CompareViewerPane) parent; return pane.getToolBarManager(); } return null; }
protected Control createDialogArea(Composite parent) { Composite composite = (Composite) super.createDialogArea(parent); GridLayout layout = new GridLayout(); layout.numColumns = 1; composite.setLayout(layout); CompareViewerPane pane = new CompareViewerPane(composite, SWT.BORDER | SWT.FLAT); pane.setText(fTestName); GridData data = new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL); data.widthHint = convertWidthInCharsToPixels(120); data.heightHint = convertHeightInCharsToPixels(13); pane.setLayoutData(data); Control previewer = createPreviewer(pane); pane.setContent(previewer); GridData gd = new GridData(GridData.FILL_BOTH); previewer.setLayoutData(gd); applyDialogFont(parent); return composite; }
private void feed1(CompareEditorInputNavigator cein) { if (getCompareInput() instanceof PatchFileDiffNode) { Object pane = cein.getPanes()[1]; // the top middle pane if (pane instanceof CompareViewerPane) { CompareViewerPane cvp = (CompareViewerPane) pane; cvp.setInput(getCompareInput()); } pane = cein.getPanes()[2]; // the top right pane if (pane instanceof CompareViewerPane) { CompareViewerPane cvp = (CompareViewerPane) pane; cvp.setInput(null); // clear downstream pane } } } }
setTopLeft(label); addMouseListener(ml); label.addMouseListener(ml); addDisposeListener(new DisposeListener() { public void widgetDisposed(DisposeEvent e) { if (fToolBarManager != null) {
marginHeight= 0; Control topLeft = createTopLeft(this); setTopLeft(topLeft); addMouseListener(ml); getTopLeft().addMouseListener(ml); addDisposeListener(e -> { if (fToolBarManager != null) { fToolBarManager.removeAll(); setImage(null); });
layout.verticalSpacing= 2; leftPane.setLayout(layout); fHistoryPane= new CompareViewerPane(leftPane, SWT.BORDER | SWT.FLAT); fHistoryPane.setTopLeft(new RefactoringHistoryLabel(fHistoryPane, SWT.NONE)); fHistoryPane.setText(getHistoryPaneText()); fHistoryPane.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL)); fHistoryViewer= createHistoryViewer(fHistoryPane); if (!fControlConfiguration.isTimeDisplayed()) fHistoryPane.setContent(fHistoryViewer.getControl()); createToolBar(fHistoryPane); createDetailPane(fSplitterControl); fHistoryPane.getTopLeft().addMouseListener(listener); fSplitterControl.setWeights(new int[] { 65, 35}); createBottomButtonBar(this);
fMemberPane= new CompareViewerPane(hsplitter, SWT.BORDER | SWT.FLAT); fMemberPane.setText(Utilities.getString(fBundle, "memberPaneTitle")); //$NON-NLS-1$ fMemberPane.setContent(fMemberTable); fMemberTable.setFocus(); fEditionPane= new CompareViewerPane(hsplitter, SWT.BORDER | SWT.FLAT); } else { if (fStructureCompare) { fEditionPane= new CompareViewerPane(hsplitter, SWT.BORDER | SWT.FLAT); fStructuredComparePane= new CompareViewerSwitchingPane(hsplitter, SWT.BORDER | SWT.FLAT, true) { @Override } else { fEditionPane= new CompareViewerPane(vsplitter, SWT.BORDER | SWT.FLAT); String titleFormat= Utilities.getString(fBundle, "treeTitleFormat"); //$NON-NLS-1$ String title= MessageFormat.format(titleFormat, fTitleArg ); fEditionPane.setText(title); if (fTitleImage != null) fEditionPane.setImage(fTitleImage); fEditionPane.setContent(fEditionTree);
Label l1= new Label(c, SWT.NONE); l1.setText(Utilities.getString(fBundle, "memberDescription")); //$NON-NLS-1$ fMemberPane= new CompareViewerPane(c, SWT.BORDER | SWT.FLAT); GridData gd= new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL); fMemberPane.setLayoutData(gd); fMemberPane.setContent(fMemberTable); Label l2= new Label(c, SWT.NONE); l2.setText(Utilities.getString(fBundle, "editionDescription")); //$NON-NLS-1$ fEditionPane= new CompareViewerPane(c, SWT.BORDER | SWT.FLAT); gd= new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL); fEditionPane.setLayoutData(gd); fEditionPane.setContent(fEditionTree);
ToolBarManager toolBarManager = CompareViewerPane.getToolBarManager(pagePane); IPage page = createPage(pagePane, toolBarManager); pagePane.setContent(page.getControl()); if (parent instanceof Splitter) ((Splitter)parent).setVisible(pagePane, false);
/** * Set the title of the page's page to the given text. The title * will appear in the header of the pane containing the page. * @param title the page's title */ protected void setPageDescription(String title) { fEditionPane.setText(title); }
fStructureInputPane.addOpenListener( new IOpenListener() { public void open(OpenEvent oe) { fStructureInputPane.addSelectionChangedListener( new ISelectionChangedListener() { public void selectionChanged(SelectionChangedEvent e) { fStructureInputPane.addDoubleClickListener( new IDoubleClickListener() { public void doubleClick(DoubleClickEvent event) {
private void feedInput() { if (fStructureInputPane != null && (fInput instanceof ICompareInput || isCustomStructureInputPane())) { if (hasChildren(fInput) || isCustomStructureInputPane()) { // The input has multiple entries so set the input of the structure input pane fStructureInputPane.setInput(fInput); } else if (!structureCompareOnSingleClick() || isShowStructureInOutlineView()) { // We want to avoid showing the structure in the editor if we can so first // we'll set the content pane to see if we need to provide a structure internalSetContentPaneInput(fInput); // If the content viewer is unusable if (hasUnusableContentViewer() || (structureCompareOnSingleClick() && isShowStructureInOutlineView() && !hasOutlineViewer(fInput))) { fStructureInputPane.setInput(fInput); } } else { fStructureInputPane.setInput(fInput); } ISelection sel= fStructureInputPane.getSelection(); if (sel == null || sel.isEmpty()) feed1(sel); // we only feed downstream viewers if the top left pane is empty } }
fMemberTable.dispose(); fMemberTable= new Table(fMemberPane, SWT.NONE); fMemberPane.setContent(fMemberTable);
/** * Set the pane's title Image. * The value <code>null</code> clears it. * * @param image the image to be displayed in the pane or null */ public void setImage(Image image) { CLabel cl= (CLabel) getTopLeft(); if (cl != null) cl.setImage(image); }
/** * Returns the toolbar manager of this control * * @return the toolbar manager */ protected ToolBarManager getToolBarManager() { if (fToolBarManager == null) { final ToolBar toolbar= new ToolBar(fHistoryPane, SWT.FLAT); fHistoryPane.setTopCenter(toolbar); fToolBarManager= new ToolBarManager(toolbar); } return fToolBarManager; }
@Override protected void contentsCreated() { super.contentsCreated(); ICompareNavigator nav = getNavigator(); if (nav instanceof CompareEditorInputNavigator) { final CompareEditorInputNavigator cein = (CompareEditorInputNavigator) nav; Object pane = cein.getPanes()[0]; // the structure input pane, top left if (pane instanceof CompareViewerPane) { CompareViewerPane cvp = (CompareViewerPane) pane; cvp.setSelection(StructuredSelection.EMPTY); cvp.addSelectionChangedListener(e -> feed1(cein)); feed1(cein); } } }
fMemberPane= new CompareViewerPane(hsplitter, SWT.BORDER | SWT.FLAT); fMemberPane.setText(Utilities.getString(fBundle, "memberPaneTitle")); //$NON-NLS-1$ fMemberPane.setContent(fMemberTable); fMemberTable.setFocus(); fEditionPane= new CompareViewerPane(hsplitter, SWT.BORDER | SWT.FLAT); } else { if (fStructureCompare) { fEditionPane= new CompareViewerPane(hsplitter, SWT.BORDER | SWT.FLAT); fStructuredComparePane= new CompareViewerSwitchingPane(hsplitter, SWT.BORDER | SWT.FLAT, true) { protected Viewer getViewer(Viewer oldViewer, Object input) { } else { fEditionPane= new CompareViewerPane(vsplitter, SWT.BORDER | SWT.FLAT); String titleFormat= Utilities.getString(fBundle, "treeTitleFormat"); //$NON-NLS-1$ String title= MessageFormat.format(titleFormat, new String[] { fTitleArg }); fEditionPane.setText(title); if (fTitleImage != null) fEditionPane.setImage(fTitleImage); fEditionPane.setContent(fEditionTree);
Label l1= new Label(c, SWT.NONE); l1.setText(Utilities.getString(fBundle, "memberDescription")); //$NON-NLS-1$ fMemberPane= new CompareViewerPane(c, SWT.BORDER | SWT.FLAT); GridData gd= new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL); fMemberPane.setLayoutData(gd); fMemberPane.setContent(fMemberTable); Label l2= new Label(c, SWT.NONE); l2.setText(Utilities.getString(fBundle, "editionDescription")); //$NON-NLS-1$ fEditionPane= new CompareViewerPane(c, SWT.BORDER | SWT.FLAT); gd= new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL); fEditionPane.setLayoutData(gd); fEditionPane.setContent(fEditionTree);
ToolBarManager toolBarManager = CompareViewerPane.getToolBarManager(pagePane); IPage page = createPage(pagePane, toolBarManager); pagePane.setContent(page.getControl()); if (parent instanceof Splitter) ((Splitter)parent).setVisible(pagePane, false);