Skip to content

Commit

Permalink
release v3.1.8
Browse files Browse the repository at this point in the history
  • Loading branch information
xjsender committed Aug 8, 2015
1 parent 859e23d commit 6bebae2
Show file tree
Hide file tree
Showing 16 changed files with 164 additions and 39 deletions.
25 changes: 24 additions & 1 deletion HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,31 @@ Release History

---------------

Release 3.1.8 (2015-08-08)
++++++++++++++++++
* Bug Fix:
- Fix bug for bootstrap3 completion
- Fix bug for ``toggle_metadata_objects`` command if project is not initiated
- Fix bug for ``SOQL - SELECT FROM.sublime.snippet`` in windows

* Enhancement:
- Add confirm request for ``retrieve files from server`` and ``retrieve files from this server``
- Add confirm request for ``destruct package.xml from server`` and ``retrieve files from this server``
- Identify ``this file`` or ``these files`` in confirm request message according to number of chosen files

* Update:
- Add project name and remove [LOG] or [ERROR] notation in log or error panel
- Rename ``destruct package.xml`` command to ``destruct package.xml from server``
- Rename ``retrieve package.xml`` command to ``retrieve package.xml from server``
- Update ``to`` or ``from`` in context menu item name to ``To`` or ``From``
- Update confirm request message for ``destruct files from server``

* New:
- Add a new command ``Enable Development Mode`` to quickly enable visualforce page development mode
- Add bootstrap3 completion document


Release 3.1.7 (2015-07-29)
Release 3.1.7 (2015-08-05)
++++++++++++++++++
* Enhancement:
- Add `with sharing` for `Utility Class` in template
Expand Down
2 changes: 1 addition & 1 deletion completions.py
Original file line number Diff line number Diff line change
Expand Up @@ -679,7 +679,7 @@ def on_query_completions(self, view, prefix, locations):

# 4. Bootstrap3 class name completions
if not settings["disable_bootstrap_completion"]:
matched_attribute_regions = view.find_all('\w+="[\w\s]*"')
matched_attribute_regions = view.find_all('\w+="[\w\s\-]*"')
for mr in matched_attribute_regions:
if not mr.contains(pt): continue
className = view.substr(mr).split("=")[0]
Expand Down
10 changes: 10 additions & 0 deletions config/commands/main.sublime-commands
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,16 @@
"command": "update_user_language"
},

{
"caption": "HaoIDE: Update User Password",
"command": "update_user_password"
},

{
"caption": "HaoIDE: Enable User Development Mode",
"command": "enable_development_mode"
},

