-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathmain.js
53 lines (44 loc) · 1.88 KB
/
main.js
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
/*!
* Brackets PHP Code Quality Tools 0.1.11
* Lint PHP using several code analysis tools.
*
* @author Mikael Jorhult
* @license http://mikaeljorhult.mit-license.org MIT
*/
define(function (require, exports, module) {
'use strict';
// Get module dependencies.
var CommandManager = brackets.getModule('command/CommandManager');
var ExtensionUtils = brackets.getModule('utils/ExtensionUtils');
var Menus = brackets.getModule('command/Menus');
var PreferencesManager = brackets.getModule('preferences/PreferencesManager');
// Extension Modules.
var Defaults = require('modules/Defaults');
var ParserManager = require('modules/ParserManager'); // jshint ignore:line
var SettingsDialog = require('modules/SettingsDialog');
var Strings = require('modules/Strings');
// Setup extension.
var COMMAND_ID_SETTINGS = 'mikaeljorhult.bracketsPHPLintTools.settings';
var preferences = PreferencesManager.getExtensionPrefs('mikaeljorhult.bracketsPHPLintTools');
// Hook into menus.
var menu = Menus.getMenu(Menus.AppMenuBar.VIEW_MENU);
// Define preferences.
preferences.definePreference('php-available', 'boolean', false);
preferences.definePreference('enabled-tools', 'array', Defaults.enabledTools);
preferences.definePreference('phpcs-standards', 'array', Defaults.phpcsStandards);
preferences.definePreference('phpmd-rulesets', 'array', Defaults.phpmdRulesets);
preferences.definePreference('php-location', 'string', Defaults.PHPLocation);
// Register extension.
CommandManager.register(Strings.EXTENSION_NAME, COMMAND_ID_SETTINGS, showSettingsDialog);
// Add command to menu.
if (menu !== undefined) {
menu.addMenuDivider();
menu.addMenuItem(COMMAND_ID_SETTINGS);
}
// Load stylesheet.
ExtensionUtils.loadStyleSheet(module, 'php-tools.css');
// Show settings dialog.
function showSettingsDialog () {
SettingsDialog.show(preferences);
}
});