Main Page   File List   Globals  

changeconfigurationdialog.c File Reference

#include <windows.h>
#include <windowsx.h>
#include "changeConfigurationDialog.h"
#include <assert.h>
#include "persistent.h"
#include "eclipselauncherres.h"
#include "utils.h"
#include "resource.h"

Go to the source code of this file.

Defines

#define strict
#define HANDLE_SETECLIPSEJAVAVM(hwndDlg, newConfiguration, message, controlId)
#define HANDLE_SETECLIPSEEXECUTABLE(hwndDlg, newConfiguration, message, controlId)
#define HANDLE_SETECLIPSEWORKSPACEPATH(hwndDlg, message)
#define HANDLE_CANCEL_BUTTON(hwndDlg)
#define HANDLE_ID_CONFIGNAME(hwndDlg, wParam)

Functions

void addNewConfigurationToListbox (HWND hDialog, HWND hListBox, LPLAUNCHERCONFIG launcherConfig, int currentPosition)
void setEclipseWorkspacePath (HWND hDialog)
void setPath (HWND hDialog, BOOL newConfiguration, int controlId)
void setMaxTextLengthOfAllEditFields (HWND hDialog)
LRESULT HandleAddConfigurationDialogProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
LRESULT HandleEditConfigurationDialogProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
void disposeAllConfigurations (HWND hListBox)


Define Documentation

#define HANDLE_CANCEL_BUTTON hwndDlg   
 

Value:

case IDCANCEL: \
                {   EndDialog(hwndDlg,0); return 1; }

Definition at line 36 of file changeconfigurationdialog.c.

Referenced by HandleAddConfigurationDialogProc(), and HandleEditConfigurationDialogProc().

#define HANDLE_ID_CONFIGNAME hwndDlg,
wParam   
 

Value:

case ID_CONFIGNAME: \
                { \
                    switch(HIWORD(wParam)) \
                    { \
                        case EN_CHANGE: \
                        { \
                            EnableWindow(GetDlgItem(hwndDlg, IDOK), Edit_LineLength(GetDlgItem(hwndDlg, ID_CONFIGNAME) ,0)); \
                        } \
                        break; \
                    } \
                } \

Definition at line 40 of file changeconfigurationdialog.c.

Referenced by HandleAddConfigurationDialogProc(), and HandleEditConfigurationDialogProc().

#define HANDLE_SETECLIPSEEXECUTABLE hwndDlg,
newConfiguration,
message,
controlId   
 

Value:

case (message): \
                {   setPath(hwndDlg, (BOOL) newConfiguration, controlId); } break;

Definition at line 28 of file changeconfigurationdialog.c.

Referenced by HandleAddConfigurationDialogProc(), and HandleEditConfigurationDialogProc().

#define HANDLE_SETECLIPSEJAVAVM hwndDlg,
newConfiguration,
message,
controlId   
 

Value:

case (message): \
                {   setPath(hwndDlg, (BOOL) newConfiguration, controlId); } break;

Definition at line 24 of file changeconfigurationdialog.c.

Referenced by HandleAddConfigurationDialogProc(), and HandleEditConfigurationDialogProc().

#define HANDLE_SETECLIPSEWORKSPACEPATH hwndDlg,
message   
 

Value:

case (message): \
                {   setEclipseWorkspacePath(hwndDlg); } break;

Definition at line 32 of file changeconfigurationdialog.c.

Referenced by HandleAddConfigurationDialogProc(), and HandleEditConfigurationDialogProc().

#define strict
 

Definition at line 11 of file changeconfigurationdialog.c.


Function Documentation

void addNewConfigurationToListbox HWND    hDialog,
HWND    hListBox,
LPLAUNCHERCONFIG    launcherConfig,
int    currentPosition
 

Definition at line 53 of file changeconfigurationdialog.c.