{
"caption": "HaoIDE: New ApexTrigger",
"command": "create_apex_trigger"
Expand Down
28 changes: 14 additions & 14 deletions config/menus/Context.sublime-menu
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
[
{"caption": "-"},

{"caption": "Destruct Package.xml", "command": "destruct_package_xml"},
{"caption": "Retrieve Package.xml", "command": "retrieve_package_xml"},
{"caption": "Destruct Package.xml From Server", "command": "destruct_package_xml_from_server"},
{"caption": "Retrieve Package.xml From Server", "command": "retrieve_package_xml_from_server"},

{"caption": "-"},

// {"caption": "Rename Metadata", "command": "rename_metadata"},
{"caption": "Retrieve from Server", "command": "retrieve_file_from_server"},
// {"caption": "Rename from Server", "command": "rename_metadata"},
{"caption": "Deploy to Server", "command": "deploy_file_to_server"},
{"caption": "Destruct from Server", "command": "destruct_file_from_server"},
{"caption": "Retrieve From Server", "command": "retrieve_file_from_server"},
// {"caption": "Rename From Server", "command": "rename_metadata"},
{"caption": "Deploy To Server", "command": "deploy_file_to_server"},
{"caption": "Destruct From Server", "command": "destruct_file_from_server"},

{"caption": "Diff With Server", "command": "diff_with_server"},

Expand All @@ -27,21 +27,21 @@
"switch": false
}
},
{"caption": "Retrieve from This Server", "command": "retrieve_file_from_server",
{"caption": "Retrieve From This Server", "command": "retrieve_file_from_server",
"args": {
"switch": false
}
},
{"caption": "Deploy to This Server", "command": "deploy_file_to_this_server"},
{"caption": "Deploy To This Server", "command": "deploy_file_to_this_server"},

{"caption": "-"},

{"caption": "Refresh from Server", "command": "refresh_file_from_server"},
{"caption": "Refresh From Server", "command": "refresh_file_from_server"},

// Save component
{"caption": "Save to Server", "command": "save_to_server"},
{"caption": "Save To Server", "command": "save_to_server"},

{"caption": "Delete from Server", "command": "delete_file_from_server"},
{"caption": "Delete From Server", "command": "delete_file_from_server"},

// Compile component but not save
{"caption": "Compile Component", "command": "save_to_server",
Expand All @@ -66,17 +66,17 @@
},

{
"caption": "JSON to Apex",
"caption": "JSON To Apex",
"command": "json_to_apex"
},

{
"caption": "JSON to XML",
"caption": "JSON To XML",
"command": "json_to_xml"
},

{
"caption": "XML to JSON",
"caption": "XML To JSON",
"command": "xml_to_json"
},

Expand Down
4 changes: 4 additions & 0 deletions config/menus/Main.sublime-menu
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@
{
"caption": "Update User Password",
"command": "update_user_password"
},
{
"caption": "Enable User Development Mode",
"command": "enable_development_mode"
}
]
},
Expand Down
26 changes: 26 additions & 0 deletions config/messages/3.1.8.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
Build 3.1.8
-----------
Release Date: 8 Aug 2015

* Bug Fix:
- Fix bug for bootstrap3 completion
- Fix bug for ``toggle_metadata_objects`` command if project is not initiated
- Fix bug for ``SOQL - SELECT FROM.sublime.snippet`` in windows

* Enhancement:
- Add confirm request for ``retrieve files from server`` and ``retrieve files from this server``
- Add confirm request for ``destruct package.xml from server``
- Identify ``this file`` or ``these files`` in confirm request message according to number of chosen files

* Update:
- Add project name and remove [LOG] or [ERROR] notation in log or error panel
- Rename ``destruct package.xml`` command to ``destruct package.xml from server``
- Rename ``retrieve package.xml`` command to ``retrieve package.xml from server``
- Update ``to`` or ``from`` in context menu item name to ``To`` or ``From``
- Update confirm request message for ``destruct files from server``

* New:
- Add a new command ``Enable Development Mode`` to quickly enable visualforce page development mode
- Add bootstrap3 completion document

