This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 147715
Collapse All | Expand All

(-)a/nbi/engine/native/launcher/unix/i18n/launcher.properties (+2 lines)
Lines 52-57 Link Here
52
nlu.jvm.search=Searching for JVM on the system...
52
nlu.jvm.search=Searching for JVM on the system...
53
53
54
nlu.msg.usage=\nUsage:
54
nlu.msg.usage=\nUsage:
55
nlu.msg.usage.more=\nMore options:
55
nlu.arg.javahome=\t{0}\t<dir>\tUsing java from <dir> for running application
56
nlu.arg.javahome=\t{0}\t<dir>\tUsing java from <dir> for running application
56
nlu.arg.verbose=\t{0}\t\tUse verbose output
57
nlu.arg.verbose=\t{0}\t\tUse verbose output
57
nlu.arg.output=\t{0}\t<out>\tRedirect all output to file <out>
58
nlu.arg.output=\t{0}\t<out>\tRedirect all output to file <out>
Lines 63-68 Link Here
63
nlu.arg.locale=\t{0}\t<locale>\tOverride default locale with specified <locale>
64
nlu.arg.locale=\t{0}\t<locale>\tOverride default locale with specified <locale>
64
nlu.arg.silent=\t{0}\t\tRun installer silently
65
nlu.arg.silent=\t{0}\t\tRun installer silently
65
nlu.arg.help=\t{0}\t\tShow this help
66
nlu.arg.help=\t{0}\t\tShow this help
67
nlu.arg.help.more=\t{0}\t\tShow more options
66
68
67
69
68
nlu.java.application.name.macosx=NetBeans IDE Installer
70
nlu.java.application.name.macosx=NetBeans IDE Installer
(-)a/nbi/engine/native/launcher/unix/src/launcher.sh (-3 / +39 lines)
Lines 44-49 Link Here
44
ARG_CLASSPATHA="--classpath-append"
44
ARG_CLASSPATHA="--classpath-append"
45
ARG_CLASSPATHP="--classpath-prepend"
45
ARG_CLASSPATHP="--classpath-prepend"
46
ARG_HELP="--help"
46
ARG_HELP="--help"
47
ARG_HELP_MORE="--more"
47
ARG_SILENT="--silent"
48
ARG_SILENT="--silent"
48
ARG_NOSPACECHECK="--nospacecheck"
49
ARG_NOSPACECHECK="--nospacecheck"
49
ARG_LOCALE="--locale"
50
ARG_LOCALE="--locale"
Lines 53-58 Link Here
53
SILENT_MODE=0
54
SILENT_MODE=0
54
EXTRACT_ONLY=0
55
EXTRACT_ONLY=0
55
SHOW_HELP_ONLY=0
56
SHOW_HELP_ONLY=0
57
SHOW_HELP_MORE_ONLY=0
56
LOCAL_OVERRIDDEN=0
58
LOCAL_OVERRIDDEN=0
57
APPEND_CP=
59
APPEND_CP=
58
PREPEND_CP=
60
PREPEND_CP=
Lines 104-110 Link Here
104
MSG_ARG_LOCALE="nlu.arg.locale"
106
MSG_ARG_LOCALE="nlu.arg.locale"
105
MSG_ARG_SILENT="nlu.arg.silent"
107
MSG_ARG_SILENT="nlu.arg.silent"
106
MSG_ARG_HELP="nlu.arg.help"
108
MSG_ARG_HELP="nlu.arg.help"
109
MSG_ARG_HELP_MORE="nlu.arg.help.more"
107
MSG_USAGE="nlu.msg.usage"
110
MSG_USAGE="nlu.msg.usage"
111
MSG_USAGE_MORE="nlu.msg.usage.more"
108
112
109
isSymlink=
113
isSymlink=
110
114
Lines 117-123 Link Here
117
	setLauncherLocale	
121
	setLauncherLocale	
118
	debugLauncherArguments "$@"
122
	debugLauncherArguments "$@"
119
	if [ 1 -eq $SHOW_HELP_ONLY ] ; then
123
	if [ 1 -eq $SHOW_HELP_ONLY ] ; then
120
		showHelp
124
            showHelp
125
	fi
126
	if [ 1 -eq $SHOW_HELP_MORE_ONLY ] ; then
127
	    showHelpMore
128
	fi
129
	if [ 1 -eq $SHOW_HELP_ONLY ] || [ 1 -eq $SHOW_HELP_MORE_ONLY ] ; then
130
            exitProgram $ERROR_OK
121
	fi
131
	fi
122
	
132
	
123
        message "$MSG_STARTING"
133
        message "$MSG_STARTING"
Lines 159-165 Link Here
159
}
169
}
160
isLauncherCommandArgument() {
170
isLauncherCommandArgument() {
161
	case "$1" in
171
	case "$1" in
162
	    $ARG_VERBOSE | $ARG_NOSPACECHECK | $ARG_OUTPUT | $ARG_HELP | $ARG_JAVAHOME | $ARG_TEMPDIR | $ARG_EXTRACT | $ARG_SILENT | $ARG_LOCALE | $ARG_CLASSPATHP | $ARG_CLASSPATHA)
172
	    $ARG_VERBOSE | $ARG_NOSPACECHECK | $ARG_OUTPUT | $ARG_HELP | $ARG_HELP_MORE | $ARG_JAVAHOME | $ARG_TEMPDIR | $ARG_EXTRACT | $ARG_SILENT | $ARG_LOCALE | $ARG_CLASSPATHP | $ARG_CLASSPATHA)
163
	    	echo 1
173
	    	echo 1
164
		;;
174
		;;
165
	    *)
175
	    *)
Lines 191-196 Link Here
191
			;;
201
			;;
192
		$ARG_HELP)
202
		$ARG_HELP)
193
			SHOW_HELP_ONLY=1
203
			SHOW_HELP_ONLY=1
204
			;;
205
		$ARG_HELP_MORE)
206
			SHOW_HELP_MORE_ONLY=1
194
			;;
207
			;;
195
		$ARG_JAVAHOME)
208
		$ARG_JAVAHOME)
196
			if [ -n "$2" ] ; then
209
			if [ -n "$2" ] ; then
Lines 543-550 Link Here
543
	out "$msg9"
556
	out "$msg9"
544
	out "$msg10"
557
	out "$msg10"
545
	out "$msg11"
558
	out "$msg11"
546
	exitProgram $ERROR_OK
559
	if [ $HELP_MORE_OPTIONS_NUMBER -ne 0 ] ; then
560
	    msg12=`message "$MSG_ARG_HELP_MORE $ARG_HELP_MORE"`
561
	    out "$msg12"
562
	fi
547
}
563
}
564
565
showHelpMore() {
566
        if [ $HELP_MORE_OPTIONS_NUMBER -ne 0 ] ; then
567
            msg=`message "$MSG_USAGE_MORE"`
568
	    out "$msg"
569
            moreOptionCounter=0
570
	    while [ $moreOptionCounter -lt $HELP_MORE_OPTIONS_NUMBER ] ; do
571
		msgKey="$""HELP_MORE_OPTION_"$moreOptionCounter"_NAME"
572
		msgKeyResolved=`eval "echo \"$msgKey\""`
573
574
		msgArg="$""HELP_MORE_OPTION_"$moreOptionCounter"_ARG"
575
		msgArgResolved=`eval "echo \"$msgArg\""`
576
577
		resolvedMessage=`message "$msgKeyResolved $msgArgResolved"`
578
		out "$resolvedMessage"
579
		moreOptionCounter=`expr "$moreOptionCounter" + 1`
580
	    done
581
	fi
582
}
583
548
584
549
exitProgram() {
585
exitProgram() {
550
	if [ 0 -eq $EXTRACT_ONLY ] ; then
586
	if [ 0 -eq $EXTRACT_ONLY ] ; then
(-)a/nbi/engine/native/launcher/windows/i18n/launcher.properties (-1 / +3 lines)
Lines 57-63 Link Here
57
nlw.arg.locale={0} <locale>\n\tOverride system default locale with <locale>
57
nlw.arg.locale={0} <locale>\n\tOverride system default locale with <locale>
58
nlw.arg.silent={0} \n\tRun installer silently
58
nlw.arg.silent={0} \n\tRun installer silently
59
nlw.arg.help={0}\n\tShow help message
59
nlw.arg.help={0}\n\tShow help message
60
60
nlw.arg.help.more={0}\n\tShow more options
61
nlw.msg.usage=\nUsage:\n
62
nlw.msg.usage.more=\nMore Options:\n
61
63
62
nlw.msg.create.tmpdir=Creating temporary directory ...
64
nlw.msg.create.tmpdir=Creating temporary directory ...
63
nlw.msg.extract=Extracting data ...
65
nlw.msg.extract=Extracting data ...
(-)a/nbi/engine/native/launcher/windows/src/ExtractUtils.c (+37 lines)
Lines 553-558 Link Here
553
    }
553
    }