References addLauchnerConfigToList(), createLauncherConfig(), getExecutablePath(), getJavaVM(), getName(), getOptionalParameter(), getVMParameter(), getWorkspacePath(), and updateLauchnerConfig().

Referenced by HandleAddConfigurationDialogProc(), HandleEditConfigurationDialogProc(), and setPath().

00054 {
00055     LPLAUNCHERCONFIG tempConfig = launcherConfig;
00056     BOOL newConfig = (tempConfig == NULL);
00057 
00058     if(newConfig)
00059     {
00060         tempConfig = createLauncherConfig();
00061     }
00062 
00063     GetDlgItemText(hDialog, ID_CONFIGNAME, getName(tempConfig), MAX_STRING_LENGTH);
00064     GetDlgItemText(hDialog, ID_PATHTOECLIPSE, getExecutablePath(tempConfig), MAX_STRING_LENGTH);
00065     GetDlgItemText(hDialog, ID_OPTIONALPARAMS, getOptionalParameter(tempConfig), MAX_STRING_LENGTH);
00066     GetDlgItemText(hDialog, ID_WORKSPACEPATH, getWorkspacePath(tempConfig), MAX_STRING_LENGTH);
00067     GetDlgItemText(hDialog, ID_VMPARAMETER, getVMParameter(tempConfig), MAX_STRING_LENGTH);
00068     GetDlgItemText(hDialog, ID_ECLIPSEJAVAVM, getJavaVM(tempConfig), MAX_STRING_LENGTH);
00069 
00070     if(newConfig)
00071     {
00072         addLauchnerConfigToList(hListBox, tempConfig, NEW_POSITION);
00073     }
00074     else
00075     {
00076         updateLauchnerConfig(hListBox, tempConfig, currentPosition);
00077     }
00078 }

void disposeAllConfigurations HWND    hListBox
 

Dispose all LauncherConfigurations from the Listbox.

Parameters:
hListBox  Windowhandle for the Listbox containing the LaunchConfigurations.

Definition at line 241 of file changeconfigurationdialog.c.

References getConfigurationCount(), getLauncherConfig(), and releaseLauncherConfig().

Referenced by OnExitApp().

00242 {
00243     int configurations = getConfigurationCount(hListBox);
00244 
00245     if(configurations > 0)
00246     {
00247         int i;
00248 
00249         for(i = 0; i < configurations; i++)
00250         {
00251             LPLAUNCHERCONFIG launcherconfig = getLauncherConfig(hListBox, i);
00252 
00253             releaseLauncherConfig(launcherconfig);
00254         }
00255     }
00256 }

LRESULT HandleAddConfigurationDialogProc HWND    hwndDlg,
UINT    msg,
WPARAM    wParam,
LPARAM    lParam
 

Definition at line 127 of file changeconfigurationdialog.c.

References addNewConfigurationToListbox(), HANDLE_CANCEL_BUTTON, HANDLE_ID_CONFIGNAME, HANDLE_SETECLIPSEEXECUTABLE, HANDLE_SETECLIPSEJAVAVM, HANDLE_SETECLIPSEWORKSPACEPATH, saveConfiguration(), and setMaxTextLengthOfAllEditFields().

Referenced by OnAddNewConfiguration().