* Restart your sublime when new version is installed
2 changes: 1 addition & 1 deletion config/settings/package.sublime-settings
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "HaoIDE",
"version": "3.1.7",
"version": "3.1.8",
"description": "HaoIDE is a Sublime Text 3 plugin for Salesforce and used for swift development on Force.com",
"author": "Hao Liu",
"email": "[email protected]",
Expand Down
8 changes: 5 additions & 3 deletions config/settings/toolingapi.sublime-settings
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@
{
// In order to prevent plugin update override your toolingapi settings,
// you should save the workspace, login_url, username and password to user settings.
// If you want to do this, you should click [Sublime > Settings > Setting - User], and copy these settings into it
// If you want to do this, you should click [HaoIDE > Settings > Setting - User], and copy these settings into it
// User Settings is prior to Default Settings, it's very important.
// You should have more than one project in "projects", however, only one project can be default
// Every time you switch the project, the update projects settings will be saved to user settings.
//
// Workspace in OSX is different with windows,
// workspace can be "/Users/<Your User>/salesforce/workspace"
// If you don't set your own workspace, plugin will save your project to
// `/Data/Packages/User/HaoIDE/<Project_Name>`
"workspace" : "",
"projects" : {
"pro-sublime" : {
Expand Down Expand Up @@ -94,15 +96,15 @@
"auto_update_on_save": false,

// Every time when you open a file, assume the project of this file is not the default project,
// if you set this settings to true, plugin will switch the default project to the project
// if you set this setting to true, plugin will switch the default project to the project
// of the open file automatically when you open a file
"auto_switch_project_on_file_activated": false,

// Sync active file with sidebar, for example, if you set this value to true,
// every time when you open a file, plugin will reveal the file in the sidebar
"reveal_file_in_sidebar_on_file_activated": false,

// Debug Mode, after switch this settings to true,
// Debug Mode, after switch this setting to true,
// you can see some debug logs in the console
"debug_mode": false,

Expand Down
12 changes: 12 additions & 0 deletions context.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,18 @@ def get_settings():

return settings

def get_default_project_name():
s = sublime.load_settings("toolingapi.sublime-settings")
projects = s.get("projects")

default_project_name = None
for project_name in projects.keys():
if projects[project_name]["default"]:
default_project_name = project_name
break

return default_project_name

def build_metadata_objects_settings(settings, metadata_objects):
settings["all_metadata_folders"] = [c["directoryName"] for c in metadata_objects]
settings["all_metadata_objects"] = [c["xmlName"] for c in metadata_objects]
Expand Down
4 changes: 4 additions & 0 deletions docs/completion.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@
- Input ``space`` after HTML tag name, for example, ``<a``, you will see all the attributes of this tags
- Input ``=`` after the HTML tag attribute, if this attributes has fixed values, plugin will list all available values for this tag attribute

### Bootstrap3 completion
* When you input any characters in the class attribute, plugin will list all available bootstrap3 classes, for example, if you have input ``class="<Focus Here>"``, when you input any characters at the focus place, you will see the completion
* When you input any characters after space in the class attribute, plugin will list all available bootstrap3 classes, for example, if you have input ``class="btn <Focus Here>"``, when you input any characters at the focus place, you will see the completion

### Settings for Visualforce and HTML completion
```json
// Indicate whether disable attribute completion
Expand Down
45 changes: 38 additions & 7 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,8 @@ def run(self, callback_options={}):
def on_done(self, index):
if index == -1:
if "callback_command" in self.callback_options:
return self.window.run_command(self.callback_options["callback_command"])
self.window.run_command(self.callback_options["callback_command"])
return

# Get chosen type
chosen_item = self.items[index]
Expand Down Expand Up @@ -723,6 +724,12 @@ def __init__(self, *args, **kwargs):
super(RetrieveFilesFromServer, self).__init__(*args, **kwargs)

def run(self, files, switch=True, source_org=None):
message = "Confirm retrieving %s from server?" % (
"these files" if len(files) > 1 else "this file"
)
if not sublime.ok_cancel_dialog(message, "Confirm?"):
return

settings = context.get_settings()

if switch:
Expand Down Expand Up @@ -786,7 +793,9 @@ def is_enabled(self):
class DestructFileFromServer(sublime_plugin.TextCommand):
def run(self, edit):
files = [self.view.file_name()]
sublime.active_window().run_command("destruct_files_from_server", {"files": files})
sublime.active_window().run_command("destruct_files_from_server", {
"files": files
})

def is_enabled(self):
if not self.view or not self.view.file_name(): return False
Expand All @@ -806,9 +815,11 @@ def __init__(self, *args, **kwargs):
super(DestructFilesFromServer, self).__init__(*args, **kwargs)

def run(self, files):
message = "Are you sure you really want to destruct these files?"
if not sublime.ok_cancel_dialog(message, "Destruct Files From Server"): return
processor.handle_destructive_files(files)
message = "Confirm destructing %s from server?" % (
"these files" if len(files) > 1 else "this file"
)
if sublime.ok_cancel_dialog(message, "Confirm"):
processor.handle_destructive_files(files)

def is_visible(self, files):
if len(files) == 0: return False
Expand Down Expand Up @@ -1845,9 +1856,9 @@ def __init__(self, *args, **kwargs):
def run(self, callback_options={}, force=False):
processor.handle_login_thread(callback_options, force=force)

class UpdateUserLanguageCommand(sublime_plugin.WindowCommand):
class UpdateUserLanguage(sublime_plugin.WindowCommand):
def __init__(self, *args, **kwargs):
super(UpdateUserLanguageCommand, self).__init__(*args, **kwargs)
super(UpdateUserLanguage, self).__init__(*args, **kwargs)

def run(self):
settings = context.get_settings()
Expand All @@ -1864,6 +1875,26 @@ def on_choose(self, index):
def is_enabled(self):
return util.check_action_enabled()

class EnableDevelopmentMode(sublime_plugin.WindowCommand):
def __init__(self, *args, **kwargs):
super(EnableDevelopmentMode, self).__init__(*args, **kwargs)

def run(self):
self.users = processor.handle_populate_users("enable_development_mode")
if not self.users: return # Network Issue Cause
self.users_name = sorted(self.users.keys(), reverse=False)
self.window.show_quick_panel(self.users_name, self.on_done)

def on_done(self, index):
if index == -1: return

user_name = self.users_name[index]
user_id = self.users[user_name]
processor.handle_enable_development_mode(user_id)

def is_enabled(self):
return util.check_action_enabled()

class UpdateUserPassword(sublime_plugin.WindowCommand):
def __init__(self, *args, **kwargs):
super(UpdateUserPassword, self).__init__(*args, **kwargs)
Expand Down
1 change: 1 addition & 0 deletions messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@
"3.1.5": "config/messages/3.1.5.md",
"3.1.6": "config/messages/3.1.6.md",
"3.1.7": "config/messages/3.1.7.md",
"3.1.8": "config/messages/3.1.8.md",
"install": "config/messages/install.txt"
}
12 changes: 7 additions & 5 deletions package.py
Original file line number Diff line number Diff line change
Expand Up @@ -441,12 +441,14 @@ def is_visible(self, dirs):
if not dirs or len(dirs) > 1: return False
return True

class DestructPackageXml(sublime_plugin.WindowCommand):
class DestructPackageXmlFromServer(sublime_plugin.WindowCommand):
def __init__(self, *args, **kwargs):
super(DestructPackageXml, self).__init__(*args, **kwargs)
super(DestructPackageXmlFromServer, self).__init__(*args, **kwargs)

def run(self, files=None):
# Build types
message = "Confirm to destruct elements in this package.xml from server?"
if not sublime.ok_cancel_dialog(message, "Confirm?"): return

try:
with open(self._file, "rb") as fp:
content = fp.read()
Expand Down Expand Up @@ -475,9 +477,9 @@ def is_visible(self, files=None):

return True

class RetrievePackageXml(sublime_plugin.WindowCommand):
class RetrievePackageXmlFromServer(sublime_plugin.WindowCommand):
def __init__(self, *args, **kwargs):
super(RetrievePackageXml, self).__init__(*args, **kwargs)
super(RetrievePackageXmlFromServer, self).__init__(*args, **kwargs)

def run(self, files=None):
# Build types
Expand Down
16 changes: 13 additions & 3 deletions processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,16 +121,26 @@ def handle_update_user_language(language, timeout=120):
api = ToolingApi(settings)
session = util.get_session_info(settings)
if not session:
Printer.get('error').write("Please Login Firstly")
return

return Printer.get('error').write("Login is required before this action")

patch_url = "/sobjects/User/%s" % session["user_id"]
thread = threading.Thread(target=api.patch,
args=(patch_url, {"LanguageLocaleKey": language}, ))
thread.start()
ThreadProgress(api, thread, "Updating User Language to " + language,
"User language is updated to " + language)

def handle_enable_development_mode(user_id, timeout=120):
settings = context.get_settings()
api = ToolingApi(settings)

patch_url = "/sobjects/User/%s" % user_id
thread = threading.Thread(target=api.patch,
args=(patch_url, {"UserPreferencesApexPagesDeveloperMode": True}, ))
thread.start()
ThreadProgress(api, thread, "Enabling User Development Mode",
"Succeed to Enabling User Development Mode")

def handle_update_user_password(user_id, new_password, timeout=120):
settings = context.get_settings()
api = ToolingApi(settings)
Expand Down
Loading

0 comments on commit 6bebae2

Please sign in to comment.