forked from brackets-userland/brackets-git
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.js
More file actions
82 lines (70 loc) · 2.89 KB
/
main.js
File metadata and controls
82 lines (70 loc) · 2.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/*!
* Brackets Git Extension
*
* @author Martin Zagora
* @license http://opensource.org/licenses/MIT
*/
define(function (require, exports, module) {
// Brackets modules
var AppInit = brackets.getModule("utils/AppInit"),
CommandManager = brackets.getModule("command/CommandManager"),
Commands = brackets.getModule("command/Commands"),
ExtensionUtils = brackets.getModule("utils/ExtensionUtils"),
Menus = brackets.getModule("command/Menus");
// Local modules
var ChangelogDialog = require("src/ChangelogDialog"),
EventEmitter = require("src/EventEmitter"),
Events = require("src/Events"),
ExtensionInfo = require("src/ExtensionInfo"),
Main = require("src/Main"),
Preferences = require("src/Preferences"),
SettingsDialog = require("src/SettingsDialog"),
Strings = require("strings");
// Load extension modules that are not included by core
var modules = [
"src/BracketsEvents",
"src/GutterManager",
"src/History",
"src/NoRepo",
"src/ProjectTreeMarks",
"src/Remotes",
"src/utils/Terminal"
];
if (Preferences.get("useGitFtp")) { modules.push("src/ftp/Ftp"); }
if (Preferences.get("showTerminalIcon")) { modules.push("src/terminalicon/TerminalIcon"); }
require(modules);
// Load CSS
ExtensionUtils.loadStyleSheet(module, "styles/brackets-git.less");
ExtensionUtils.loadStyleSheet(module, "styles/fonts/octicon.less");
if (Preferences.get("useGitFtp")) { ExtensionUtils.loadStyleSheet(module, "styles/src/ftp/styles/ftp.less"); }
// Display settings panel on first start / changelog dialog on version change
ExtensionInfo.get().then(function (packageJson) {
// do not display dialogs when running tests
if (window.isBracketsTestWindow) {
return;
}
var lastVersion = Preferences.get("lastVersion"),
currentVersion = packageJson.version;
if (!lastVersion) {
Preferences.persist("lastVersion", "firstStart");
SettingsDialog.show();
} else if (lastVersion !== currentVersion) {
Preferences.persist("lastVersion", currentVersion);
ChangelogDialog.show();
}
});
// Register command and add it to the menu.
var SETTINGS_COMMAND_ID = "brackets-git.settings";
CommandManager.register(Strings.GIT_SETTINGS, SETTINGS_COMMAND_ID, SettingsDialog.show);
Menus.getMenu(Menus.AppMenuBar.FILE_MENU).addMenuItem(SETTINGS_COMMAND_ID, "", Menus.AFTER, Commands.FILE_PROJECT_SETTINGS);
AppInit.appReady(function () {
Main.init();
});
// export API's for other extensions
if (typeof window === "object") {
window.bracketsGit = {
EventEmitter: EventEmitter,
Events: Events
};
}
});