forked from eranif/codelite
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WebTools: added jsctags
- Loading branch information
Eran Ifrah
committed
Mar 1, 2017
1 parent
b13243a
commit dce172c
Showing
12 changed files
with
114 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
#include "clJSCTags.h" | ||
#include "event_notifier.h" | ||
#include "codelite_events.h" | ||
#include <wx/filename.h> | ||
#include "clZipReader.h" | ||
#include "jobqueue.h" | ||
#include "job.h" | ||
#include "cl_standard_paths.h" | ||
|
||
class clJSCTagsZipJob : public Job | ||
{ | ||
protected: | ||
clJSCTags* m_jsctags; | ||
wxString m_zipfile; | ||
wxString m_targetFolder; | ||
|
||
public: | ||
clJSCTagsZipJob(clJSCTags* jsctags, const wxString& zipfile, const wxString& targetFolder) | ||
: Job(jsctags) | ||
, m_jsctags(jsctags) | ||
, m_zipfile(zipfile) | ||
, m_targetFolder(targetFolder) | ||
{ | ||
} | ||
|
||
virtual ~clJSCTagsZipJob() {} | ||
|
||
void Process(wxThread* thread) | ||
{ | ||
wxUnusedVar(thread); | ||
// Extract the zip file | ||
wxFileName::Mkdir(m_targetFolder, wxS_DIR_DEFAULT, wxPATH_MKDIR_FULL); | ||
clZipReader zipReader(m_zipfile); | ||
zipReader.Extract("*", m_targetFolder); | ||
m_jsctags->CallAfter(&clJSCTags::ZipExtractCompleted); | ||
} | ||
}; | ||
|
||
clJSCTags::clJSCTags() | ||
: m_zipExtracted(false) | ||
{ | ||
EventNotifier::Get()->Bind(wxEVT_ACTIVE_EDITOR_CHANGED, &clJSCTags::OnEditorChanged, this); | ||
EventNotifier::Get()->Bind(wxEVT_FILE_SAVED, &clJSCTags::OnEditorSaved, this); | ||
EventNotifier::Get()->Bind(wxEVT_INIT_DONE, &clJSCTags::OnInitDone, this); | ||
} | ||
|
||
clJSCTags::~clJSCTags() | ||
{ | ||
EventNotifier::Get()->Unbind(wxEVT_ACTIVE_EDITOR_CHANGED, &clJSCTags::OnEditorChanged, this); | ||
EventNotifier::Get()->Unbind(wxEVT_FILE_SAVED, &clJSCTags::OnEditorSaved, this); | ||
EventNotifier::Get()->Unbind(wxEVT_INIT_DONE, &clJSCTags::OnInitDone, this); | ||
} | ||
|
||
void clJSCTags::OnEditorSaved(clCommandEvent& event) { event.Skip(); } | ||
|
||
void clJSCTags::OnEditorChanged(wxCommandEvent& event) { event.Skip(); } | ||
|
||
void clJSCTags::ZipExtractCompleted() { m_zipExtracted = true; } | ||
|
||
void clJSCTags::OnInitDone(wxCommandEvent& event) | ||
{ | ||
// Extract the zip file | ||
wxFileName jsctagsZip(clStandardPaths::Get().GetDataDir(), "jsctags.zip"); | ||
if(jsctagsZip.Exists()) { | ||
wxFileName targetDir(clStandardPaths::Get().GetUserDataDir(), ""); | ||
targetDir.AppendDir("webtools"); | ||
targetDir.AppendDir("jsctags"); | ||
JobQueueSingleton::Instance()->PushJob( | ||
new clJSCTagsZipJob(this, jsctagsZip.GetFullPath(), targetDir.GetPath())); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#ifndef CLJSCTAGS_H | ||
#define CLJSCTAGS_H | ||
|
||
#include <wx/event.h> | ||
#include "cl_command_event.h" | ||
#include "smart_ptr.h" | ||
|
||
class clJSCTags : public wxEvtHandler | ||
{ | ||
bool m_zipExtracted; | ||
|
||
public: | ||
typedef SmartPtr<clJSCTags> Ptr_t; | ||
|
||
public: | ||
clJSCTags(); | ||
virtual ~clJSCTags(); | ||
|
||
void ZipExtractCompleted(); | ||
void OnEditorSaved(clCommandEvent& event); | ||
void OnEditorChanged(wxCommandEvent& event); | ||
void OnInitDone(wxCommandEvent& event); | ||
}; | ||
|
||
#endif // CLJSCTAGS_H |
Binary file not shown.