[Bug 226111] New: Public support for Preferences editing + flush, support to detect override in Mime prefrences

  • From:
  • To:
  • Subject: [Bug 226111] New: Public support for Preferences editing + flush, support to detect override in Mime prefrences
  • Date: Thu, 14 Feb 2013 11:54:35 +0000
  • Auto-submitted: auto-generated

http://netbeans.org/bugzilla/show_bug.cgi?id=226111

             Bug #: 226111
        Issue Type: DEFECT
           Summary: Public support for Preferences editing + flush,
                    support to detect override in Mime prefrences
    Classification: Unclassified
           Product: editor
           Version: Dev
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Keywords: API_REVIEW_FAST
          Priority: P3
         Component: Settings
        AssignedTo: 

        ReportedBy: 

         QAContact: 



I want to make better support for editor options writers, which take MIME type
into account. For such options, there are typically 'all files' settings, 
and per-language (filetype) overrides. Current pattern in NetBeans allows to
edit both 'all files' defaults AND certain overrides, which makes the
implementations little tricky and complicated.

The Preferences object based on MimePath (MimeLookup) is a view composed of
Preferences found along the MimePath inheritance chain. The Preferences 
defined
for the Mime type take precedence, but fallback on an inherited MIME type is
also implemented as well as a fallback to the ultimate defaults defined for ""
mime type.
It is however impossible to tell whether a Preference is defined for a 
Mimetype
itself. The information is hacked out by working directly with the
EditorSettingsStorage layer - see for example FormattingPanelController
(options.editor module).

I propose that a mixing interface LocalPreferences is defined, and implemented
on MIME PreferencesImpl as follows:

public interface OverridePreferences {
    public boolean isOverriden(String key);
}

that will return true if and only if the PreferencesImpl itself, not its MIME
parent delegate, defines (or marks as removed - non-existent) the key. The
isOverriden() could be also 
coded as a static helper method, but if provided in a mixin interface, the
OverridePreferences interface may be also implemented on different Preferences
implementation (e.g. memory-based),
which support similar override fallback (e.g. they delegate to Mime
preferences).

------

The second change is inspired by an existing code in editor indentation
settings, ProxyPreferences, which tracks changes in memory until flush() is
called. In a newly developed code, I want to use the same behaviour, and I do
not want to duplicate code. Therefore I would like to publish a factory for
ProxyPreferences + add small enhancement, which allows to implement editing of
Preferences with defaults inherited along MIME path.

Please see MemoryPreferences in the attached diff for exact details. The idea
is that the code will create an instance of MemoryPreferences, which is a some
sort of management API that serves and controls the actual Preferences object.
The code will then use the Preferences (which is in fact ProxyPreferences
delegating to the stored and optionally inherited settings). The
MemoryPreferences controller interface is designed to handle special things,
like dirtiness check or destruction.

-- 
Configure bugmail: http://netbeans.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA Contact for the bug.


[Bug 226111] New: Public support for Preferences editing + flush, support to detect override in Mime prefrences

sdedic 02/14/2013

[Bug 226111] Public support for Preferences editing + flush, support to detect override in Mime prefrences

sdedic 02/14/2013

[Bug 226111] Public support for Preferences editing + flush, support to detect override in Mime prefrences

sdedic 02/14/2013

[Bug 226111] Public support for Preferences editing + flush, support to detect override in Mime prefrences

sdedic 02/14/2013

[Bug 226111] Public support for Preferences editing + flush, support to detect override in Mime prefrences

sdedic 02/15/2013

[Bug 226111] Public support for Preferences editing + flush, support to detect override in Mime prefrences

sdedic 02/20/2013

[Bug 226111] Public support for Preferences editing + flush, support to detect override in Mime prefrences

sdedic 02/27/2013

[Bug 226111] Public support for Preferences editing + flush, support to detect override in Mime prefrences

sdedic 02/27/2013

Project Features

About this Project

Editor was started in November 2009, is owned by Martin Ryzl, and has 147 members.
By use of this website, you agree to the NetBeans Policies and Terms of Use (revision 20140418.2d69abc). © 2013, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo
 
 
Close
loading
Please Confirm
Close