Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#1296] NPE during IssueLicenseDialog initialization #1297

Merged
merged 1 commit into from
Feb 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
[#1296] NPE during IssueLicenseDialog initialization
eparovyshnaya committed Feb 26, 2024

Verified

This commit was signed with the committer’s verified signature.
commit 50fc7535f571ea9779df59ce12a9f9ab380ae828
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2020, 2021 ArSysOp
* Copyright (c) 2020, 2024 ArSysOp
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
@@ -9,6 +9,7 @@
*
* Contributors:
* ArSysOp - initial API and implementation
* ArSysOp - further support
*******************************************************************************/
package org.eclipse.passage.loc.dashboard.ui.wizards.license;

@@ -29,7 +30,7 @@
protected final Runnable modified;
protected final LabelProvider labels;
protected final MandatoryService context;
protected Control widget;
private Optional<Control> widget = Optional.empty();

Check warning on line 33 in bundles/org.eclipse.passage.loc.dashboard.ui/src/org/eclipse/passage/loc/dashboard/ui/wizards/license/LabeledField.java

Codecov / codecov/patch

bundles/org.eclipse.passage.loc.dashboard.ui/src/org/eclipse/passage/loc/dashboard/ui/wizards/license/LabeledField.java#L33

Added line #L33 was not covered by tests
private Shell shell;
private Label label;

@@ -44,14 +45,14 @@
public final void installControll(Composite parent) {
shell = parent.getShell();
installLabel(parent);
widget = control(parent);
widget = Optional.of(control(parent));

Check warning on line 48 in bundles/org.eclipse.passage.loc.dashboard.ui/src/org/eclipse/passage/loc/dashboard/ui/wizards/license/LabeledField.java

Codecov / codecov/patch

bundles/org.eclipse.passage.loc.dashboard.ui/src/org/eclipse/passage/loc/dashboard/ui/wizards/license/LabeledField.java#L48

Added line #L48 was not covered by tests
installData(source);
}

@SuppressWarnings("unchecked")
@Override
public final Optional<T> data() {
return Optional.ofNullable(widget).flatMap(w -> Optional.ofNullable((T) w.getData()));
return widget.flatMap(w -> Optional.ofNullable((T) w.getData()));

Check warning on line 55 in bundles/org.eclipse.passage.loc.dashboard.ui/src/org/eclipse/passage/loc/dashboard/ui/wizards/license/LabeledField.java

Codecov / codecov/patch

bundles/org.eclipse.passage.loc.dashboard.ui/src/org/eclipse/passage/loc/dashboard/ui/wizards/license/LabeledField.java#L55

Added line #L55 was not covered by tests
}

private void installLabel(Composite parent) {
@@ -62,7 +63,7 @@

protected final void installData(Optional<T> origin) {
origin.ifPresent(data -> {
widget.setData(data);
widget.ifPresent(w -> w.setData(data));

Check warning on line 66 in bundles/org.eclipse.passage.loc.dashboard.ui/src/org/eclipse/passage/loc/dashboard/ui/wizards/license/LabeledField.java

Codecov / codecov/patch

bundles/org.eclipse.passage.loc.dashboard.ui/src/org/eclipse/passage/loc/dashboard/ui/wizards/license/LabeledField.java#L66

Added line #L66 was not covered by tests
reflectData(data);
});
}
@@ -73,13 +74,14 @@

@Override
public final Optional<String> errorIfAny() {
return widget.isEnabled() ? error() : Optional.empty();
boolean enabled = widget.map(Control::isEnabled).orElse(false);

Check warning on line 77 in bundles/org.eclipse.passage.loc.dashboard.ui/src/org/eclipse/passage/loc/dashboard/ui/wizards/license/LabeledField.java

Codecov / codecov/patch

bundles/org.eclipse.passage.loc.dashboard.ui/src/org/eclipse/passage/loc/dashboard/ui/wizards/license/LabeledField.java#L77

Added line #L77 was not covered by tests
return enabled ? error() : Optional.empty();
}

@Override
public final void enable(boolean enable) {
label.setEnabled(enable);
widget.setEnabled(enable);
widget.ifPresent(w -> w.setEnabled(enable));

Check warning on line 84 in bundles/org.eclipse.passage.loc.dashboard.ui/src/org/eclipse/passage/loc/dashboard/ui/wizards/license/LabeledField.java

Codecov / codecov/patch

bundles/org.eclipse.passage.loc.dashboard.ui/src/org/eclipse/passage/loc/dashboard/ui/wizards/license/LabeledField.java#L84

Added line #L84 was not covered by tests
enableAuxiliaryControls(enable);
}