Skip to content

Commit

Permalink
Update 16.5
Browse files Browse the repository at this point in the history
  • Loading branch information
dim-s committed Mar 11, 2017
1 parent 3fffb26 commit 253d424
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 6 deletions.
5 changes: 5 additions & 0 deletions develnext/src/ide/editors/FormEditor.php
Original file line number Diff line number Diff line change
Expand Up @@ -1937,6 +1937,11 @@ protected function makeDesigner($fullArea = false)
protected function makeContextMenu()
{
$this->contextMenu = new ContextMenu($this, $this->format->getContextCommands());
$this->contextMenu->addSeparator();
$this->contextMenu->addCommand(AbstractCommand::makeWithText('События объекта', null, function () {
$this->eventListPane->showEventMenu(true, $this->designer->pickedNode);
}));

$this->contextMenu->setFilter(function () {
return $this->layout->focused || $this->contextMenu->getRoot()->visible || $this->layout->findFocusedNode();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@
use ide\utils\FileUtils;
use ide\utils\Json;
use php\gui\event\UXEvent;
use php\gui\framework\AbstractForm;
use php\gui\framework\AbstractModule;
use php\gui\layout\UXHBox;
use php\gui\layout\UXVBox;
use php\gui\UXApplication;
Expand Down Expand Up @@ -855,9 +857,18 @@ public function createModule($name)
$template = new PhpClassFileTemplate($name, 'AbstractModule');
$template->setNamespace("{$this->project->getPackageName()}\\modules");

$template->setImports([
"std, gui, framework, {$this->project->getPackageName()}"
]);

$php = PhpProjectBehaviour::get();

if ($php && $php->getImportType() == 'package') {
$template->setImports([
"std, gui, framework, {$this->project->getPackageName()}"
]);
} else {
$template->setImports([
AbstractModule::class
]);
}

$file = $this->project->createFile("src/{$this->project->getPackageName()}/modules/$name.php", $template);

Expand Down Expand Up @@ -1012,9 +1023,18 @@ public function createForm($name, $namespace = null)
$template = new PhpClassFileTemplate($name, 'AbstractForm');

$template->setNamespace($namespace);
$template->setImports([
"std, gui, framework, {$this->project->getPackageName()}"
]);

$php = PhpProjectBehaviour::get();

if ($php && $php->getImportType() == 'package') {
$template->setImports([
"std, gui, framework, {$this->project->getPackageName()}"
]);
} else {
$template->setImports([
AbstractForm::class
]);
}

$sources = $this->project->createFile($this->project->getAbsoluteFile("$file.php"), $template);
$sources->applyTemplate($template);
Expand Down
6 changes: 6 additions & 0 deletions develnext/src/ide/project/behaviours/PhpProjectBehaviour.php
Original file line number Diff line number Diff line change
Expand Up @@ -570,6 +570,12 @@ public function doMakeSettings(CommonProjectControlPane $editor)
$importTitle = new UXLabel('Метод импортирования классов:');
$importTypeSelect = new UXComboBox(self::$importTypes);

$importTypeSelect->on('action', function () {
uiLater(function () {
$this->setImportType(arr::keys(static::$importTypes)[$this->uiImportTypesSelect->selectedIndex]);
});
});

$this->uiImportTypesSelect = $importTypeSelect;

$importTypeSelect->padding = 5;
Expand Down

0 comments on commit 253d424

Please sign in to comment.