Search in sources :

Example 6 with TextMergeViewer

use of org.eclipse.compare.contentmergeviewer.TextMergeViewer in project n4js by eclipse.

the class PackageJsonComparePage method createPreviewer.

private Control createPreviewer(Composite parent) {
    final CompareConfiguration compareConfiguration = new CompareConfiguration();
    compareConfiguration.setLeftLabel("Original package.json");
    compareConfiguration.setLeftEditable(false);
    compareConfiguration.setRightLabel("Merged package.json");
    compareConfiguration.setRightEditable(false);
    compareConfiguration.setProperty(CompareConfiguration.IGNORE_WHITESPACE, Boolean.FALSE);
    fViewer = new TextMergeViewer(parent, SWT.NONE, compareConfiguration);
    // add initial input in order to avoid problems when disposing the viewer later:
    fViewer.setInput(new DiffNode(new DiffElementFromString(""), new DiffElementFromString("")));
    Control control = fViewer.getControl();
    control.addDisposeListener(new DisposeListener() {

        @Override
        public void widgetDisposed(DisposeEvent e) {
            compareConfiguration.dispose();
        }
    });
    return control;
}
Also used : TextMergeViewer(org.eclipse.compare.contentmergeviewer.TextMergeViewer) DisposeListener(org.eclipse.swt.events.DisposeListener) Control(org.eclipse.swt.widgets.Control) CompareConfiguration(org.eclipse.compare.CompareConfiguration) DiffNode(org.eclipse.compare.structuremergeviewer.DiffNode) DisposeEvent(org.eclipse.swt.events.DisposeEvent)

Aggregations

TextMergeViewer (org.eclipse.compare.contentmergeviewer.TextMergeViewer)6 DiffNode (org.eclipse.compare.structuremergeviewer.DiffNode)6 CompareConfiguration (org.eclipse.compare.CompareConfiguration)5 TextCompareInput (com.cubrid.common.ui.compare.schema.control.TextCompareInput)2 QueryPlanComposite (com.cubrid.common.ui.query.control.queryplan.QueryPlanComposite)2 TableViewer (org.eclipse.jface.viewers.TableViewer)2 SashForm (org.eclipse.swt.custom.SashForm)2 DisposeEvent (org.eclipse.swt.events.DisposeEvent)2 DisposeListener (org.eclipse.swt.events.DisposeListener)2 SelectionEvent (org.eclipse.swt.events.SelectionEvent)2 SelectionListener (org.eclipse.swt.events.SelectionListener)2 FillLayout (org.eclipse.swt.layout.FillLayout)2 FormAttachment (org.eclipse.swt.layout.FormAttachment)2 FormData (org.eclipse.swt.layout.FormData)2 FormLayout (org.eclipse.swt.layout.FormLayout)2 GridLayout (org.eclipse.swt.layout.GridLayout)2 Composite (org.eclipse.swt.widgets.Composite)2 Control (org.eclipse.swt.widgets.Control)2 TableColumn (org.eclipse.swt.widgets.TableColumn)2 ToolBar (org.eclipse.swt.widgets.ToolBar)2