Skip to content

Commit d0a62ea

Browse files
author
Bogdan Haidu
committed
include missing user parameter
1 parent 4c6b61a commit d0a62ea

File tree

10 files changed

+46
-20
lines changed

10 files changed

+46
-20
lines changed

.github/workflows/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
## What's changed
44

5-
- Include basic info on PHP -> Frameworks & Tools -> Laravel option
5+
- Add docker user config

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Change Log
22

3+
## [1.0.0.16]
4+
5+
- Add docker user config
6+
37
## [1.0.0.15]
48

59
- Display error message if pty4j is not working on windows

manifest.mf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ Manifest-Version: 1.0
22
AutoUpdate-Show-In-Client: true
33
OpenIDE-Module: org.netbeans.modules.php.laravel
44
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/php/laravel/resources/Bundle.properties
5-
OpenIDE-Module-Specification-Version: 1.0.0.15
5+
OpenIDE-Module-Specification-Version: 1.0.0.16
66

src/org/netbeans/modules/php/api/extexecution/docker/DockerExecutable.java

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ public class DockerExecutable {
4242

4343
private boolean interactive = true;
4444
private boolean asTerminal = true;
45+
private String dockerUser;
4546

4647
private String containerWorkDir;
47-
private boolean noInfo = false;
4848

4949
private String terminalName = "PtyTerminal";// NOI18N
5050

@@ -79,6 +79,11 @@ public DockerExecutable setUseTTY(boolean status) {
7979
return this;
8080
}
8181

82+
public DockerExecutable setDockerUser(String user) {
83+
this.dockerUser = user;
84+
return this;
85+
}
86+
8287
public Future<Integer> run(ExecutionDescriptor executionDescriptor, ExecutionDescriptor.InputProcessorFactory2 outProcessorFactory) {
8388
Parameters.notNull("executionDescriptor", executionDescriptor); // NOI18N
8489
Callable<Process> processBuilder = getProcessBuilder();
@@ -141,6 +146,11 @@ private Callable<Process> getProcessBuilder() {
141146
arguments.add("-" + interactionMode);
142147
}
143148

149+
if (dockerUser != null) {
150+
arguments.add("-u");
151+
arguments.add(dockerUser);
152+
}
153+
144154
arguments.add(containerName);
145155
arguments.add(bashType);
146156
arguments.add("-c"); // NOI18N
@@ -173,10 +183,6 @@ private Callable<Process> getProcessBuilder() {
173183
}
174184

175185
private ExecutionDescriptor.InputProcessorFactory2 getInfoOutputProcessorFactory() {
176-
if (noInfo) {
177-
// no info
178-
return null;
179-
}
180186
return new ExecutionDescriptor.InputProcessorFactory2() {
181187
@Override
182188
public InputProcessor newInputProcessor(InputProcessor defaultProcessor) {

src/org/netbeans/modules/php/laravel/commands/ExecutableService.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ public static void executeCommand(PhpModule phpModule,
4747
.containerWorkDir(getDockerWorkdir(phpModule))
4848
.setUserInteractive(getDockerUseInteractive(phpModule))
4949
.setUseTTY(getDockerUseTTY(phpModule))
50+
.setDockerUser(getDockerUser(phpModule))
5051
;
5152

5253
ExecutionDescriptor.InputProcessorFactory2 descriptor = null;
@@ -107,6 +108,10 @@ private static boolean getDockerUseTTY(PhpModule phpModule) {
107108
return LaravelPreferences.getDockerUseTTy(phpModule);
108109
}
109110

111+
private static String getDockerUser(PhpModule phpModule) {
112+
return LaravelPreferences.getDockerUser(phpModule);
113+
}
114+
110115
private static PhpExecutable createPhpExecutable(PhpModule phpModule) {
111116
String absolutePath = FileUtil.toFile(phpModule.getSourceDirectory()).getAbsolutePath();
112117
return new PhpExecutable(absolutePath + "/" + ARTISAN_COMMAND)

src/org/netbeans/modules/php/laravel/preferences/LaravelPreferences.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ public final class LaravelPreferences {
2626
private static final String DOCKER_WORKDIR = "docker_workdir"; // NOI18N
2727
private static final String DOCKER_USE_TTY = "docker_use_tty"; // NOI18N
2828
private static final String DOCKER_USE_INTERACTIVE = "docker_use_interactive"; // NOI18N
29+
private static final String DOCKER_USER = "docker_user"; // NOI18N
2930

3031
private static final boolean DEFAULT_DOCKER_TTY = true;
3132
private static final boolean DEFAULT_DOCKER_INTERACTIVE = true;
@@ -64,7 +65,11 @@ public static void setDockerUseTty(PhpModule module, boolean bool) {
6465
public static void setDockerUseInteractive(PhpModule module, boolean bool) {
6566
getPreferences(module).putBoolean(DOCKER_USE_INTERACTIVE, bool);
6667
}
67-
68+
69+
public static void setDockerUser(PhpModule module, String text) {
70+
getPreferences(module).put(DOCKER_USER, text);
71+
}
72+
6873
private static Preferences getPreferences(PhpModule module) {
6974
return module.getPreferences(LaravelPhpFrameworkProvider.class, true);
7075
}
@@ -109,6 +114,10 @@ public static boolean getDockerUseTTy(PhpModule module) {
109114
public static boolean getDockerUseInteractive(PhpModule module) {
110115
return getPreferences(module).getBoolean(DOCKER_USE_INTERACTIVE, DEFAULT_DOCKER_INTERACTIVE);
111116
}
117+
118+
public static String getDockerUser(PhpModule module) {
119+
return getPreferences(module).get(DOCKER_USER, null);
120+
}
112121

113122
public static TerminalComboBoxModel getTerminalEnvAsModel() {
114123
TerminalComboBoxModel model = new TerminalComboBoxModel();
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
OpenIDE-Module-Display-Category=PHP
22
OpenIDE-Module-Long-Description=\
3-
<h1>Support for Laravel Framework</h1>\n<p>@author Haidu Bogdan</p>\n\n1.0.0.15 - Display error message if ptyj4 is not working on windows<br>\n1.0.0.14 - Include basic Options text<br>\n1.0.0.8 - Updates on execution commands<br>
3+
<h1>Support for Laravel Framework</h1>\n<p>@author Haidu Bogdan</p>\n\n1.0.0.16 - Include user option in docker execution<br>\n1.0.0.15 - Display error message if ptyj4 is not working on windows<br>\n1.0.0.14 - Include basic Options text<br>\n1.0.0.8 - Updates on execution commands<br>
44
OpenIDE-Module-Name=Php Laravel Framework
55
OpenIDE-Module-Short-Description=Support for Laravel Framework

src/org/netbeans/modules/php/laravel/ui/customizer/Bundle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ LaravelCustomizerPanel.jLabel11.text=for local VM or remote connection
1717
LaravelCustomizerPanel.jLabel12.text=- Docker Workdir
1818
LaravelCustomizerPanel.dockerWorkdir.text=
1919
LaravelCustomizerPanel.jLabel13.text=- User
20-
LaravelCustomizerPanel.dockerContainerName1.text=
2120
LaravelCustomizerPanel.interactiveOption.text=Interactive (-i)
2221
LaravelCustomizerPanel.ttyOption.text=Pseudo-TTY (-t)
2322
LaravelCustomizerPanel.jLabel14.text=- Terminal options
23+
LaravelCustomizerPanel.dockerUser.text=

src/org/netbeans/modules/php/laravel/ui/customizer/LaravelCustomizerPanel.form

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@
9292
<EmptySpace type="separate" max="-2" attributes="0"/>
9393
<Group type="103" groupAlignment="0" attributes="0">
9494
<Component id="dockerContainerName" alignment="0" max="32767" attributes="0"/>
95-
<Component id="dockerContainerName1" alignment="0" max="32767" attributes="0"/>
95+
<Component id="dockerUser" alignment="0" max="32767" attributes="0"/>
9696
<Component id="dockerBashPath" max="32767" attributes="0"/>
9797
</Group>
9898
</Group>
@@ -150,7 +150,7 @@
150150
</Group>
151151
<EmptySpace max="-2" attributes="0"/>
152152
<Group type="103" groupAlignment="3" attributes="0">
153-
<Component id="dockerContainerName1" alignment="3" min="-2" max="-2" attributes="0"/>
153+
<Component id="dockerUser" alignment="3" min="-2" max="-2" attributes="0"/>
154154
<Component id="jLabel13" alignment="3" min="-2" max="-2" attributes="0"/>
155155
</Group>
156156
<EmptySpace max="-2" attributes="0"/>
@@ -318,10 +318,10 @@
318318
</Property>
319319
</Properties>
320320
</Component>
321-
<Component class="javax.swing.JTextField" name="dockerContainerName1">
321+
<Component class="javax.swing.JTextField" name="dockerUser">
322322
<Properties>
323323
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
324-
<ResourceString bundle="org/netbeans/modules/php/laravel/ui/customizer/Bundle.properties" key="LaravelCustomizerPanel.dockerContainerName1.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
324+
<ResourceString bundle="org/netbeans/modules/php/laravel/ui/customizer/Bundle.properties" key="LaravelCustomizerPanel.dockerUser.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
325325
</Property>
326326
</Properties>
327327
</Component>

src/org/netbeans/modules/php/laravel/ui/customizer/LaravelCustomizerPanel.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ public void initModuleValues(PhpModule module){
3737
dockerWorkdir.setText(LaravelPreferences.geDockerWorkdir(module));
3838
ttyOption.setSelected(LaravelPreferences.getDockerUseTTy(module));
3939
interactiveOption.setSelected(LaravelPreferences.getDockerUseInteractive(module));
40+
dockerUser.setText(LaravelPreferences.getDockerUser(module));
4041

4142
if (!LaravelPreferences.getRemoteConnectionFlag(module)){
4243
RemoteTerminal.setSelectedIndex(0);
@@ -49,7 +50,7 @@ public void initModuleValues(PhpModule module){
4950
public boolean isFrameworkEnabled(){
5051
return projectSupportEnabled.isSelected();
5152
}
52-
53+
5354
public void saveChanges(PhpModule module){
5455
String selectedItem = (String) RemoteTerminal.getSelectedItem();
5556
boolean useRemoteTerminal = !selectedItem.equals("No terminal");
@@ -59,6 +60,7 @@ public void saveChanges(PhpModule module){
5960
LaravelPreferences.setRemoteConnectionFlag(module, useRemoteTerminal);
6061
LaravelPreferences.setUseDocker(module,useDocker.isSelected());
6162
LaravelPreferences.setDockerWorkdir(module,dockerWorkdir.getText());
63+
LaravelPreferences.setDockerUser(module, dockerUser.getText());
6264

6365
useDocker.setEnabled(projectSupportEnabled.isSelected());
6466
dockerBashPath.setEditable(projectSupportEnabled.isSelected());
@@ -101,7 +103,7 @@ private void initComponents() {
101103
jLabel12 = new javax.swing.JLabel();
102104
dockerWorkdir = new javax.swing.JTextField();
103105
jLabel13 = new javax.swing.JLabel();
104-
dockerContainerName1 = new javax.swing.JTextField();
106+
dockerUser = new javax.swing.JTextField();
105107
interactiveOption = new javax.swing.JCheckBox();
106108
ttyOption = new javax.swing.JCheckBox();
107109
jLabel14 = new javax.swing.JLabel();
@@ -153,7 +155,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
153155

154156
org.openide.awt.Mnemonics.setLocalizedText(jLabel13, org.openide.util.NbBundle.getMessage(LaravelCustomizerPanel.class, "LaravelCustomizerPanel.jLabel13.text")); // NOI18N
155157

156-
dockerContainerName1.setText(org.openide.util.NbBundle.getMessage(LaravelCustomizerPanel.class, "LaravelCustomizerPanel.dockerContainerName1.text")); // NOI18N
158+
dockerUser.setText(org.openide.util.NbBundle.getMessage(LaravelCustomizerPanel.class, "LaravelCustomizerPanel.dockerUser.text")); // NOI18N
157159

158160
org.openide.awt.Mnemonics.setLocalizedText(interactiveOption, org.openide.util.NbBundle.getMessage(LaravelCustomizerPanel.class, "LaravelCustomizerPanel.interactiveOption.text")); // NOI18N
159161

@@ -228,7 +230,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
228230
.addGap(18, 18, 18)
229231
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
230232
.addComponent(dockerContainerName)
231-
.addComponent(dockerContainerName1)
233+
.addComponent(dockerUser)
232234
.addComponent(dockerBashPath))))))
233235
.addGap(20, 20, 20)))
234236
.addContainerGap())
@@ -272,7 +274,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
272274
.addComponent(jLabel5))
273275
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
274276
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
275-
.addComponent(dockerContainerName1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
277+
.addComponent(dockerUser, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
276278
.addComponent(jLabel13))
277279
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
278280
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
@@ -303,7 +305,7 @@ private void ttyOptionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIR
303305
private javax.swing.JComboBox<String> RemoteTerminal;
304306
private javax.swing.JTextField dockerBashPath;
305307
private javax.swing.JTextField dockerContainerName;
306-
private javax.swing.JTextField dockerContainerName1;
308+
private javax.swing.JTextField dockerUser;
307309
private javax.swing.JTextField dockerWorkdir;
308310
private javax.swing.JCheckBox interactiveOption;
309311
private javax.swing.JLabel jLabel1;

0 commit comments

Comments
 (0)