00128 {
00129     switch (msg)
00130     {
00131         case WM_INITDIALOG:
00132         {
00133             SetWindowLong(hwndDlg, GWL_USERDATA, lParam); // store Handle of Listbox
00134             EnableWindow(GetDlgItem(hwndDlg, IDOK), FALSE);
00135 
00136             setMaxTextLengthOfAllEditFields(hwndDlg);
00137         }
00138         return 1;
00139 
00140         case WM_COMMAND:
00141         {
00142             switch (LOWORD(wParam))
00143             {
00144                 case IDOK:
00145                 {
00146                     HWND hListBox = (HWND)HIWORD(GetWindowLong(hwndDlg, GWL_USERDATA));
00147 
00148                     addNewConfigurationToListbox(hwndDlg, hListBox, NULL, (-1)); // append to List
00149                     saveConfiguration(hListBox);
00150 
00151                     EndDialog(hwndDlg,1);
00152                     return 1;
00153                 }
00154 
00155                 HANDLE_CANCEL_BUTTON(hwndDlg);
00156                 HANDLE_SETECLIPSEWORKSPACEPATH(hwndDlg, ID_SETWORKSPACEPATH);
00157                 HANDLE_SETECLIPSEEXECUTABLE(hwndDlg, TRUE, ID_SELECTEXECUTABLE, ID_PATHTOECLIPSE);
00158                 HANDLE_SETECLIPSEJAVAVM(hwndDlg, TRUE, ID_SETECLIPSEJAVAVM, ID_ECLIPSEJAVAVM);
00159                 HANDLE_ID_CONFIGNAME(hwndDlg, wParam);
00160             }
00161             break;
00162         }
00163 
00164         FORWARD_WM_CLOSE(hwndDlg, EndDialog);
00165     }
00166 
00167     return FALSE;
00168 }

LRESULT HandleEditConfigurationDialogProc HWND    hwndDlg,
UINT    msg,
WPARAM    wParam,
LPARAM    lParam
 

Definition at line 171 of file changeconfigurationdialog.c.

References addNewConfigurationToListbox(), getCurrentSelection(), getExecutablePath(), getJavaVM(), getLauncherConfig(), getName(), getOptionalParameter(), getVMParameter(), getWorkspacePath(), HANDLE_CANCEL_BUTTON, HANDLE_ID_CONFIGNAME, HANDLE_SETECLIPSEEXECUTABLE, HANDLE_SETECLIPSEJAVAVM, HANDLE_SETECLIPSEWORKSPACEPATH, LocString(), saveConfiguration(), and setMaxTextLengthOfAllEditFields().

Referenced by OnEditNewConfiguration().

00172 {
00173     switch (msg)
00174     {
00175         case WM_INITDIALOG:
00176         {
00177             DWORD dialog;
00178             HWND hListBox;
00179             int currentSelection;
00180             LPLAUNCHERCONFIG data;
00181             TCHAR* buffer = (TCHAR*)malloc(128);
00182 
00183             SetWindowText(hwndDlg, LocString(IDS_EDIT_NEW_CONFIGURATION, buffer));
00184             SetWindowLong(hwndDlg, GWL_USERDATA, lParam); // store Handle of Listbox
00185             hListBox = (HWND)HIWORD(lParam);
00186             dialog = (DWORD)LOWORD(lParam);
00187 
00188             currentSelection = getCurrentSelection(hListBox);
00189             data = getLauncherConfig(hListBox, currentSelection);
00190 
00191             SetDlgItemText(hwndDlg, ID_CONFIGNAME, getName(data));
00192             SetDlgItemText(hwndDlg, ID_PATHTOECLIPSE, getExecutablePath(data));
00193             SetDlgItemText(hwndDlg, ID_OPTIONALPARAMS, getOptionalParameter(data));
00194             SetDlgItemText(hwndDlg, ID_WORKSPACEPATH, getWorkspacePath(data));
00195             SetDlgItemText(hwndDlg, ID_VMPARAMETER, getVMParameter(data));
00196             SetDlgItemText(hwndDlg, ID_ECLIPSEJAVAVM, getJavaVM(data));
00197 
00198             setMaxTextLengthOfAllEditFields(hwndDlg);
00199 
00200             free(buffer);
00201         }
00202         return 1;
00203 
00204         case WM_COMMAND:
00205         {
00206             switch (LOWORD(wParam))
00207             {
00208                 case IDOK:
00209                 {
00210                     HWND hListBox = (HWND)HIWORD(GetWindowLong(hwndDlg, GWL_USERDATA));
00211 
00212                     UINT currentSelection = getCurrentSelection(hListBox);
00213                     LPLAUNCHERCONFIG data = getLauncherConfig(hListBox, currentSelection);
00214                     addNewConfigurationToListbox(hwndDlg, hListBox, data, currentSelection);
00215 
00216                     saveConfiguration(hListBox);
00217 
00218                     EndDialog(hwndDlg,1);
00219                     return 1;
00220                 }
00221 
00222                 HANDLE_CANCEL_BUTTON(hwndDlg);
00223                 HANDLE_SETECLIPSEWORKSPACEPATH(hwndDlg, ID_SETWORKSPACEPATH);
00224                 HANDLE_SETECLIPSEEXECUTABLE(hwndDlg, FALSE, ID_SELECTEXECUTABLE, ID_PATHTOECLIPSE);
00225                 HANDLE_SETECLIPSEJAVAVM(hwndDlg, FALSE, ID_SETECLIPSEJAVAVM, ID_ECLIPSEJAVAVM);
00226                 HANDLE_ID_CONFIGNAME(hwndDlg, wParam);
00227             }
00228             break;
00229         }
00230 
00231         FORWARD_WM_CLOSE(hwndDlg, EndDialog);
00232     }
00233 
00234     return FALSE;
00235 }