554
}
554
}
555
555
556
void loadMoreOptionsMap(LauncherProperties * props) {
557
    DWORD i=0;
558
    DWORD j=0;
559
    //read number of locales
560
    
561
    DWORD numberOfMoreOptions = 0;    
562
    
563
    readNumberWithDebug(props, &numberOfMoreOptions, "number of more options");
564
    if(!isOK(props)) return;
565
    if(numberOfMoreOptions == 0) {
566
        props->status = ERROR_INTEGRITY;
567
        return ;
568
    }
569
    props->moreOptionsHelpNumber = numberOfMoreOptions;
570
    props->moreOptionsHelpArgs = newppWCHAR(props->moreOptionsHelpNumber);
571
    props->moreOptionsHelpKeys = newppChar(props->moreOptionsHelpNumber);
572
    writeMessageA(props, OUTPUT_LEVEL_DEBUG, 0, "Iterating...", 1);
573
    for(i=0; isOK(props) && i<numberOfMoreOptions;i++) {
574
        char * propName = newpChar(20);
575
        writeMessageA(props, OUTPUT_LEVEL_DEBUG, 0, "... next item", 1);
576
        props->moreOptionsHelpArgs[i] = NULL;
577
        writeMessageA(props, OUTPUT_LEVEL_DEBUG, 0, "... reading arg", 1);
578
        sprintf(propName, "argument name %2ld", i);
579
        readStringWithDebugW(props, & (props->moreOptionsHelpArgs[i]), propName);
580
        FREE(propName);
581
        if(!isOK(props)) return;
582
        
583
        props->moreOptionsHelpKeys[i] = NULL;
584
        writeMessageA(props, OUTPUT_LEVEL_DEBUG, 0, "... reading key", 1);
585
        propName = newpChar(20);
586
        sprintf(propName, "key name %2ld", i);
587
        readStringWithDebugA(props, & (props->moreOptionsHelpKeys[i]), propName);
588
        FREE(propName);        
589
    }
590
    writeMessageA(props, OUTPUT_LEVEL_DEBUG, 0, "... more option loaded", 1);
591
}
592
556
LauncherResource * newLauncherResource() {
593
LauncherResource * newLauncherResource() {
557
    LauncherResource * file = (LauncherResource *) LocalAlloc(LPTR, sizeof(LauncherResource));
594
    LauncherResource * file = (LauncherResource *) LocalAlloc(LPTR, sizeof(LauncherResource));
558
    file->path=NULL;
595
    file->path=NULL;
(-)a/nbi/engine/native/launcher/windows/src/ExtractUtils.h (-1 / +1 lines)
Lines 51-57 Link Here
51
    void skipStub(LauncherProperties * props);
51
    void skipStub(LauncherProperties * props);
52
    
52
    
53
    void loadI18NStrings(LauncherProperties * props);
53
    void loadI18NStrings(LauncherProperties * props);
54
    
54
    void loadMoreOptionsMap(LauncherProperties * props);
55
    WCHARList * newWCHARList(DWORD number) ;
55
    WCHARList * newWCHARList(DWORD number) ;
56
    void readLauncherProperties(LauncherProperties * props);    
56
    void readLauncherProperties(LauncherProperties * props);    
57
    void freeWCHARList(WCHARList ** plist);
57
    void freeWCHARList(WCHARList ** plist);
(-)a/nbi/engine/native/launcher/windows/src/Launcher.c (-16 / +70 lines)
Lines 49-55 Link Here
49
#include "ExtractUtils.h"
49
#include "ExtractUtils.h"
50
#include "Main.h"
50
#include "Main.h"
51
51
52
const DWORD NUMBER_OF_HELP_ARGUMENTS = 11;
52
const DWORD NUMBER_OF_HELP_ARGUMENTS = 12;
53
const DWORD READ_WRITE_BUFSIZE = 65536;
53
const DWORD READ_WRITE_BUFSIZE = 65536;
54
const WCHAR * outputFileArg       = L"--output";
54
const WCHAR * outputFileArg       = L"--output";
55
const WCHAR * javaArg             = L"--javahome";
55
const WCHAR * javaArg             = L"--javahome";
Lines 59-64 Link Here
59
const WCHAR * classPathAppend     = L"--classpath-append";
59
const WCHAR * classPathAppend     = L"--classpath-append";
60
const WCHAR * extractArg          = L"--extract";
60
const WCHAR * extractArg          = L"--extract";
61
const WCHAR * helpArg             = L"--help";
61
const WCHAR * helpArg             = L"--help";
62
const WCHAR * moreArg             = L"--more";
62
const WCHAR * helpOtherArg        = L"/?";
63
const WCHAR * helpOtherArg        = L"/?";
63
const WCHAR * silentArg           = L"--silent";
64
const WCHAR * silentArg           = L"--silent";
64
const WCHAR * nospaceCheckArg     = L"--nospacecheck";
65
const WCHAR * nospaceCheckArg     = L"--nospacecheck";
Lines 163-168 Link Here
163
    
164
    
164
    if(!isOK(props)) {
165
    if(!isOK(props)) {
165
        writeMessageA(props, OUTPUT_LEVEL_NORMAL, 1, "Error! Can`t load i18n strings!!", 1);
166
        writeMessageA(props, OUTPUT_LEVEL_NORMAL, 1, "Error! Can`t load i18n strings!!", 1);
167
        showErrorW(props, INTEGRITY_ERROR_PROP, 1, props->exeName);
168
    }
169
}
170
171
void loadMoreOptions(LauncherProperties *props) {
172
    // load localized messages
173
    writeMessageA(props, OUTPUT_LEVEL_DEBUG, 0, "Loading more help options.", 1);
174
    loadMoreOptionsMap(props);
175
    
176
    if(!isOK(props)) {
177
        writeMessageA(props, OUTPUT_LEVEL_NORMAL, 1, "Error! Can`t load more options!!", 1);
166
        showErrorW(props, INTEGRITY_ERROR_PROP, 1, props->exeName);
178
        showErrorW(props, INTEGRITY_ERROR_PROP, 1, props->exeName);
167
    }
179
    }
168
}
180
}
Lines 717-728 Link Here
717
}
729
}
718
730
719
DWORD isOnlyHelp(LauncherProperties * props) {
731
DWORD isOnlyHelp(LauncherProperties * props) {
720
    if(argumentExists(props, helpArg, 1) || argumentExists(props, helpOtherArg, 1)) {
732
    DWORD helpArgExist      = argumentExists(props, helpArg, 1);
721
        
733
    DWORD helpOtherArgExist = argumentExists(props, helpArg, 1);
722
        WCHARList * help = newWCHARList(NUMBER_OF_HELP_ARGUMENTS);
734
    DWORD moreArgExist      = argumentExists(props, moreArg, 1);
723
        DWORD counter = 0;
735
    DWORD numberOfArgs = 0;
724
        WCHAR * helpString = NULL;
736
    DWORD counter = 0;
725
        
737
    WCHAR * helpString = NULL;
738
    WCHARList * help = NULL;
739
    
740
    if (!helpArgExist && !helpOtherArgExist && !moreArgExist) {
741
        return 0;
742
    }
743
744
    writeMessageA(props, OUTPUT_LEVEL_DEBUG, 0, "... loading help strings", 1);
745
    
746
    if (helpArgExist) {
747
        numberOfArgs += NUMBER_OF_HELP_ARGUMENTS - ((props->moreOptionsHelpNumber == 0) ? 1 : 0) + 1;    
748
    }
749
    if (moreArgExist) {
750
        numberOfArgs += props->moreOptionsHelpNumber + 1;
751
    } 
752
753
    help = newWCHARList(numberOfArgs);
754
755
    counter = 0;
756
    if (helpArgExist) {
757
        writeMessageA(props, OUTPUT_LEVEL_DEBUG, 0, "... loading main help strings", 1);
758
        help->items[counter++] = formatMessageW(getI18nProperty(props, MSG_USAGE), 0);
726
        help->items[counter++] = formatMessageW(getI18nProperty(props, ARG_JAVA_PROP), 1, javaArg);
759
        help->items[counter++] = formatMessageW(getI18nProperty(props, ARG_JAVA_PROP), 1, javaArg);
727
        help->items[counter++] = formatMessageW(getI18nProperty(props, ARG_TMP_PROP), 1, tempdirArg);
760
        help->items[counter++] = formatMessageW(getI18nProperty(props, ARG_TMP_PROP), 1, tempdirArg);
728
        help->items[counter++] = formatMessageW(getI18nProperty(props, ARG_EXTRACT_PROP), 1, extractArg);
761
        help->items[counter++] = formatMessageW(getI18nProperty(props, ARG_EXTRACT_PROP), 1, extractArg);
Lines 734-750 Link Here
734
        help->items[counter++] = formatMessageW(getI18nProperty(props, ARG_LOCALE_PROP), 1, localeArg);
767
        help->items[counter++] = formatMessageW(getI18nProperty(props, ARG_LOCALE_PROP), 1, localeArg);
735
        help->items[counter++] = formatMessageW(getI18nProperty(props, ARG_SILENT_PROP), 1, silentArg);
768
        help->items[counter++] = formatMessageW(getI18nProperty(props, ARG_SILENT_PROP), 1, silentArg);
736
        help->items[counter++] = formatMessageW(getI18nProperty(props, ARG_HELP_PROP), 1, helpArg);
769
        help->items[counter++] = formatMessageW(getI18nProperty(props, ARG_HELP_PROP), 1, helpArg);
737
        
770
        if (props->moreOptionsHelpNumber != 0) {
738
        
771
            help->items[counter++] = formatMessageW(getI18nProperty(props, ARG_MORE_PROP), 1, moreArg);
739
        for(counter=0;counter<NUMBER_OF_HELP_ARGUMENTS;counter++) {
740
            helpString = appendStringW(appendStringW(helpString, help->items[counter]), NEW_LINE);
741
        }
772
        }
742
        freeWCHARList(&help);
743
        showMessageW(props, helpString, 0);
744
        FREE(helpString);
745
        return 1;
746
    }
773
    }
747
    return 0;
774
    if (moreArgExist) {
775
        DWORD i = 0;
776
        help->items[counter++] = formatMessageW(getI18nProperty(props, MSG_USAGE_MORE),0);
777
        writeMessageA(props, OUTPUT_LEVEL_DEBUG, 0, "... loading more help strings", 1);
778
        for (i = 0; i < props->moreOptionsHelpNumber; i++) {
779
            help->items[counter++] = formatMessageW(getI18nProperty(props, props->moreOptionsHelpKeys[i]), 1, props->moreOptionsHelpArgs[i]);
780
        }
781
    }
782
    writeMessageA(props, OUTPUT_LEVEL_DEBUG, 0, "... creating full help message", 1);
783
    for (counter = 0; counter < numberOfArgs; counter++) {        
784
        helpString = appendStringW(appendStringW(helpString, help->items[counter]), NEW_LINE);        
785
    }           
786
    freeWCHARList(&help);
787
    showMessageW(props, helpString, 0);
788
    FREE(helpString);
789
    return 1;
748
}
790
}
749
791
750
DWORD isSilent(LauncherProperties * props) {
792
DWORD isSilent(LauncherProperties * props) {
Lines 785-790 Link Here
785
    
827
    
786
    props->jvmArguments = NULL;
828
    props->jvmArguments = NULL;
787
    props->appArguments = NULL;
829
    props->appArguments = NULL;
830
    props->moreOptionsHelpKeys = NULL;
831
    props->moreOptionsHelpArgs = NULL;
788
    props->extractOnly  = 0;
832
    props->extractOnly  = 0;
789
    props->mainClass    = NULL;
833
    props->mainClass    = NULL;
790
    props->testJVMClass = NULL;
834
    props->testJVMClass = NULL;
Lines 856-861 Link Here
856
        writeMessageA(*props, OUTPUT_LEVEL_DEBUG, 0, "Closing launcher properties", 1);
900
        writeMessageA(*props, OUTPUT_LEVEL_DEBUG, 0, "Closing launcher properties", 1);
857
        freeWCHARList(& ( (*props)->appArguments));
901
        freeWCHARList(& ( (*props)->appArguments));
858
        freeWCHARList(& ( (*props)->jvmArguments));
902
        freeWCHARList(& ( (*props)->jvmArguments));
903
        
904
        for(i=0;i<(*props)->moreOptionsHelpNumber;i++) {
905
            FREE((*props)->moreOptionsHelpArgs[i]);
906
            FREE((*props)->moreOptionsHelpKeys[i]);
907
        }        
908
        FREE((*props)->moreOptionsHelpArgs);
909
        FREE((*props)->moreOptionsHelpKeys);
859
        
910
        
860
        FREE((*props)->mainClass);
911
        FREE((*props)->mainClass);
861
        FREE((*props)->testJVMClass);
912
        FREE((*props)->testJVMClass);
Lines 934-939 Link Here
934
    loadLocalizationStrings(props);
985
    loadLocalizationStrings(props);
935
    if(!isOK(props) || isTerminated(props)) return;
986
    if(!isOK(props) || isTerminated(props)) return;
936
    
987
    
988
    loadMoreOptions(props);
989
    if(!isOK(props) || isTerminated(props)) return;
990
    
937
    if(isOnlyHelp(props)) return;
991
    if(isOnlyHelp(props)) return;
938
    
992
    
939
    setProgressTitleString(props, getI18nProperty(props, MSG_PROGRESS_TITLE));
993
    setProgressTitleString(props, getI18nProperty(props, MSG_PROGRESS_TITLE));
(-)a/nbi/engine/native/launcher/windows/src/Main.c (-1 / +1 lines)
Lines 462-468 Link Here
462
    
462
    
463
    result = newpWCHAR(totalLength + 1);
463
    result = newpWCHAR(totalLength + 1);
464
    va_start(ap, varArgsNumber);
464
    va_start(ap, varArgsNumber);
465
    wvsprintfW(result, message, ap);
465
    _snwprintf(result, totalLength, message, ap);
466
    va_end(ap);
466
    va_end(ap);
467
    writeMessageW(props, OUTPUT_LEVEL_DEBUG, 0, result, 1);
467
    writeMessageW(props, OUTPUT_LEVEL_DEBUG, 0, result, 1);
468
    if(!isSilent(props)) {
468
    if(!isSilent(props)) {
(-)a/nbi/engine/native/launcher/windows/src/StringUtils.c (+9 lines)
Lines 68-73 Link Here
68
const char * ARG_LOCALE_PROP              = "nlw.arg.locale";
68
const char * ARG_LOCALE_PROP              = "nlw.arg.locale";
69
const char * ARG_SILENT_PROP              = "nlw.arg.silent";
69
const char * ARG_SILENT_PROP              = "nlw.arg.silent";
70
const char * ARG_HELP_PROP                = "nlw.arg.help";
70
const char * ARG_HELP_PROP                = "nlw.arg.help";
71
const char * ARG_MORE_PROP                = "nlw.arg.help.more";
71
72
72
const char * MSG_CREATE_TMPDIR     = "nlw.msg.create.tmpdir";
73
const char * MSG_CREATE_TMPDIR     = "nlw.msg.create.tmpdir";
73
const char * MSG_EXTRACT_DATA      = "nlw.msg.extract";
74
const char * MSG_EXTRACT_DATA      = "nlw.msg.extract";
Lines 77-82 Link Here
77
const char * MSG_TITLE             = "nlw.msg.title";
78
const char * MSG_TITLE             = "nlw.msg.title";
78
const char * MSG_MESSAGEBOX_TITLE  = "nlw.msg.messagebox.title";
79
const char * MSG_MESSAGEBOX_TITLE  = "nlw.msg.messagebox.title";
79
const char * MSG_PROGRESS_TITLE    = "nlw.msg.progress.title";
80
const char * MSG_PROGRESS_TITLE    = "nlw.msg.progress.title";
81
const char * MSG_USAGE             = "nlw.msg.usage";
82
const char * MSG_USAGE_MORE        = "nlw.msg.usage.more";
80
83
81
const char * EXIT_BUTTON_PROP     = "nlw.msg.button.error" ;   
84
const char * EXIT_BUTTON_PROP     = "nlw.msg.button.error" ;   
82
const char * MAIN_WINDOW_TITLE     = "nlw.msg.main.title" ;
85
const char * MAIN_WINDOW_TITLE     = "nlw.msg.main.title" ;
Lines 198-203 Link Here
198
        return L"Can`t run prepare bundled JVM";
201
        return L"Can`t run prepare bundled JVM";
199
    } else if(lstrcmpA(name, BUNDLED_JVM_VERIFY_ERROR_PROP)==0) {
202
    } else if(lstrcmpA(name, BUNDLED_JVM_VERIFY_ERROR_PROP)==0) {
200
        return L"Can`t run verify bundled JVM";
203
        return L"Can`t run verify bundled JVM";
204
    } else if(lstrcmpA(name, ARG_MORE_PROP)==0) {
205
        return L"%s Get more options help";
206
    } else if(lstrcmpA(name, MSG_USAGE)==0) {
207
        return L"Usage:";
208
    } else if(lstrcmpA(name, MSG_USAGE_MORE)==0) {
209
        return L"More Options:";
201
    }
210
    }
202
    return NULL;   
211
    return NULL;   
203
}
212
}
(-)a/nbi/engine/native/launcher/windows/src/StringUtils.h (+3 lines)
Lines 67-72 Link Here
67
extern const char *  ARG_LOCALE_PROP;
67
extern const char *  ARG_LOCALE_PROP;
68
extern const char *  ARG_SILENT_PROP;
68
extern const char *  ARG_SILENT_PROP;
69
extern const char *  ARG_HELP_PROP;
69
extern const char *  ARG_HELP_PROP;
70
extern const char *  ARG_MORE_PROP;
70
extern const char * MSG_CREATE_TMPDIR;     
71
extern const char * MSG_CREATE_TMPDIR;     
71
extern const char * MSG_EXTRACT_DATA;     
72
extern const char * MSG_EXTRACT_DATA;     
72
extern const char * MSG_JVM_SEARCH;       
73
extern const char * MSG_JVM_SEARCH;       
Lines 77-82 Link Here
77
extern const char * MSG_PROGRESS_TITLE;   
78
extern const char * MSG_PROGRESS_TITLE;   
78
extern const char * EXIT_BUTTON_PROP;     
79
extern const char * EXIT_BUTTON_PROP;     
79
extern const char * MAIN_WINDOW_TITLE;    
80
extern const char * MAIN_WINDOW_TITLE;    
81
extern const char * MSG_USAGE;
82
extern const char * MSG_USAGE_MORE;
80
    
