/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License.
*/
/** * This class represents a visual diff presenter, that knows how to compute the * differences between files and show them to the user. * * @author Martin Entlicher
*/ publicabstractclass Diff extends Object {
/** * Get the default visual diff presenter.
*/ publicstatic Diff getDefault() { return Lookup.getDefault().lookup(Diff.class);
}
/** * Get all visual diff presenters registered in the system.
*/ publicstatic Collection<? extends Diff> getAll() { return Lookup.getDefault().lookup(new Lookup.Template<Diff>(Diff.class)).allInstances();
}
/** * Show the visual representation of the diff between two sources. * @param name1 the name of the first source * @param title1 the title of the first source * @param r1 the first source * @param name2 the name of the second source * @param title2 the title of the second source * @param r2 the second resource compared with the first one. * @param MIMEType the mime type of these sources * @return The Component representing the diff visual representation * or null, when the representation is outside the IDE. * @throws IOException when the reading from input streams fails.
*/ publicabstract Component createDiff(String name1, String title1,
Reader r1, String name2, String title2,
Reader r2, String MIMEType) throws IOException ;
/** * Creates single-window diff component that does not include any navigation controls and * is controlled programatically via the returned DiffView interface. * <p> * The StreamSource can be used to save the source content if it's modified * in the view. The view should not allow source modification if StreamSource.createWriter() * returns <code>null</code>. * * @param s1 the first source * @param s2 the second source * @return DiffView controller interface
*/ public DiffView createDiff(StreamSource s1, StreamSource s2) throws IOException { final Component c = createDiff(s1.getName(), s1.getTitle(), s1.createReader(),
s2.getName(), s2.getTitle(), s2.createReader(),
s1.getMIMEType()); returnnew DiffView() {
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.