void setEclipseWorkspacePath HWND    hDialog
 

Definition at line 81 of file changeconfigurationdialog.c.

References GetFolderName().

00082 {
00083     TCHAR* path = (TCHAR*)malloc(MAX_PATH);
00084     ZeroMemory(path, MAX_PATH);
00085     GetFolderName(path);
00086 
00087     SetDlgItemText(hDialog, ID_WORKSPACEPATH, path);
00088 
00089     free(path);
00090 }

void setMaxTextLengthOfAllEditFields HWND    hDialog
 

Set all Editfields in the Dialog to the max. length of MAX_STRING_LENGTH.

Parameters:
hDialog  Windowhandle of the Dialog.

Definition at line 117 of file changeconfigurationdialog.c.

Referenced by HandleAddConfigurationDialogProc(), and HandleEditConfigurationDialogProc().

00118 {
00119     Edit_LimitText(GetDlgItem(hDialog, ID_CONFIGNAME), MAX_STRING_LENGTH);
00120     Edit_LimitText(GetDlgItem(hDialog, ID_PATHTOECLIPSE), MAX_STRING_LENGTH);
00121     Edit_LimitText(GetDlgItem(hDialog, ID_OPTIONALPARAMS), MAX_STRING_LENGTH);
00122     Edit_LimitText(GetDlgItem(hDialog, ID_WORKSPACEPATH), MAX_STRING_LENGTH);
00123     Edit_LimitText(GetDlgItem(hDialog, ID_VMPARAMETER), MAX_STRING_LENGTH);
00124     Edit_LimitText(GetDlgItem(hDialog, ID_ECLIPSEJAVAVM), MAX_STRING_LENGTH);
00125 }

void setPath HWND    hDialog,
BOOL    newConfiguration,
int    controlId
 

Definition at line 92 of file changeconfigurationdialog.c.

References addNewConfigurationToListbox(), createLauncherConfig(), and GetOpenFilename().

00093 {
00094     HWND hListBox;
00095 
00096     TCHAR* path = (TCHAR*)malloc(MAX_PATH);
00097     ZeroMemory(path, MAX_PATH);
00098     GetOpenFilename("*.exe", "", path);
00099 
00100     hListBox = (HWND)HIWORD(GetWindowLong(hDialog, GWL_USERDATA));
00101 
00102     SetDlgItemText(hDialog, controlId, path);
00103 
00104     if(newConfiguration)
00105     {
00106         addNewConfigurationToListbox(hDialog, hListBox, createLauncherConfig(), (-1)); //append to List
00107     }
00108 
00109     free(path);
00110 }


Generated on Sun Apr 6 13:49:03 2003 for EclipseLauncher by doxygen1.2.17