83
    
81
#define FREE(x) { \
84
#define FREE(x) { \
82
	if((x)!=NULL) {\
85
	if((x)!=NULL) {\
(-)a/nbi/engine/native/launcher/windows/src/Types.h (+4 lines)
Lines 131-136 Link Here
131
        WCHAR  * classpath;
131
        WCHAR  * classpath;
132
        WCHAR  * mainClass;
132
        WCHAR  * mainClass;
133
        
133
        
134
        char ** moreOptionsHelpKeys;
135
        WCHAR ** moreOptionsHelpArgs;
136
        DWORD moreOptionsHelpNumber;
137
        
134
        JavaProperties  * java;
138
        JavaProperties  * java;
135
        WCHAR  * command;
139
        WCHAR  * command;
136
        WCHAR  * exePath;
140
        WCHAR  * exePath;
(-)a/nbi/engine/src/org/netbeans/installer/utils/cli/CLIHandler.java (-4 / +4 lines)
Lines 63-69 Link Here
63
    public void proceed() {
63
    public void proceed() {
64
        if (args.hasNext()) {
64
        if (args.hasNext()) {
65
            LogManager.log("... parsing arguments : " + args.toString()); // NOI18N            
65
            LogManager.log("... parsing arguments : " + args.toString()); // NOI18N            
66
            List<CLIOption> list = getOptions();
66
            List<CLIOption> list = getAvailableOptions();
67
67
68
            while (args.hasNext()) {
68
            while (args.hasNext()) {
69
                final String currentArg = args.next();
69
                final String currentArg = args.next();
Lines 87-100 Link Here
87
        }
87
        }
88
    }
88
    }
89
89
90
    private List<CLIOption> getOptions() {
90
    public static List<CLIOption> getAvailableOptions() {
91
        List<CLIOption> list = new ArrayList<CLIOption>();
91
        List<CLIOption> list = new ArrayList<CLIOption>();
92
        loadDefaultOptions(list);
92
        loadDefaultOptions(list);
93
        loadAdditionalOptions(list);
93
        loadAdditionalOptions(list);
94
        return list;
94
        return list;
95
    }
95
    }
96
96
97
    private void loadDefaultOptions(List<CLIOption> list) {
97
    private static void loadDefaultOptions(List<CLIOption> list) {
98
        list.add(new BundlePropertiesOption());
98
        list.add(new BundlePropertiesOption());
99
        list.add(new CreateBundleOption());
99
        list.add(new CreateBundleOption());
100
        list.add(new ForceInstallOption());
100
        list.add(new ForceInstallOption());
Lines 115-121 Link Here
115
        list.add(new UserdirOption());
115
        list.add(new UserdirOption());
116
    }
116
    }
117
117
118
    private void loadAdditionalOptions(List<CLIOption> list) {
118
    private static void loadAdditionalOptions(List<CLIOption> list) {
119
        InputStream is = ResourceUtils.getResource(OPTIONS_LIST);
119
        InputStream is = ResourceUtils.getResource(OPTIONS_LIST);
120
        if (is != null) {
120
        if (is != null) {
121
            LogManager.log(ErrorLevel.MESSAGE, "... loading additional CLI option classes, if necessary");
121
            LogManager.log(ErrorLevel.MESSAGE, "... loading additional CLI option classes, if necessary");
(-)a/nbi/engine/src/org/netbeans/installer/utils/cli/CLIOption.java (-1 / +45 lines)
Lines 33-42 Link Here
33
 * the option applies only if the new code is made subject to such option by the
33
 * the option applies only if the new code is made subject to such option by the
34
 * copyright holder.
34
 * copyright holder.
35
 */
35
 */
36
37
package org.netbeans.installer.utils.cli;
36
package org.netbeans.installer.utils.cli;
38
37
38
import java.util.ArrayList;
39
import java.util.HashMap;
40
import java.util.List;
41
import java.util.Locale;
42
import java.util.Map;
43
import java.util.MissingResourceException;
44
import java.util.ResourceBundle;
39
import org.netbeans.installer.utils.LogManager;
45
import org.netbeans.installer.utils.LogManager;
46
import org.netbeans.installer.utils.ResourceUtils;
40
import org.netbeans.installer.utils.StringUtils;
47
import org.netbeans.installer.utils.StringUtils;
41
import org.netbeans.installer.utils.exceptions.CLIOptionException;
48
import org.netbeans.installer.utils.exceptions.CLIOptionException;
42
49
Lines 50-55 Link Here
50
            "parsing command line parameter \"{0}\"";//NOI18N
57
            "parsing command line parameter \"{0}\"";//NOI18N
51
    protected static final String UNARY_ARG_VALUE =
58
    protected static final String UNARY_ARG_VALUE =
52
            Boolean.toString(true); // NOI18N
59
            Boolean.toString(true); // NOI18N
60
    protected static final String BUNDLE_KEY_PREFIX = "O.help.";//NOI18N
61
    
62
    private Map <Locale, String> helpMessageMap;
53
63
54
    public void init() {
64
    public void init() {
55
        LogManager.logIndent(StringUtils.format(
65
        LogManager.logIndent(StringUtils.format(
Lines 60-65 Link Here
60
    }
70
    }
61
    public void finish() {
71
    public void finish() {
62
        LogManager.unindent(); // NOI18N
72
        LogManager.unindent(); // NOI18N
73
    }
74
75
    public Map<Locale, String> getHelpMessages() {
76
        if(helpMessageMap!=null) {
77
            return helpMessageMap;
78
        }
79
        final String key = getHelpKey();
80
        helpMessageMap = new HashMap<Locale, String>();
81
82
        if (key != null) {            
83
            final List<Locale> localesList = new ArrayList<Locale> ();
84
            for(Locale locale : Locale.getAvailableLocales()) {
85
                localesList.add(locale);
86
            }
87
            localesList.add(new Locale(StringUtils.EMPTY_STRING));
88
            for (Locale loc : localesList) {
89
                try {
90
                    final String bundleName = getClass().getPackage().getName() + ResourceUtils.BUNDLE_FILE_SUFFIX;
91
                    ResourceBundle bundle = ResourceBundle.getBundle(bundleName, loc, getClass().getClassLoader());
92
                    if (bundle.getLocale().equals(loc)) {
93
                        final String message = bundle.getString(key);
94
                        if (message != null) {
95
                            helpMessageMap.put(loc, message);
96
                        }
97
                    }
98
                } catch (MissingResourceException e) {
99
                }
100
            }         
101
        }
102
        return helpMessageMap;
103
    }
104
105
    public String getHelpKey() {
106
        return BUNDLE_KEY_PREFIX + getClass().getSimpleName().toLowerCase(Locale.ENGLISH).replaceAll("option$","");
63
    }
107
    }
64
108
65
    public void validateOptions(CLIArgumentsList arguments) throws CLIOptionException {
109
    public void validateOptions(CLIArgumentsList arguments) throws CLIOptionException {
(-)a/nbi/engine/src/org/netbeans/installer/utils/cli/options/Bundle.properties (+19 lines)
Lines 51-53 Link Here
51
O.warning.bad.registry.arg=Required parameter missing for command line argument "{0}".\nShould be "{0} <remote-registry-url>".
51
O.warning.bad.registry.arg=Required parameter missing for command line argument "{0}".\nShould be "{0} <remote-registry-url>".
52
O.warning.bad.properties.arg=Required parameter missing for command line argument "{0}".\nShould be "{0} <properties-file-path>".
52
O.warning.bad.properties.arg=Required parameter missing for command line argument "{0}".\nShould be "{0} <properties-file-path>".
53
O.warning.bad.bundle.properties.arg=Required parameter missing for command line argument "{0}".\nShould be "{0} <bundle-properties-file-path>".
53
O.warning.bad.bundle.properties.arg=Required parameter missing for command line argument "{0}".\nShould be "{0} <bundle-properties-file-path>".
54
55
O.help.lookandfeel=<look-and-feel-class-name>\tUse specific Look&Feel
56
#O.help.target=<target-component-uid> <target-component-version>
57
#O.help.locale=<language>[_<country>[_<variant>]]
58
O.help.state=<state-file>\nUse specified options file together with --silent option
59
#O.help.createbundle=<path-to-bundle.jar>\nCreate new bundle at the specified path
60
#O.help.bundleproperties=<path to bundle properties file>
61
#O.help.properties=<path to properties file>
62
#O.help.platform=<target platform>\nCreate bundle for the specified platform
63
#O.help.registry=<registry URL>
64
O.help.userdir=<path-to-alternative-userdir>
65
#O.help.nospacecheck=Disable free space check
66
#O.help.forceinstall=Force install
67
#O.help.forceuninstall=Force uninstall
68
#O.help.suggestinstall=Suggest install
69
#O.help.suggestuninstall=Suggest uninstall
70
#O.help.silent=Run silently
71
O.help.record=<path-to-target-state-file>\nPath to the file where the parameters would be stored
72
O.help.ignorelock=Ignore lock file existance on starting
(-)a/nbi/engine/src/org/netbeans/installer/utils/system/launchers/LauncherProperties.java (-11 / +26 lines)
Lines 42-49 Link Here
42
import java.io.IOException;
42
import java.io.IOException;
43
import java.io.InputStream;
43
import java.io.InputStream;
44
import java.util.ArrayList;
44
import java.util.ArrayList;
45
import java.util.Enumeration;
45
import java.util.HashMap;
46
import java.util.HashMap;
46
import java.util.List;
47
import java.util.List;
48
import java.util.Locale;
47
import java.util.PropertyResourceBundle;
49
import java.util.PropertyResourceBundle;
48
import org.netbeans.installer.utils.FileUtils;
50
import org.netbeans.installer.utils.FileUtils;
49
import org.netbeans.installer.utils.LogManager;
51
import org.netbeans.installer.utils.LogManager;
Lines 62-68 Link Here
62
    protected List<LauncherResource> jvms;
64
    protected List<LauncherResource> jvms;
63
    protected List <LauncherResource> otherResources;
65
    protected List <LauncherResource> otherResources;
64
    
66
    
65
    protected HashMap <String, PropertyResourceBundle> i18nMap;
67
    private HashMap <Locale, HashMap <String, String>> i18nMap;
66
    protected LauncherResource testJVMFile;
68
    protected LauncherResource testJVMFile;
67
    protected File outputFile;
69
    protected File outputFile;
68
    protected boolean addExtenstion;
70
    protected boolean addExtenstion;
Lines 95-101 Link Here
95
        compatibleJava = new ArrayList <JavaCompatibleProperties> ();
97
        compatibleJava = new ArrayList <JavaCompatibleProperties> ();
96
        jvmArguments = new ArrayList <String>();
98
        jvmArguments = new ArrayList <String>();
97
        appArguments = new ArrayList <String>();
99
        appArguments = new ArrayList <String>();
98
        i18nMap = new HashMap <String, PropertyResourceBundle>();
100
        i18nMap = new HashMap <Locale, HashMap <String,String>>();
99
        jars = new ArrayList <LauncherResource> ();
101
        jars = new ArrayList <LauncherResource> ();
100
        jvms = new ArrayList <LauncherResource> ();
102
        jvms = new ArrayList <LauncherResource> ();
101
        otherResources = new ArrayList<LauncherResource> ();        
103
        otherResources = new ArrayList<LauncherResource> ();        
Lines 202-208 Link Here
202
    public void setTestJVMClass(String testClass) {
204
    public void setTestJVMClass(String testClass) {
203
        this.testJVMClass = testClass;
205
        this.testJVMClass = testClass;
204
    }
206
    }
205
    HashMap <String, PropertyResourceBundle> getI18nMap() {
207
    public HashMap <Locale, HashMap <String,String>> getI18nMap() {
206
        return i18nMap;
208
        return i18nMap;
207
    }
209
    }
208
    
210
    
Lines 224-241 Link Here
224
        return loc;
226
        return loc;
225
    }
227
    }
226
    
228
    
227
    private PropertyResourceBundle getBundle(File file) throws IOException {
229
    private HashMap <String,String> getBundle(File file) throws IOException {
228
        return getBundle(file.getPath(), new FileInputStream(file));
230
        return getBundle(file.getPath(), new FileInputStream(file));
229
    }
231
    }
230
    
232
    
231
    private PropertyResourceBundle getBundle(String dest, InputStream is) throws IOException {
233
    private HashMap <String,String> getBundle(String dest, InputStream is) throws IOException {
232
        if(is==null) {
234
        if(is==null) {
233
            throw new IOException(ResourceUtils.getString(LauncherProperties.class, 
235
            throw new IOException(ResourceUtils.getString(LauncherProperties.class, 
234
                    ERROR_CANNOT_LOAD_BUNDLE_KEY, dest)); //NOI18N
236
                    ERROR_CANNOT_LOAD_BUNDLE_KEY, dest)); //NOI18N
235
        }
237
        }
236
        
238
        
237
        try {
239
        try {
238
            return new PropertyResourceBundle(is);
240
            PropertyResourceBundle bundle = new PropertyResourceBundle(is);
241
            Enumeration <String> en = bundle.getKeys();
242
            HashMap <String, String> map = new HashMap <String, String>();
243
            while(en.hasMoreElements()) {
244
                String key = en.nextElement();
245
                map.put(key, bundle.getString(key));
246
            }
247
            return map;            
239
        } catch (IOException ex) {
248
        } catch (IOException ex) {
240
            throw new IOException(ResourceUtils.getString(LauncherProperties.class, 
249
            throw new IOException(ResourceUtils.getString(LauncherProperties.class, 
241
                    ERROR_CANNOT_LOAD_BUNDLE_KEY, dest)); //NOI18N
250
                    ERROR_CANNOT_LOAD_BUNDLE_KEY, dest)); //NOI18N
Lines 250-259 Link Here
250
    
259
    
251
// resources should be in form of <dir>/<dir>/<dir>/<file>
260
// resources should be in form of <dir>/<dir>/<dir>/<file>
252
    private void loadPropertiesMap(String [] resources) throws IOException {
261
    private void loadPropertiesMap(String [] resources) throws IOException {
253
        i18nMap.clear();
262
        clearI18NMap();
254
        for(String resource: resources) {
263
        for(String resource: resources) {
255
            String loc = getLocaleName(ResourceUtils.getResourceFileName(resource));
264
            String loc = getLocaleName(ResourceUtils.getResourceFileName(resource));            
256
            i18nMap.put(loc, getBundle(resource, ResourceUtils.getResource(resource)));
265
            i18nMap.put(StringUtils.parseLocale(loc), getBundle(resource, ResourceUtils.getResource(resource)));
257
        }
266
        }
258
    }
267
    }
259
    private void loadPropertiesMap(List<String> resources) throws IOException {
268
    private void loadPropertiesMap(List<String> resources) throws IOException {
Lines 287-298 Link Here
287
        return files;
296
        return files;
288
    }
297
    }
289
    
298
    
299
    private void clearI18NMap() {
300
        for(Locale locale : i18nMap.keySet()) {
301
            i18nMap.get(locale).clear();
302
        }
303
        i18nMap.clear();
304
    }
290
    private void loadPropertiesMap(File [] files) throws IOException {
305
    private void loadPropertiesMap(File [] files) throws IOException {
291
        i18nMap.clear();
306
        clearI18NMap();
292
        for(File f: files) {
307
        for(File f: files) {
293
            String loc = getLocaleName(f.getName());
308
            String loc = getLocaleName(f.getName());
294
            LogManager.log("Adding bundle with locale [" + loc + "] using file " + f);
309
            LogManager.log("Adding bundle with locale [" + loc + "] using file " + f);
295
            i18nMap.put(loc,getBundle(f));
310
            i18nMap.put(StringUtils.parseLocale(loc),getBundle(f));
296
        }
311
        }
297
    }
312
    }
298
    private static final String ERROR_CANNOT_LOAD_BUNDLE_KEY = 
313
    private static final String ERROR_CANNOT_LOAD_BUNDLE_KEY = 
(-)a/nbi/engine/src/org/netbeans/installer/utils/system/launchers/impl/CommonLauncher.java (-1 / +52 lines)
Lines 44-50 Link Here
44
import java.io.InputStream;
44
import java.io.InputStream;
45
import java.util.ArrayList;
45
import java.util.ArrayList;
46
import java.util.Enumeration;
46
import java.util.Enumeration;
47
import java.util.HashMap;
48
import java.util.HashSet;
47
import java.util.List;
49
import java.util.List;
50
import java.util.Locale;
51
import java.util.Map;
52
import java.util.Set;
48
import java.util.jar.Attributes;
53
import java.util.jar.Attributes;
49
import java.util.jar.JarEntry;
54
import java.util.jar.JarEntry;
50
import java.util.jar.JarFile;
55
import java.util.jar.JarFile;
Lines 55-60 Link Here
55
import org.netbeans.installer.utils.StreamUtils;
60
import org.netbeans.installer.utils.StreamUtils;
56
import org.netbeans.installer.utils.StringUtils;
61
import org.netbeans.installer.utils.StringUtils;
57
import org.netbeans.installer.utils.applications.JavaUtils;
62
import org.netbeans.installer.utils.applications.JavaUtils;
63
import org.netbeans.installer.utils.cli.CLIHandler;
64
import org.netbeans.installer.utils.cli.CLIOption;
58
import org.netbeans.installer.utils.helper.EngineResources;
65
import org.netbeans.installer.utils.helper.EngineResources;
59
import org.netbeans.installer.utils.helper.ErrorLevel;
66
import org.netbeans.installer.utils.helper.ErrorLevel;
60
import org.netbeans.installer.utils.helper.JavaCompatibleProperties;
67
import org.netbeans.installer.utils.helper.JavaCompatibleProperties;
Lines 70-75 Link Here
70
 */
77
 */
71
public abstract class CommonLauncher extends Launcher {
78
public abstract class CommonLauncher extends Launcher {
72
    private static final int BUF_SIZE = 102400;
79
    private static final int BUF_SIZE = 102400;
80
    
81
    protected static final String ENGINE_OPTION_PREFIX = "engine.option.message.";
73
    
82
    
74
    protected CommonLauncher(LauncherProperties pr) {
83
    protected CommonLauncher(LauncherProperties pr) {
75
        super(pr);
84
        super(pr);
Lines 132-137 Link Here
132
        return addString(fos, builder.toString() , isUnicode);
141
        return addString(fos, builder.toString() , isUnicode);
133
    }
142
    }
134
    
143
    
144
    protected List <CLIOption> getEngineHelpOptions() {
145
        List <CLIOption> optionsWithHelp = new ArrayList <CLIOption>();
146
        
147
        for(CLIOption option : CLIHandler.getAvailableOptions()) {
148
            if(!option.getHelpMessages().isEmpty()) {
149
                optionsWithHelp.add(option);
150
            }
151
        }
152
        return optionsWithHelp;
153
    }
154
    
155
    abstract protected String getEngineOptionStringFormatted(String message);
156
    
157
    protected HashMap<Locale, HashMap<String, String>> getFullI18nMap() {
158
        HashMap<Locale, HashMap<String, String>> fullMap = new HashMap<Locale, HashMap<String, String>>();
159
        Set<Locale> availableLocales = new HashSet<Locale>();
160
        availableLocales.addAll(getI18nMap().keySet());
161
        for (CLIOption option : getEngineHelpOptions()) {
162
            availableLocales.addAll(option.getHelpMessages().keySet());
163
        }
164
165
        for (Locale locale : availableLocales) {            
166
            HashMap<String, String> newMap = new HashMap<String, String>();
167
            
168
            HashMap<String, String> locmap = getI18nMap().get(locale);
169
            if (locmap != null) { // if launcher strings exist for this locale
170
                for (String key : locmap.keySet()) {
171
                    if (locmap.get(key) != null) {
172
                        newMap.put(key, locmap.get(key));
173
                    }
174
                }
175
            }
176
            for (CLIOption option : getEngineHelpOptions()) {
177
                String message = option.getHelpMessages().get(locale);
178
                if (message != null) {  // if CLIOption strings exist for this locale
179
                    newMap.put(ENGINE_OPTION_PREFIX + option.getHelpKey(), getEngineOptionStringFormatted(message));
180
                }
181
            }
182
            fullMap.put(locale, newMap);
183
        }
184
        return fullMap;
185
    }
135
    
186
    
136
    protected void checkAllParameters() throws IOException {
187
    protected void checkAllParameters() throws IOException {
137
        checkBundledJars();
188
        checkBundledJars();
Lines 150-156 Link Here
150
        // i18n properties suffix
201
        // i18n properties suffix
151
        LogManager.log(ErrorLevel.DEBUG, "Check i18n...");
202
        LogManager.log(ErrorLevel.DEBUG, "Check i18n...");
152
        String suffix = getI18NResourcePrefix();
203
        String suffix = getI18NResourcePrefix();
153
        if(i18nMap.isEmpty() && suffix!=null) {
204
        if(getI18nMap().isEmpty() && suffix!=null) {
154
            // load from engine`s entries list
205
            // load from engine`s entries list
155
            LogManager.log("... i18n properties were not set. using default from resources");
206
            LogManager.log("... i18n properties were not set. using default from resources");
156
            InputStream is = ResourceUtils.getResource(EngineResources.ENGINE_CONTENTS_LIST);
207
            InputStream is = ResourceUtils.getResource(EngineResources.ENGINE_CONTENTS_LIST);
(-)a/nbi/engine/src/org/netbeans/installer/utils/system/launchers/impl/ExeLauncher.java (-28 / +39 lines)
Lines 43-56 Link Here
43
import java.io.InputStream;
43
import java.io.InputStream;
44
import java.util.ArrayList;
44
import java.util.ArrayList;
45
import java.util.Enumeration;
45
import java.util.Enumeration;
46
import java.util.HashMap;
46
import java.util.LinkedList;
47
import java.util.LinkedList;
47
import java.util.List;
48
import java.util.List;
49
import java.util.Locale;
50
import java.util.Map;
48
import java.util.MissingResourceException;
51
import java.util.MissingResourceException;
49
import java.util.PropertyResourceBundle;
52
import java.util.PropertyResourceBundle;
53
import java.util.Set;
50
import org.netbeans.installer.utils.FileUtils;
54
import org.netbeans.installer.utils.FileUtils;
51
import org.netbeans.installer.utils.LogManager;
55
import org.netbeans.installer.utils.LogManager;
52
import org.netbeans.installer.utils.ResourceUtils;
56
import org.netbeans.installer.utils.ResourceUtils;
53
import org.netbeans.installer.utils.StringUtils;
57
import org.netbeans.installer.utils.StringUtils;
58
import org.netbeans.installer.utils.cli.CLIOption;
54
import org.netbeans.installer.utils.helper.JavaCompatibleProperties;
59
import org.netbeans.installer.utils.helper.JavaCompatibleProperties;
55
import org.netbeans.installer.utils.helper.Version;
60
import org.netbeans.installer.utils.helper.Version;
56
import org.netbeans.installer.utils.system.launchers.LauncherProperties;
61
import org.netbeans.installer.utils.system.launchers.LauncherProperties;
Lines 121-126 Link Here
121
            LogManager.log("Adding i18n..."); //NOI18N
126
            LogManager.log("Adding i18n..."); //NOI18N
122
            addI18NStrings(fos);
127
            addI18NStrings(fos);
123
            
128
            
129
            LogManager.log("Adding engine options help..."); //NOI18N            
130
            addEngineOptionsHelp(fos);
124
            // jvm args
131
            // jvm args
125
            addData(fos,jvmArguments, true);
132
            addData(fos,jvmArguments, true);
126
            LogManager.log("JVM Arguments: " + //NOI18N
133
            LogManager.log("JVM Arguments: " + //NOI18N
Lines 247-285 Link Here
247
            addData(fos); // fill with some chars
254
            addData(fos); // fill with some chars
248
        }
255
        }
249
    }
256
    }
257
258
    @Override
259
    protected String getEngineOptionStringFormatted(String message) {
260
        return "{0}\t" + message;
261
    }
250
    
262
    
251
    private void addI18NStrings(FileOutputStream fos) throws IOException {
263
    private void addI18NStrings(FileOutputStream fos) throws IOException {
252
        addNumber(fos,  i18nMap.size()); // number of locales
264
        HashMap <Locale, HashMap <String, String>> i18nStrings = getFullI18nMap();
265
        addNumber(fos,  i18nStrings.size()); // number of locales
253
        
266
        
254
        PropertyResourceBundle defaultBundle = i18nMap.get("");
267
        HashMap <String,String> defaultBundle = i18nStrings.get(new Locale(StringUtils.EMPTY_STRING));
255
        //properties names
268
        //properties names
256
        List <String> props = new LinkedList <String> ();
269
        List <String> props = new LinkedList <String> ();
257
        Enumeration <String> en = defaultBundle.getKeys();
258
        long numberOfProperties = 0;
259
        while(en.hasMoreElements()) {
260
            en.nextElement();
261
            numberOfProperties++;
262
        }
263
        addNumber(fos,numberOfProperties); // number of properties
264
        
270
        
265
        String propertyName;
271
        addNumber(fos,defaultBundle.keySet().size()); // number of properties
266
        en = defaultBundle.getKeys();
272
        
267
        while(en.hasMoreElements()) {
273
        for(String propertyName : defaultBundle.keySet()) {            
268
            propertyName = en.nextElement();
269
            props.add(propertyName);
274
            props.add(propertyName);
270
            addData(fos, propertyName, false); // save property name as ascii
275
            addData(fos, propertyName, false); // save property name as ascii
271
        }
276
        }
272
        
277
        
278
        addData(fos, defaultBundle, null, new Locale(StringUtils.EMPTY_STRING), props);
279
        i18nStrings.remove(new Locale(StringUtils.EMPTY_STRING));
280
        Locale [] locales = i18nStrings.keySet().toArray(new Locale[] {});
273
        
281
        
274
        addData(fos, defaultBundle, null, StringUtils.EMPTY_STRING, props);
282
        for(Locale locale : locales) {
275
        i18nMap.remove(StringUtils.EMPTY_STRING);
283
            addData(fos,i18nStrings.get(locale), defaultBundle, locale, props);
276
        Object [] locales = i18nMap.keySet().toArray();
277
        
278
        for(int i=0;i<locales.length;i++) {
279
            addData(fos,i18nMap.get(locales[i]), defaultBundle,(String) locales[i], props);
280
        }
284
        }
281
    }
285
    }
282
    
286
    private void addEngineOptionsHelp(FileOutputStream fos) throws IOException {        
287
        List <CLIOption> list = getEngineHelpOptions();
288
        addNumber(fos, list.size()); //NOI18N            
289
        for(CLIOption option : list){        
290
            addData(fos, option.getName(), true);                        
291
            addData(fos, ENGINE_OPTION_PREFIX +  option.getHelpKey(), false);
292
        }
293
    }
283
    private void addJavaCompatibleProperties(FileOutputStream fos) throws IOException {
294
    private void addJavaCompatibleProperties(FileOutputStream fos) throws IOException {
284
        LogManager.log("Total compatible java properties : " + compatibleJava.size()); //NOI18N
295
        LogManager.log("Total compatible java properties : " + compatibleJava.size()); //NOI18N
285
        LogManager.indent();
296
        LogManager.indent();
Lines 374-391 Link Here
374
        }
385
        }
375
    }
386
    }
376
    
387
    
377
    private void addData(FileOutputStream fos, PropertyResourceBundle bundle, PropertyResourceBundle backupBundle, String localeName, List <String> propertiesNames) throws IOException {
388
    private void addData(FileOutputStream fos, HashMap <String, String> bundle, HashMap <String, String> backupBundle, Locale localeName, List <String> propertiesNames) throws IOException {
378
        String propertyName;
389
        addData(fos, localeName.toString(), true);
379
        String localizedString;
390
        for(String key : propertiesNames) {
380
        addData(fos, localeName, true);
381
        Enumeration <String> en = bundle.getKeys();
382
        for(int i=0;i<propertiesNames.size();i++) {
383
            String str = null;
391
            String str = null;
384
            try {
392
            try {
385
                str = bundle.getString(propertiesNames.get(i));
393
                str = bundle.get(key);
394
                if(str==null) {
395
                    str = backupBundle.get(key);
396
                }
386
            } catch (MissingResourceException e) {
397
            } catch (MissingResourceException e) {
387
                if(backupBundle!=null) {
398
                if(backupBundle!=null) {
388
                    str = backupBundle.getString(propertiesNames.get(i));
399
                    str = backupBundle.get(key);
389
                }
400
                }
390
            }
401
            }
391
            str = changeJavaPropertyCounter(str);
402
            str = changeJavaPropertyCounter(str);
(-)a/nbi/engine/src/org/netbeans/installer/utils/system/launchers/impl/JarLauncher.java (+5 lines)
Lines 111-116 Link Here
111
    protected String getI18NResourcePrefix() {
111
    protected String getI18NResourcePrefix() {
112
        return null;
112
        return null;
113
    }
113
    }
114
115
    @Override
116
    protected String getEngineOptionStringFormatted(String message) {
117
        return "{0} " + message;
118
    }
114
    
119
    
115
    public String [] getExecutionCommand() {
120
    public String [] getExecutionCommand() {
116
        File javaLocation = null;
121
        File javaLocation = null;
(-)a/nbi/engine/src/org/netbeans/installer/utils/system/launchers/impl/ShLauncher.java (-9 / +40 lines)
Lines 44-56 Link Here
44
import java.io.UnsupportedEncodingException;
44
import java.io.UnsupportedEncodingException;
45
import java.util.ArrayList;
45
import java.util.ArrayList;
46
import java.util.Enumeration;
46
import java.util.Enumeration;
47
import java.util.HashMap;
47
import java.util.List;
48
import java.util.List;
49
import java.util.Locale;
50
import java.util.Map;
48
import java.util.PropertyResourceBundle;
51
import java.util.PropertyResourceBundle;
52
import java.util.Set;
49
import org.netbeans.installer.utils.FileUtils;
53
import org.netbeans.installer.utils.FileUtils;
50
import org.netbeans.installer.utils.LogManager;
54
import org.netbeans.installer.utils.LogManager;
51
import org.netbeans.installer.utils.ResourceUtils;
55
import org.netbeans.installer.utils.ResourceUtils;
52
import org.netbeans.installer.utils.StreamUtils;
56
import org.netbeans.installer.utils.StreamUtils;
53
import org.netbeans.installer.utils.StringUtils;
57
import org.netbeans.installer.utils.StringUtils;
58
import org.netbeans.installer.utils.cli.CLIOption;
54
import org.netbeans.installer.utils.helper.JavaCompatibleProperties;
59
import org.netbeans.installer.utils.helper.JavaCompatibleProperties;
55
import org.netbeans.installer.utils.helper.Version;
60
import org.netbeans.installer.utils.helper.Version;
56
import org.netbeans.installer.utils.system.launchers.LauncherProperties;
61
import org.netbeans.installer.utils.system.launchers.LauncherProperties;
Lines 145-150 Link Here
145
            addShInitialComment(sb);
150
            addShInitialComment(sb);
146
            addPossibleJavaLocations(sb);
151
            addPossibleJavaLocations(sb);
147
            addI18NStrings(sb);
152
            addI18NStrings(sb);
153
            addEngineOptionsHelp(sb);
148
            addTestJVMFile(sb);
154
            addTestJVMFile(sb);
149
            addClasspathJars(sb);
155
            addClasspathJars(sb);
150
            addJavaCompatible(sb);
156
            addJavaCompatible(sb);
Lines 449-455 Link Here
449
    }
455
    }
450
    
456
    
451
    private void addI18NStrings(StringBuilder sb) throws IOException {
457
    private void addI18NStrings(StringBuilder sb) throws IOException {
452
        Object [] locales = i18nMap.keySet().toArray();
458
        HashMap <Locale, HashMap <String, String>> i18nStrings = getFullI18nMap();
459
        Locale [] locales = i18nStrings.keySet().toArray(new Locale [] {});
453
        addNumberVariable(sb,"LAUNCHER_LOCALES_NUMBER",locales.length); //NOI18N
460
        addNumberVariable(sb,"LAUNCHER_LOCALES_NUMBER",locales.length); //NOI18N
454
        
461
        
455
        for(int i=0;i<locales.length;i++) {
462
        for(int i=0;i<locales.length;i++) {
Lines 459-478 Link Here
459
        
466
        
460
        nextLine(sb);
467
        nextLine(sb);
461
        
468
        
462
        for(int i=0;i<locales.length;i++) {
469
        Set <String> allKeys = i18nStrings.get(new Locale("")).keySet();
463
            String locale = locales[i].toString();
470
        for(Locale locale : locales) {            
464
            sb.append("getLocalizedMessage_" + locale + "() {" + SH_LINE_SEPARATOR );
471
            sb.append("getLocalizedMessage_" + locale + "() {" + SH_LINE_SEPARATOR );
465
            sb.append(SH_INDENT + "arg=$1" + SH_LINE_SEPARATOR );
472
            sb.append(SH_INDENT + "arg=$1" + SH_LINE_SEPARATOR );
466
            sb.append(SH_INDENT + "shift" + SH_LINE_SEPARATOR );
473
            sb.append(SH_INDENT + "shift" + SH_LINE_SEPARATOR );
467
            sb.append(SH_INDENT + "case $arg in" + SH_LINE_SEPARATOR );
474
            sb.append(SH_INDENT + "case $arg in" + SH_LINE_SEPARATOR );
468
            PropertyResourceBundle rb = i18nMap.get(locales[i]);
475
            HashMap <String, String> rb = i18nStrings.get(locale);
469
            Enumeration <String>en = rb.getKeys();
476
            HashMap <String, String> defaultBundle = i18nStrings.get(new Locale(""));
470
            while(en.hasMoreElements()) {
477
            
471
                String name  = en.nextElement();
478
            for(String name : allKeys){
472
                String value =  rb.getString(name);
479
                String value =  rb.get(name);
480
                if(value==null) {
481
                    value = defaultBundle.get(name);
482
                }
483
                
473
                sb.append(SH_INDENT + "\"" + name + "\")" + SH_LINE_SEPARATOR);
484
                sb.append(SH_INDENT + "\"" + name + "\")" + SH_LINE_SEPARATOR);
474
                String printString = value;
485
                String printString = value;
475
                if(locale==null || locale.equals("")) {
486
                if(locale==null || locale.equals(new Locale(""))) {
476
                    printString = escapeChars(changePropertyCounterStyle(printString));
487
                    printString = escapeChars(changePropertyCounterStyle(printString));
477
                } else {
488
                } else {
478
                    printString = getUTF8(printString, true);
489
                    printString = getUTF8(printString, true);
Lines 489-494 Link Here
489
            nextLine(sb);
500
            nextLine(sb);
490
        }
501
        }
491
        
502
        
503
    }
504
505
    @Override
506
    protected String getEngineOptionStringFormatted(String message) {
507
        return "\t{0}\t" + message;
508
    }
509
    
510
    private void addEngineOptionsHelp(StringBuilder sb) throws IOException {
511
        nextLine(sb);
512
        List <CLIOption> list = getEngineHelpOptions();
513
        addNumberVariable(sb, "HELP_MORE_OPTIONS_NUMBER", list.size()); //NOI18N
514
            int counter = 0;
515
        for(CLIOption option : list){        
516
            addStringVariable(sb, "HELP_MORE_OPTION_" + counter + "_NAME", 
517
                    ENGINE_OPTION_PREFIX +  option.getHelpKey());            
518
            addStringVariable(sb, "HELP_MORE_OPTION_" + counter + "_ARG", 
519
                    option.getName());            
520
            counter++;
521
        }        
522
        nextLine(sb);
492
    }
523
    }
493
    private void addShInitialComment(StringBuilder sb) throws IOException {
524
    private void addShInitialComment(StringBuilder sb) throws IOException {
494
        nextLine(sb);
525
        nextLine(sb);

Return to bug 147715