Java Code Examples for org.eclipse.compare.CompareConfiguration#setProperty()

The following examples show how to use org.eclipse.compare.CompareConfiguration#setProperty() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SpecComparePage.java    From n4js with Eclipse Public License 1.0 6 votes vote down vote up
private Control createPreviewer(Composite parent) {
	final CompareConfiguration compareConfiguration = new CompareConfiguration();
	compareConfiguration.setLeftLabel("Original " + docTypeName);
	compareConfiguration.setLeftEditable(false);
	compareConfiguration.setRightLabel("Updated " + docTypeName);
	compareConfiguration.setRightEditable(false);
	compareConfiguration.setProperty(CompareConfiguration.IGNORE_WHITESPACE, Boolean.FALSE);
	compareConfiguration.setProperty(PREFIX_SUFFIX_PROPERTY, fPrefixSuffix);

	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 TargetElementFromString(""), new TargetElementFromString("")));

	Control control = fViewer.getControl();
	control.addDisposeListener(new DisposeListener() {
		@Override
		public void widgetDisposed(DisposeEvent e) {
			compareConfiguration.dispose();
		}
	});
	return control;
}
 
Example 2
Source File: ScriptRefactoringAction.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
private BonitaCompareEditorInput createCompareEditorInput() {
    final CompareConfiguration config = new CompareConfiguration();
    config.setRightEditable(true);
    config.setLeftEditable(false);
    config.setLeftLabel(Messages.currentScript);
    config.setRightLabel(Messages.refactoredScript);
    config.setProperty(CompareConfiguration.USE_OUTLINE_VIEW, true);
    String oldNames = "";
    String newNames = "";
    boolean canBeContainedInscript = true;
    for (final RefactorPair<?, ?> pairRefactor : pairsToRefactor) {
        oldNames += oldNames.isEmpty() ? pairRefactor.getOldValueName() : "," + pairRefactor.getOldValueName();
        newNames += newNames.isEmpty() ? pairRefactor.getNewValueName() : "," + pairRefactor.getNewValueName();
        canBeContainedInscript = canBeContainedInscript && pairRefactor.canBeContainedInScript();
    }
    return new BonitaCompareEditorInput(config, scriptExpressions, operationType, oldNames,
            newNames, canBeContainedInscript);
}
 
Example 3
Source File: N4IDEXpectCompareEditorInput.java    From n4js with Eclipse Public License 1.0 5 votes vote down vote up
@SuppressWarnings("javadoc")
protected static CompareConfiguration createConfiguration(IFile file) {
	CompareConfiguration configuration = new CompareConfiguration();
	configuration.setLeftEditable(true);
	configuration.setLeftLabel("Expected Test Result" + (file != null ? " - " + file.getName() : ""));
	configuration.setRightLabel("Actual Test Result");
	configuration.setAncestorLabel("File on Disk");
	configuration.setProperty(ICompareUIConstants.PROP_ANCESTOR_VISIBLE, Boolean.FALSE);
	return configuration;
}
 
Example 4
Source File: DefaultViewerCreator.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
protected Viewer createMergeViewer(Composite parent, CompareConfiguration compareConfiguration) {
	compareConfiguration.setProperty(DefaultMergeEditor.PROVIDER, mergeEditorProvider);
	DefaultMergeViewer result = new DefaultMergeViewer(parent, SWT.NULL, compareConfiguration, documentProvider,
			sourceViewerConfigurationProvider) {
		@Override
		public String getTitle() {
			if (compareViewerTitle != null) {
				return compareViewerTitle;
			}
			return super.getTitle();
		}
	};
	result.setXtextDocumentUtil(xtextDocumentUtil);
	return result;
}