Main Page   File List   Globals  

utils.c File Reference

#include <windows.h>
#include <shlobj.h>
#include "utils.h"

Go to the source code of this file.

Defines

#define strict

Functions

int GetOpenFilename (TCHAR *MatchType, TCHAR *MatchFile, TCHAR *fileName)
void GetFolderName (TCHAR *fileName)
BOOL lockfileIsDeleteable (TCHAR *pathToWorkspace)
TCHAR * LocString (int messageId, TCHAR *buffer)
HINSTANCE getApplicationInstance ()


Define Documentation

#define strict
 

Definition at line 11 of file utils.c.


Function Documentation

HINSTANCE getApplicationInstance  
 

Definition at line 128 of file utils.c.

Referenced by LocString(), OnAddNewConfiguration(), OnEditNewConfiguration(), and setUpTrayIcon().

00129 {
00130     return GetModuleHandle(NULL);
00131 }

void GetFolderName TCHAR *    fileName
 

Definition at line 68 of file utils.c.

Referenced by setEclipseWorkspacePath().

00069 {
00070     TCHAR path[MAX_PATH];
00071     LPITEMIDLIST pidl;
00072 
00073     BROWSEINFO bi = { 0 };
00074     bi.lpszTitle = "Select your Workspace";
00075     bi.pszDisplayName = path;
00076     bi.ulFlags = BIF_RETURNONLYFSDIRS;
00077 
00078     pidl = SHBrowseForFolder ( &bi );
00079     if ( pidl != 0 )
00080     {
00081         TCHAR szDir[MAX_PATH];
00082         if( SHGetPathFromIDList( pidl, szDir ) )
00083         {
00084             strcpy(fileName, szDir);
00085         }
00086     }
00087 }

int GetOpenFilename TCHAR *    MatchType,
TCHAR *    MatchFile,
TCHAR *    fileName
 

Definition at line 24 of file utils.c.

Referenced by setPath().

00025 {
00026    OPENFILENAME fn;
00027    register int i;
00028    char Filter[128];
00029    TCHAR DefaultFile[512];
00030 
00031    // construct file name filter string
00032    lstrcpy(Filter, MatchType);
00033    i = lstrlen(Filter) + 1;
00034    lstrcpy(&Filter[i],MatchFile);
00035    i += lstrlen(&Filter[i]) + 1;
00036    Filter[i] = '\0';
00037 
00038    // fill in structure fields for Open File dialog box
00039    fn.lStructSize       = sizeof(OPENFILENAME);
00040    fn.hwndOwner         = GetActiveWindow();
00041    fn.lpstrFilter       = Filter;
00042    fn.lpstrCustomFilter = NULL;
00043    fn.nFilterIndex      = 0;
00044    fn.lpstrFile         = NULL;
00045    fn.lpstrFile         = DefaultFile;
00046    fn.nMaxFile          = sizeof(DefaultFile);
00047    fn.lpstrFileTitle    = NULL;
00048    fn.lpstrInitialDir   = NULL;
00049    fn.lpstrTitle        = NULL;
00050    fn.Flags             = OFN_READONLY;
00051    fn.lpstrDefExt       = &MatchFile[2];
00052    *DefaultFile = '\0';
00053 
00054    // activate the Open File dialog box
00055    if (GetOpenFileName(&fn))
00056    {
00057       lstrcpy(fileName, DefaultFile);
00058       return TRUE;
00059    }
00060    else
00061       return FALSE;
00062 }

BOOL lockfileIsDeleteable TCHAR *    pathToWorkspace
 

Check if the Eclipse Lockfile at the given Path is deleteable. If yes, then Eclipse is currently not running. Otherwise Eclipse is still running. The argument is extended by "\.metadata\.lock" to get the full path to the Lockfile.

Parameters:
pathToWorkspace 
Returns :
TRUE Eclipse isn't running, else FALSE.

Definition at line 98 of file utils.c.

Referenced by MainDialogWindowProc().

00099 {
00100     TCHAR path[MAX_PATH];
00101 
00102     wsprintf(path, "%s\\.metadata\\.lock", pathToWorkspace);
00103     if(DeleteFile(path))
00104     {
00105         return FALSE;
00106     }
00107     else
00108     {
00109         return TRUE;
00110     }
00111 }

TCHAR* LocString int    messageId,
TCHAR *    buffer
 

Definition at line 118 of file utils.c.

References getApplicationInstance().

Referenced by executeLaunchConfiguration(), HandleEditConfigurationDialogProc(), OnCommandHelper(), OnDeleteConfiguration(), OnDuplicateLaunchConfiguration(), OnInitializeApp(), OnRightButtonDown(), setUpTrayIcon(), and WinMain().

00119 {
00120     LoadString(getApplicationInstance(), messageId, buffer, STRINGBUFFER_SIZE);
00121 
00122     return(buffer);
00123 }


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