Lines 81-92
Link Here
|
81 |
import org.netbeans.api.progress.ProgressHandleFactory; |
81 |
import org.netbeans.api.progress.ProgressHandleFactory; |
82 |
import org.openide.awt.HtmlBrowser; |
82 |
import org.openide.awt.HtmlBrowser; |
83 |
import org.openide.awt.Mnemonics; |
83 |
import org.openide.awt.Mnemonics; |
|
|
84 |
import org.openide.filesystems.FileObject; |
84 |
import org.openide.util.Exceptions; |
85 |
import org.openide.util.Exceptions; |
85 |
import org.openide.util.NbBundle; |
86 |
import org.openide.util.NbBundle; |
86 |
import org.openide.util.NbPreferences; |
87 |
import org.openide.util.NbPreferences; |
87 |
import org.openide.util.RequestProcessor; |
88 |
import org.openide.util.RequestProcessor; |
88 |
import org.netbeans.api.autoupdate.UpdateUnitProvider.CATEGORY; |
89 |
import org.netbeans.api.autoupdate.UpdateUnitProvider.CATEGORY; |
89 |
import org.netbeans.modules.autoupdate.ui.actions.ShowNotifications; |
90 |
import org.netbeans.modules.autoupdate.ui.actions.ShowNotifications; |
|
|
91 |
import org.openide.filesystems.FileUtil; |
92 |
import org.openide.util.ImageUtilities; |
90 |
import org.openide.util.Task; |
93 |
import org.openide.util.Task; |
91 |
import org.openide.util.TaskListener; |
94 |
import org.openide.util.TaskListener; |
92 |
|
95 |
|
Lines 905-936
Link Here
|
905 |
private static Preferences getPreferences () { |
908 |
private static Preferences getPreferences () { |
906 |
return NbPreferences.forModule (Utilities.class); |
909 |
return NbPreferences.forModule (Utilities.class); |
907 |
} |
910 |
} |
|
|
911 |
|
912 |
static FileObject getCategoryEntry(CATEGORY category) { |
913 |
FileObject categoryRoot = |
914 |
FileUtil.getConfigFile("Services/AutoupdateCategory/"); |
915 |
FileObject categoryData = categoryRoot.getFileObject(category.name()); |
916 |
if(categoryData == null) |
917 |
categoryData = categoryRoot.getFileObject(CATEGORY.COMMUNITY.name()); |
918 |
return categoryData; |
919 |
} |
908 |
|
920 |
|
909 |
static String getCategoryName(CATEGORY category) { |
921 |
static String getCategoryName(CATEGORY category) { |
910 |
String key = null; |
922 |
FileObject categoryEntry = getCategoryEntry(category); |
911 |
switch (category) { |
923 |
if(categoryEntry == null) |
912 |
case STANDARD: |
924 |
return null; |
913 |
key = "AvailableTab_SourceCategory_Tooltip_STANDARD"; //NOI18N |
925 |
return (String)categoryEntry.getAttribute("displayName"); |
914 |
break; |
|
|
915 |
case BETA: |
916 |
key = "AvailableTab_SourceCategory_Tooltip_BETA"; //NOI18N |
917 |
break; |
918 |
case COMMUNITY: |
919 |
key = "AvailableTab_SourceCategory_Tooltip_COMMUNITY"; //NOI18N |
920 |
break; |
921 |
} |
922 |
return (key != null) ? getBundle(key) : null; |
923 |
} |
926 |
} |
924 |
|
927 |
|
925 |
static URL getCategoryIcon(CATEGORY state) { |
928 |
static URL getCategoryIcon(CATEGORY state) { |
|
|
929 |
FileObject categoryEntry = getCategoryEntry(state); |
930 |
if(categoryEntry == null) |
931 |
return null; |
932 |
Object value=categoryEntry.getAttribute("iconResource"); |
926 |
URL retval = null; |
933 |
URL retval = null; |
927 |
if (CATEGORY.BETA.equals(state)) { |
934 |
if(value instanceof URL) |
928 |
retval = Utilities.class.getResource("/org/netbeans/modules/autoupdate/ui/resources/icon-beta.png"); // NOI18N |
935 |
retval = (URL)value; |
929 |
} else if (CATEGORY.COMMUNITY.equals(state)) { |
|
|
930 |
retval = Utilities.class.getResource("/org/netbeans/modules/autoupdate/ui/resources/icon-community.png"); // NOI18N |
931 |
} else if (CATEGORY.STANDARD.equals(state)) { |
932 |
retval = Utilities.class.getResource("/org/netbeans/modules/autoupdate/ui/resources/icon-standard.png"); // NOI18N |
933 |
} |
934 |
return retval; |
936 |
return retval; |
935 |
} |
937 |
} |
936 |
} |
938 |
} |