|
|
List of the main features:
Support to everything related to creation and visualization of diffs. This library allows registrations of various diff providers and visualizers and provides programatic access to their functionality.
Question (arch-usecases): Describe the main use cases of the new API. Who will use it under what circumstances? What kind of code would typically need to be written to use the module? Answer:From an action or wherever you like you can call this:
public void diff(final StreamSource local, final StreamSource remote){ SwingUtilities.invokeLater(new Runnable() { public void run() { try { DiffView view = Diff.getDefault().createDiff(local, remote); showDiff(view); } catch (IOException ex) { Logger.getLogger(ThisClass.class.getName()).throwing(ex); } } }); } public void showDiff(final DiffView view){ SwingUtilities.invokeLater(new Runnable() { public void run() { //create our panel with our view //right now I am just going to use the diff component // instead of a panel //create a topcomponent with our panel DiffTopComponent tc = new DiffTopComponent(view); tc.setName("MY_DIFF"); tc.setDisplayName("Some display name"); tc.open(); tc.requestActive(); } }); }
Here is a top component to display it:
public class DiffTopComponent extends TopComponent { /** Creates a new instance of DiffTopComponent */ public DiffTopComponent(Component diffPanel) { setLayout(new BorderLayout()); add(diffPanel, BorderLayout.CENTER); getAccessibleContext().setAccessibleName( NbBundle.getMessage(DiffTopComponent.class, "ACSN_Diff_Top_Component")); // NOI18N getAccessibleContext().setAccessibleDescription( NbBundle.getMessage(DiffTopComponent.class, "ACSD_Diff_Top_Component")); // NOI18N } public DiffTopComponent(DiffView view) { this(view.getComponent()); } public int getPersistenceType(){ return TopComponent.PERSISTENCE_NEVER; } protected String preferredID(){ return "DiffTopComponent"; //NOI18N } public HelpCtx getHelpCtx() { return new HelpCtx(getClass()); } }Question (arch-time): What are the time estimates of the work? Answer:
Finished in 2002.
Question (arch-quality): How will the quality of your code be tested and how are future regressions going to be prevented? Answer:XXX no answer for arch-quality
Question (arch-where): Where one can find sources for your module? Answer:
The sources for the module are in the NetBeans Mercurial repositories.
XXX no answer for compat-deprecation
java.io.File
directly?
Answer:
Yes, for temporary files and for location of the patch file.
Question (resources-layer):
Does your module provide own layer? Does it create any files or
folders in it? What it is trying to communicate by that and with which
components?
Answer:
Yes. The module defines the provided diff and merge engines and visualizers
so that they can be accessed by lookup. Also settings are defined there.
Question (resources-read):
Does your module read any resources from layers? For what purpose?
Answer:
No.
Question (resources-mask):
Does your module mask/hide/override any resources provided by other modules in
their layers?
Answer:
No.
Question (resources-preferences):
Does your module uses preferences via Preferences API? Does your module use NbPreferences or
or regular JDK Preferences ? Does it read, write or both ?
Does it share preferences with other modules ? If so, then why ?
WARNING: Question with id="resources-preferences" has not been answered!org.openide.util.Lookup
or any similar technology to find any components to communicate with? Which ones?
Answer:
Yes. Lookup is used to get all registered diff and merge engines and visualizers.
Question (lookup-register):
Do you register anything into lookup for other code to find?
Answer:
Yes. The module registers two diff engines, two diff visualizers and one merge
visualizer (visual conflicts resolver).
Question (lookup-remove):
Do you remove entries of other modules from lookup?
Answer:
No.
System.getProperty
) property?
On a similar note, is there something interesting that you
pass to java.util.logging.Logger
? Or do you observe
what others log?
Answer:
user.dir
-
Used as a default directory in the file chooser, that is used by the patch action.
Question (exec-component):
Is execution of your code influenced by any (string) property
of any of your components?
Answer:
No.
Question (exec-ant-tasks):
Do you define or register any ant tasks that other can use?
Answer:
XXX no answer for exec-ant-tasks
Question (exec-classloader): Does your code create its own class loader(s)? Answer: No. Question (exec-reflection): Does your code use Java Reflection to execute other code? Answer: No. Question (exec-privateaccess): Are you aware of any other parts of the system calling some of your methods by reflection? Answer: No. Question (exec-process): Do you execute an external process from your module? How do you ensure that the result is the same on different platforms? Do you parse output? Do you depend on result code? Answer: Yes, for an external diff engine. The standard UNIX diff output is expected, it's the responsibility of the user to supply the correct executable. Question (exec-introspection): Does your module use any kind of runtime type information (instanceof
,
work with java.lang.Class
, etc.)?
Answer:
Yes.
XXX no answer for exec-threading
Question (security-policy): Does your functionality require modifications to the standard policy file? Answer:XXX no answer for security-policy
Question (security-grant): Does your code grant additional rights to some other code? Answer:XXX no answer for security-grant
java.awt.datatransfer.Transferable
?
Answer:
No clipboard communication is implemented.
XXX no answer for perf-spi