org.eclipse.compare.IContentChangeNotifier Java Examples

The following examples show how to use org.eclipse.compare.IContentChangeNotifier. 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: BonitaCompareEditorInput.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
public void buildTree() {
    for (final ScriptContainer<?> script : scripts) {
        final LeftCompareScript left = new LeftCompareScript(script, adapterFactoryLabelProvider);
        final RightCompareScript right = new RightCompareScript(script, adapterFactoryLabelProvider);
        right.addContentChangeListener(new IContentChangeListener() {

            @Override
            public void contentChanged(final IContentChangeNotifier compareScript) {
                if (compareScript instanceof RightCompareScript) {
                    setDirty(true);
                    if (getViewer() == null || getViewer().getControl().isDisposed()) {
                        return;
                    }
                    getViewer().refresh(true);
                }
            }
        });
        final DiffNode leaf = new DiffNode(null, Differencer.CHANGE, null, left, right);
        final EObject eContainer = script.getModelElement().eContainer();
        Preconditions.checkState(eContainer != null);
        final DiffNode poolNode = buildPathNodes(eContainer, leaf);
        if (((EObjectNode) poolNode.getAncestor()).getElement() instanceof Pool && root.getChildren().length == 0) {
            root.add(poolNode);
        }
    }
}
 
Example #2
Source File: JavaStructureDiffViewer.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
public void elementChanged(ElementChangedEvent event) {
	ITypedElement[] elements= findAffectedElement(event);
	for (int i= 0; i < elements.length; i++) {
		ITypedElement e= elements[i];
		if (e == null || !(e instanceof IContentChangeNotifier))
			continue;
		contentChanged((IContentChangeNotifier)e);
	}
}