-
Notifications
You must be signed in to change notification settings - Fork 7
/
PhpNamespaceCopy.py
31 lines (25 loc) · 1.13 KB
/
PhpNamespaceCopy.py
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
import sublime, sublime_plugin, os
from namespaces import *
global currentView
class PhpNamespaceCopyCommand(sublime_plugin.WindowCommand):
def run(self):
if is_php_file(self.window.active_view()):
sublime.set_clipboard(get_namespace(self.window))
close_overlay(self.window, currentView)
class PhpNamespaceInsertUseCommand(sublime_plugin.WindowCommand):
def run(self):
if is_php_file(self.window.active_view()):
namespace = get_namespace(self.window)
close_overlay(self.window, currentView)
if is_php_file(self.window.active_view()):
insert_use_statement(self.window.active_view(), namespace)
class PhpNamespaceInsertNamespaceCommand(sublime_plugin.TextCommand):
def run(self, edit):
if is_php_file(self.view):
insert_namespace_statement(self.view, edit, build_namespace(self.view))
class PhpNamespaceEventListener(sublime_plugin.EventListener):
def on_activated(self, view):
global currentView
if None != view.window():
if is_file_opened(view.window(), view):
currentView = view