#include <windows.h>#include <windowsx.h>#include <commctrl.h>#include <assert.h>#include "persistent.h"#include "launcherconfig.h"#include "eclipselauncher.h"#include "registryhelper.h"Go to the source code of this file.
Defines | |
| #define | strict |
Functions | |
| TCHAR * | createConfigKey (int configNumber) |
| TCHAR * | createSectionKey (TCHAR *configKey) |
| void | createConfigCountKey (int configurations) |
| void | loadConfiguration (HWND hListbox) |
| void | saveConfiguration (HWND hListbox) |
| int | getConfigurationCount (HWND hListBox) |
| LPLAUNCHERCONFIG | getLauncherConfig (HWND hListBox, int currentSelection) |
| int | getCurrentSelection (HWND hListBox) |
| BOOL | setColumnValues (HWND hListBox, LPLAUNCHERCONFIG launcherConfig, int positionToInsertItem) |
| BOOL | addLauchnerConfigToList (HWND hListBox, LPLAUNCHERCONFIG launcherConfig, int positionToInsertItem) |
| BOOL | updateLauchnerConfig (HWND hListBox, LPLAUNCHERCONFIG launcherConfig, int positionToInsertItem) |
|
|
Definition at line 11 of file persistent.c. |
|
||||||||||||||||
|
Definition at line 228 of file persistent.c. References getName(), and setColumnValues(). Referenced by addNewConfigurationToListbox(), loadConfiguration(), OnDuplicateLaunchConfiguration(), and OnPasteFromClipboard().
00229 {
00230 LV_ITEM item = {0};
00231 int newInsertedPosition;
00232
00233 int newPos = positionToInsertItem;
00234
00235 assert(launcherConfig != NULL);
00236
00237 if(newPos == NEW_POSITION)
00238 {
00239 newPos = ListView_GetItemCount(hListBox);
00240 }
00241
00242 item.mask = LVIF_TEXT | LVIF_PARAM;
00243 item.iItem = newPos;
00244 item.iSubItem = 0;
00245 item.pszText = getName(launcherConfig);
00246 item.lParam = (LPARAM)launcherConfig;
00247
00248 newInsertedPosition = ListView_InsertItem(hListBox, &item);
00249
00250 return setColumnValues(hListBox, launcherConfig, newInsertedPosition);
00251 }
|
|
|
Definition at line 59 of file persistent.c. References CreateKey(). Referenced by saveConfiguration().
00060 {
00061 TCHAR configCount[10] = {0};
00062 wsprintf(configCount, "%d", configurations);
00063
00064 CreateKey(REG_APP_KEY, KEY_CONFIGCOUNT, configCount);
00065 }
|
|
|
Definition at line 31 of file persistent.c. Referenced by loadConfiguration(), and saveConfiguration().
00032 {
00033 TCHAR* name = (TCHAR*) malloc(20);
00034 wsprintf(name, "Config%d", configNumber);
00035
00036 return name;
00037 }
|
|
|
Definition at line 45 of file persistent.c. Referenced by loadConfiguration(), and saveConfiguration().
00046 {
00047 TCHAR* sectionKey = (TCHAR*)malloc(BUFFERSIZE_256);
00048 wsprintf(sectionKey, "%s%s", REG_APP_KEY, configKey);
00049
00050 return sectionKey;
00051 }
|
|
|
Definition at line 160 of file persistent.c. Referenced by disposeAllConfigurations(), MainDialogWindowProc(), and saveConfiguration().
00161 {
00162 return(ListView_GetItemCount(hListBox));
00163 }
|
|
|
Definition at line 188 of file persistent.c. Referenced by HandleEditConfigurationDialogProc(), OnCopyToClipboard(), OnDeleteConfiguration(), and OnDuplicateLaunchConfiguration().
00189 {
00190 return(ListView_GetNextItem(hListBox, (-1), LVNI_SELECTED));
00191 }
|
|
||||||||||||
|
Definition at line 171 of file persistent.c. Referenced by disposeAllConfigurations(), HandleEditConfigurationDialogProc(), hitTestForLauncherConfig(), MainDialogWindowProc(), OnCommandHelper(), OnCopyToClipboard(), OnDeleteConfiguration(), OnDuplicateLaunchConfiguration(), and saveConfiguration().
00172 {
00173 LV_ITEM item = {0};
00174 item.mask = LVIF_PARAM;
00175 item.iItem = currentSelection;
00176
00177 ListView_GetItem(hListBox, &item);
00178
00179 return((LPLAUNCHERCONFIG)item.lParam);
00180 }
|
|
|
Definition at line 73 of file persistent.c. References addLauchnerConfigToList(), createConfigKey(), createLauncherConfig(), createSectionKey(), QueryKey(), setExecutablePath(), setJavaVM(), setName(), setOptionalParameter(), setVMParameter(), and setWorkspacePath(). Referenced by OnInitializeApp().
00074 {
00075 int bufferSize = 10;
00076 int tempBufferSize = BUFFERSIZE_512;
00077 int configurations;
00078 int i = 0;
00079
00080 TCHAR tempBuffer[BUFFERSIZE_512] = {0}; // inited with size of tempBufferSize
00081 TCHAR* config = (TCHAR*)malloc(bufferSize);
00082 ZeroMemory(config, bufferSize);
00083 QueryKey(HKEY_CURRENT_USER, REG_APP_KEY, KEY_CONFIGCOUNT, config, bufferSize);
00084
00085 configurations = atoi(config);
00086
00087 for(i = 0; i < configurations; i++)
00088 {
00089 LPLAUNCHERCONFIG launcherconfig = createLauncherConfig();
00090
00091 TCHAR* name = createConfigKey(i+1);
00092 TCHAR* section = createSectionKey(name);
00093
00094 QueryKey(HKEY_CURRENT_USER, section, KEY_CONFIGNAME, tempBuffer, tempBufferSize);
00095 setName(launcherconfig, tempBuffer, tempBufferSize);
00096
00097 QueryKey(HKEY_CURRENT_USER, section, KEY_EXECUTABLEPATH, tempBuffer, tempBufferSize);
00098 setExecutablePath(launcherconfig, tempBuffer, tempBufferSize);
00099
00100 QueryKey(HKEY_CURRENT_USER, section, KEY_OPTIONALPARAMETER, tempBuffer, tempBufferSize);
00101 setOptionalParameter(launcherconfig, tempBuffer, tempBufferSize);
00102
00103 QueryKey(HKEY_CURRENT_USER, section, KEY_WORKSPACEPATH, tempBuffer, tempBufferSize);
00104 setWorkspacePath(launcherconfig, tempBuffer, tempBufferSize);
00105
00106 QueryKey(HKEY_CURRENT_USER, section, KEY_VMPARAMETER, tempBuffer, tempBufferSize);
00107 setVMParameter(launcherconfig, tempBuffer, tempBufferSize);
00108
00109 QueryKey(HKEY_CURRENT_USER, section, KEY_ECLIPSEJAVAVM, tempBuffer, tempBufferSize);
00110 setJavaVM(launcherconfig, tempBuffer, tempBufferSize);
00111
00112 addLauchnerConfigToList(hListbox, launcherconfig, NEW_POSITION);
00113
00114 free(name);
00115 free(section);
00116 }
00117 }
|
|
|
Definition at line 125 of file persistent.c. References createConfigCountKey(), createConfigKey(), CreateKey(), createSectionKey(), getConfigurationCount(), getExecutablePath(), getJavaVM(), getLauncherConfig(), getName(), getOptionalParameter(), getVMParameter(), and getWorkspacePath(). Referenced by HandleAddConfigurationDialogProc(), HandleEditConfigurationDialogProc(), MainDialogWindowProc(), OnDeleteConfiguration(), OnDuplicateLaunchConfiguration(), and OnPasteFromClipboard().
00126 {
00127 int configurations = getConfigurationCount(hListbox);
00128
00129 if(configurations > 0)
00130 {
00131 int i;
00132 createConfigCountKey(configurations);
00133
00134 for(i = 0; i < configurations; i++)
00135 {
00136 LPLAUNCHERCONFIG launcherconfig = getLauncherConfig(hListbox, i);
00137
00138 TCHAR* name = createConfigKey(i+1);
00139 TCHAR* section = createSectionKey(name);
00140
00141 CreateKey(section, KEY_CONFIGNAME, getName(launcherconfig));
00142 CreateKey(section, KEY_EXECUTABLEPATH, getExecutablePath(launcherconfig));
00143 CreateKey(section, KEY_OPTIONALPARAMETER, getOptionalParameter(launcherconfig));
00144 CreateKey(section, KEY_WORKSPACEPATH, getWorkspacePath(launcherconfig));
00145 CreateKey(section, KEY_VMPARAMETER, getVMParameter(launcherconfig));
00146 CreateKey(section, KEY_ECLIPSEJAVAVM, getJavaVM(launcherconfig));
00147
00148 free(name);
00149 free(section);
00150 }
00151 }
00152 }
|
|
||||||||||||||||
|
Set the Values for the Columns in the ListBox.
Definition at line 200 of file persistent.c. References getJavaVM(), getVMParameter(), and getWorkspacePath(). Referenced by addLauchnerConfigToList(), and updateLauchnerConfig().
00201 {
00202 LV_ITEM item = {0};
00203
00204 item.mask = LVIF_TEXT;
00205 item.iItem = positionToInsertItem;
00206 item.iSubItem = 1;
00207 item.pszText = getWorkspacePath(launcherConfig);
00208
00209 ListView_SetItem(hListBox, &item);
00210
00211 item.iSubItem = 2;
00212 item.pszText = getJavaVM(launcherConfig);
00213
00214 ListView_SetItem(hListBox, &item);
00215
00216 item.iSubItem = 3;
00217 item.pszText = getVMParameter(launcherConfig);
00218
00219 return ListView_SetItem(hListBox, &item);
00220 }
|
|
||||||||||||||||
|
Definition at line 259 of file persistent.c. References getName(), and setColumnValues(). Referenced by addNewConfigurationToListbox(), and MainDialogWindowProc().
00260 {
00261 LV_ITEM item = {0};
00262
00263 assert(launcherConfig != NULL);
00264
00265 item.mask = LVIF_TEXT | LVIF_PARAM;
00266 item.iItem = positionToInsertItem;
00267 item.iSubItem = 0;
00268 item.pszText = getName(launcherConfig);
00269 item.lParam = (LPARAM)launcherConfig;
00270
00271 ListView_SetItem(hListBox, &item);
00272
00273 setColumnValues(hListBox, launcherConfig, positionToInsertItem);
00274
00275 return(ListView_Update(hListBox, positionToInsertItem));
00276 }
|
1.2.17