Skip to content

Commit

Permalink
Atom@v1 API, fix #29
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicolab committed Jun 5, 2015
1 parent f962814 commit df14c2c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
22 changes: 16 additions & 6 deletions lib/local-history-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
*/

var helpers = require('atom-helpers');
var _atom = require('atom');
var SelectListView = _atom.SelectListView;
var SelectListView = require('atom-space-pen-views').SelectListView;
var exec = require("child_process").exec;
var path = require('path');
var fsPlus = require('fs-plus');
Expand Down Expand Up @@ -40,6 +39,14 @@ LocalHistoryView.prototype.destroy = function() {
return LocalHistoryView.__super__.detach.apply(this, arguments);
};

LocalHistoryView.prototype.cancelled = function() {
this.hide();
};

LocalHistoryView.prototype.hide = function() {
this.modalPanel.hide();
};

LocalHistoryView.prototype.viewForItem = function(item) {
var ext = path.extname(item);
var typeClass = 'icon-file-text';
Expand Down Expand Up @@ -101,8 +108,9 @@ LocalHistoryView.prototype.confirmed = function(item) {
};

LocalHistoryView.prototype.findLocalHistory = function() {
var currentFilePath, needRevList;
var currentFilePath, needRevList, workspaceView;

workspaceView = atom.views.getView(atom.workspace);
currentFilePath = helpers.editor.getCurrentFilePath();

needRevList = [
Expand All @@ -121,8 +129,9 @@ LocalHistoryView.prototype.findLocalHistory = function() {
'Local history path: <em>' + localHistoryPath + '</em></div>');
}

atom.workspaceView.append(this);

this.modalPanel = atom.workspace.addModalPanel({item: this});
this.modalPanel.show();

this.focusFilterEditor();
};

Expand All @@ -133,6 +142,7 @@ LocalHistoryView.prototype.openDifftoolForCurrentFile = function openDifftoolFor
return this.openDifftool(currentFilePath, revision);
}
};

LocalHistoryView.prototype.openDifftool = function openDifftool(current, revision) {
var basePath = atom.project.getPath();
var diffCmd = atom.config.get('local-history.difftoolCommand');
Expand Down Expand Up @@ -170,7 +180,7 @@ LocalHistoryView.prototype.openDifftool = function openDifftool(current, revisio

LocalHistoryView.prototype.saveRevision = function saveRevision(buffer) {
var now, day, month, pathDirName, file, revFileName;

now = new Date();
day = '' + now.getDate();
month = '' + (now.getMonth() + 1);
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"dependencies": {
"atom-helpers": "^1.1.4",
"atom-message-panel": "^1.2.2",
"atom-space-pen-views": "^2.0.5",
"bluebird": "^2.9.24",
"fs-plus": "^2.7.0",
"humanize-plus": "^1.5.0"
Expand Down

0 comments on commit df14c2c

Please sign in to comment.