Skip to content

Commit 408642b

Browse files
committedDec 19, 2020
Fix style and sonarlint violations.
1 parent 70e6786 commit 408642b

File tree

10 files changed

+41
-35
lines changed

10 files changed

+41
-35
lines changed
 

‎application/src/main/java/ParserCode/Expression.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ public Object yyparse(yyInput yyLex) throws java.io.IOException, yyException {
366366
if (yyMax <= 0) yyMax = 256; // initial size
367367
int yyState = 0; // state stack
368368
int[] yyStates = new int[yyMax];
369-
Object yyVal = null; // value stack
369+
Object yyVal = null; // value stack
370370
Object[] yyVals = new Object[yyMax];
371371
int yyToken = -1; // current input
372372
int yyErrorFlag = 0; // #tokens to shift

‎application/src/main/java/Peditor/PropertyEditor.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -234,8 +234,9 @@ public void mousePressed(java.awt.event.MouseEvent evt) {
234234
frm.init();
235235
frm.setVisible(true);
236236
if (CustomColorPicker.result) {
237-
setValue(CustomColorPicker.modus, CustomColorPicker.p1, CustomColorPicker.p2, CustomColorPicker.color1, CustomColorPicker.color2, CustomColorPicker.color1Transparency,
238-
CustomColorPicker.color2Transparency, CustomColorPicker.wiederholung);
237+
setValue(CustomColorPicker.modus, CustomColorPicker.p1, CustomColorPicker.p2,
238+
CustomColorPicker.color1, CustomColorPicker.color2, CustomColorPicker.color1Transparency,
239+
CustomColorPicker.color2Transparency, CustomColorPicker.wiederholung);
239240
}
240241
// Color bgColor =
241242
// JColorChooser.showDialog(getFrame(),java.util.ResourceBundle.getBundle("Peditor/PropertyEditor").getString("Choose

‎application/src/main/java/VisualLogic/FrameMain.java

+10-5
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,8 @@ public void projectPaletteNewSubVM(MyNode node) {
547547
Tools.copy(new File(elementPath + File.separator + "nope.html"),
548548
new File(dir + File.separator + "doc_es.html"));
549549

550-
Tools.copy(new File(elementPath + "/element.gif"), new File(dir + "/" + DialogSubVMAssistent.vmName + ".gif"));
550+
Tools.copy(new File(elementPath + "/element.gif"),
551+
new File(dir + "/" + DialogSubVMAssistent.vmName + ".gif"));
551552
// Tools.copy(new File(elementPath + File.separator+"element.gif"), new File(dir +
552553
// File.separator + frm.vmName + ".gif"));
553554
} catch (IOException ex) {
@@ -556,7 +557,8 @@ public void projectPaletteNewSubVM(MyNode node) {
556557
// File file = new File(dir + File.separator+"subvm.vlogic");
557558
File file = new File(dir + "/" + "subvm.vlogic");
558559

559-
generateSubVM(node.projectPath, DialogSubVMAssistent.pinsLeft, DialogSubVMAssistent.pinsRight, dir + "/" + DialogSubVMAssistent.vmName + ".vlogic");
560+
generateSubVM(node.projectPath, DialogSubVMAssistent.pinsLeft, DialogSubVMAssistent.pinsRight,
561+
dir + "/" + DialogSubVMAssistent.vmName + ".vlogic");
560562
// generateSubVM(node.projectPath, frm.pinsLeft, frm.pinsRight, dir + File.separator + frm.vmName +
561563
// ".vlogic");
562564

@@ -3793,9 +3795,11 @@ private void jmniCreateNewJavaComponentActionPerformed(java.awt.event.ActionEven
37933795
// String binDir = grp + "/" + frm.compName + "/bin";
37943796
String basisDir = grp + File.separator + DialogNewJavaComponentAssistent.compName;
37953797
// String srcDir = grp + File.separator + frm.compName + "/src";
3796-
String srcDir = grp + File.separator + DialogNewJavaComponentAssistent.compName + File.separator + "src";
3798+
String srcDir =
3799+
grp + File.separator + DialogNewJavaComponentAssistent.compName + File.separator + "src";
37973800
// String binDir = grp + File.separator + frm.compName + "/bin";
3798-
String binDir = grp + File.separator + DialogNewJavaComponentAssistent.compName + File.separator + "bin";
3801+
String binDir =
3802+
grp + File.separator + DialogNewJavaComponentAssistent.compName + File.separator + "bin";
37993803

38003804
// String str = grp + "/" + frm.compName;
38013805
String str = grp + File.separator + DialogNewJavaComponentAssistent.compName;
@@ -5462,7 +5466,8 @@ private void jmiNewProjectActionPerformed(java.awt.event.ActionEvent evt)// GEN-
54625466
projectName = projectName.replace("\\", File.separator);
54635467
projectName = projectName.replace("/", File.separator);
54645468

5465-
createNewProject(projectName, DialogNewProject.createMainVM, DialogNewProject.mainVMFilename, DialogNewProject.projectType);
5469+
createNewProject(projectName, DialogNewProject.createMainVM, DialogNewProject.mainVMFilename,
5470+
DialogNewProject.projectType);
54665471
projects.add(projectName);
54675472
reloadProjectPanel();
54685473
} else {

‎application/src/main/java/codeeditor/DialogSearch.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@
2020

2121
package codeeditor;
2222

23-
import VisualLogic.CommandIF;
24-
2523
import java.awt.event.KeyEvent;
2624

25+
import VisualLogic.CommandIF;
26+
2727
/**
2828
* @author Carmelo
2929
*/

‎application/src/main/java/com/github/mylibrelab/ui/settings/SettingsPanel.java

+13-12
Original file line numberDiff line numberDiff line change
@@ -188,19 +188,20 @@ public void resetAll() {
188188
@Override
189189
public final void eventDispatched(final AWTEvent event) {
190190
if (!isVisible()) return;
191-
switch (event.getID()) {
192-
case MouseEvent.MOUSE_PRESSED, MouseEvent.MOUSE_RELEASED, MouseEvent.MOUSE_DRAGGED -> {
193-
MouseEvent me = (MouseEvent) event;
194-
if (SwingUtilities.isDescendingFrom(me.getComponent(), containers.get(currentContainer))
195-
|| isPopupOverEditor(me.getComponent())) {
196-
requestUpdate();
197-
}
191+
int id = event.getID();
192+
if (id == MouseEvent.MOUSE_PRESSED
193+
|| id == MouseEvent.MOUSE_RELEASED
194+
|| id == MouseEvent.MOUSE_DRAGGED) {
195+
MouseEvent me = (MouseEvent) event;
196+
if (SwingUtilities.isDescendingFrom(me.getComponent(), containers.get(currentContainer))
197+
|| isPopupOverEditor(me.getComponent())) {
198+
requestUpdate();
198199
}
199-
case KeyEvent.KEY_PRESSED, KeyEvent.KEY_RELEASED -> {
200-
KeyEvent ke = (KeyEvent) event;
201-
if (SwingUtilities.isDescendingFrom(ke.getComponent(), containers.get(currentContainer))) {
202-
requestUpdate();
203-
}
200+
} else if (id == KeyEvent.KEY_PRESSED
201+
|| id == KeyEvent.KEY_RELEASED) {
202+
KeyEvent ke = (KeyEvent) event;
203+
if (SwingUtilities.isDescendingFrom(ke.getComponent(), containers.get(currentContainer))) {
204+
requestUpdate();
204205
}
205206
}
206207
}

‎application/src/main/java/create_new_group/Dialog_create_new_group.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
import java.io.FileNotFoundException;
2828
import java.io.IOException;
2929
import java.io.PrintWriter;
30-
import java.io.UnsupportedEncodingException;
3130
import java.nio.charset.StandardCharsets;
3231
import java.text.DateFormat;
3332
import java.text.ParseException;
@@ -797,7 +796,7 @@ private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIR
797796
Logger.getLogger(Dialog_create_new_group.class.getName()).log(Level.SEVERE, null, ex);
798797
}
799798
}
800-
} catch (FileNotFoundException | UnsupportedEncodingException ex) {
799+
} catch (IOException ex) {
801800
Logger.getLogger(Dialog_create_new_group.class.getName()).log(Level.SEVERE, null, ex);
802801
} finally {
803802
writer.close();

‎application/src/main/java/de/myopenlab/update/frmUpdate.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -630,8 +630,8 @@ public frmUpdate() {
630630
}
631631

632632
jMenuItemUploadPackage.setEnabled(settings.getRepository_domain().trim().length() > 0
633-
&& settings.getRepository_login_username().trim().length() > 0
634-
&& settings.getRepository_login_password().trim().length() > 0);
633+
&& settings.getRepository_login_username().trim().length() > 0
634+
&& settings.getRepository_login_password().trim().length() > 0);
635635

636636
// Create a new trust manager that trust all certificates
637637
TrustManager[] trustAllCerts = new TrustManager[] {new X509TrustManager() {

‎settings-api/src/main/kotlin/com/github/mylibrelab/settings/api/Condition.kt

+3-3
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class ConstantCondition(value: Boolean) : Condition, Observable<Condition> by De
5252
class DefaultCondition(initial: Boolean, private val cond: () -> Boolean = { initial }) :
5353
Condition,
5454
Observable<Condition> by DefaultObservable() {
55-
override var value: Boolean by observable<Condition, Boolean>(initial)
55+
override var value: Boolean by observable(initial)
5656

5757
override operator fun invoke(): Boolean {
5858
value = cond()
@@ -66,7 +66,7 @@ class DefaultCondition(initial: Boolean, private val cond: () -> Boolean = { ini
6666
class LazyCondition<T : Any>(private val valueProp: Lazy<ValueProperty<T>>, private val expected: T) :
6767
Condition,
6868
Observable<Condition> by DefaultObservable() {
69-
override var value: Boolean by observable<Condition, Boolean>(true)
69+
override var value: Boolean by observable(true)
7070

7171
override fun invoke(): Boolean {
7272
return value
@@ -87,7 +87,7 @@ class CompoundCondition(
8787
private val second: Condition,
8888
private val combinator: (Boolean, Boolean) -> Boolean
8989
) : Condition, Observable<Condition> by first {
90-
override var value: Boolean by observable<Condition, Boolean>(combinator(first.value, second.value))
90+
override var value: Boolean by observable(combinator(first.value, second.value))
9191

9292
override fun invoke(): Boolean {
9393
value = combinator(first(), second())

‎settings-api/src/main/kotlin/com/github/mylibrelab/settings/api/Properties.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ inline fun <reified T, R : Any> KMutableProperty0<R>.withType(): KMutablePropert
4040
/**
4141
* Cast the property to the specified type if applicable for read operations.
4242
*/
43-
inline fun <reified T, R : Any> KMutableProperty0<R>.withOutType(): KMutableProperty0<T>? {
43+
inline fun <reified T, R : Any> KMutableProperty0<R>.withOutType(): KProperty0<T>? {
4444
return if (T::class.java.isAssignableFrom(get().javaClass)) {
45-
this.castSafelyTo<KMutableProperty0<T>>()
45+
this.castSafelyTo<KProperty0<T>>()
4646
} else {
4747
null
4848
}

‎settings-api/src/main/kotlin/com/github/mylibrelab/settings/api/SettingsBuilder.kt

+4-4
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ inline fun <reified T : Any> ValueProperty<T>.asPersistent(): PersistentValuePro
250250
if (it.value is String) it.castSafelyTo<PersistentValueProperty<T>>() else null
251251
}
252252

253-
inline fun <reified K : Any> ValueProperty<*>.effective(): ValueProperty<K> = effective<K>(type = K::class)
253+
inline fun <reified K : Any> ValueProperty<*>.effective(): ValueProperty<K> = effective(type = K::class)
254254

255255
fun <K : Any> ValueProperty<*>.effective(type: KClass<K>): ValueProperty<K> {
256256
var prop: ValueProperty<*> = this
@@ -273,8 +273,8 @@ class SimpleValueProperty<T : Any> internal constructor(
273273
) : ValueProperty<T>, Observable<ValueProperty<T>> by DefaultObservable() {
274274
override val displayName: Text = displayName ?: textOf(property.name)
275275
override val name: String = name ?: property.name
276-
override var value: T by observable<ValueProperty<T>, T>(property)
277-
override var preview: T by observable<ValueProperty<T>, T>(value)
276+
override var value: T by observable(property)
277+
override var preview: T by observable(value)
278278
override var activeCondition: Condition = conditionOf(true)
279279

280280
init {
@@ -294,7 +294,7 @@ open class SimpleTransformingValueProperty<R : Any, T : Any> internal constructo
294294
override val group by backingProperty::group
295295

296296
final override var value: T by transformer.delegate(backingProp = backingProperty::value)
297-
override var preview: T by observable<ValueProperty<T>, T>(value)
297+
override var preview: T by observable(value)
298298
}
299299

300300
class SimplePersistentValueProperty<R : Any>(

0 commit comments

Comments
 (0)
Please sign in to comment.