Skip to content

Commit e570744

Browse files
eclipse-platform-botakurtakov
authored andcommitted
Perform clean code of terminal/bundles/org.eclipse.terminal.view.ui
1 parent e5a0bb2 commit e570744

33 files changed

+345
-189
lines changed

terminal/bundles/org.eclipse.terminal.view.ui/src/org/eclipse/terminal/view/ui/actions/InvertColorsAction.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,9 @@ public InvertColorsAction(TabFolderManager tabFolderManager) {
4141
@Override
4242
public void run() {
4343
ITerminalViewControl target = getTarget();
44-
if (target == null)
44+
if (target == null) {
4545
return;
46+
}
4647
target.setInvertedColors(!target.isInvertedColors());
4748
}
4849

terminal/bundles/org.eclipse.terminal.view.ui/src/org/eclipse/terminal/view/ui/actions/RenameTerminalAction.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,9 @@ public RenameTerminalAction(TabFolderManager tabFolderManager) {
4242
@Override
4343
public void run() {
4444
ITerminalViewControl target = getTarget();
45-
if (target == null)
45+
if (target == null) {
4646
return;
47+
}
4748
InputDialog inputDialog = new InputDialog(target.getControl().getShell(), //
4849
Messages.RenameTerminalAction_inputdialog_title, //
4950
Messages.RenameTerminalAction_inputdialog_prompt, //

terminal/bundles/org.eclipse.terminal.view.ui/src/org/eclipse/terminal/view/ui/actions/SelectEncodingAction.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,9 @@ public SelectEncodingAction(TabFolderManager tabFolderManager) {
4747
@Override
4848
public void run() {
4949
ITerminalViewControl target = getTarget();
50-
if (target == null)
50+
if (target == null) {
5151
return;
52+
}
5253

5354
EncodingSelectionDialog dialog = new EncodingSelectionDialog(null);
5455
dialog.setCharset(target.getCharset());

terminal/bundles/org.eclipse.terminal.view.ui/src/org/eclipse/terminal/view/ui/activator/UIPlugin.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,9 @@ public boolean preShutdown(IWorkbench workbench, boolean forced) {
143143
// Loop the tab items and find the still connected ones
144144
for (CTabItem item : items) {
145145
// Ignore disposed items
146-
if (item.isDisposed())
146+
if (item.isDisposed()) {
147147
continue;
148+
}
148149
// Get the terminal view control
149150
ITerminalViewControl terminal = (ITerminalViewControl) item.getData();
150151
if (terminal == null || terminal.getState() != TerminalState.CONNECTED) {
@@ -158,8 +159,9 @@ public boolean preShutdown(IWorkbench workbench, boolean forced) {
158159
// Push the determined saveable items to the memento handler
159160
TerminalsViewMementoHandler mementoHandler = ((TerminalsView) part)
160161
.getAdapter(TerminalsViewMementoHandler.class);
161-
if (mementoHandler != null)
162+
if (mementoHandler != null) {
162163
mementoHandler.setSaveables(saveables);
164+
}
163165
}
164166
}
165167
}
@@ -183,8 +185,9 @@ public void postShutdown(IWorkbench workbench) {
183185
void activateContexts() {
184186
if (Display.getCurrent() != null) {
185187
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
186-
if (window != null && windowListener != null)
188+
if (window != null && windowListener != null) {
187189
windowListener.windowOpened(window);
190+
}
188191
} else {
189192
PlatformUI.getWorkbench().getDisplay().asyncExec(() -> activateContexts());
190193
}
@@ -267,8 +270,9 @@ public static void log(IStatus status) {
267270

268271
public static boolean isOptionEnabled(String strOption) {
269272
String strEnabled = Platform.getDebugOption(strOption);
270-
if (strEnabled == null)
273+
if (strEnabled == null) {
271274
return false;
275+
}
272276

273277
return Boolean.parseBoolean(strEnabled);
274278
}

terminal/bundles/org.eclipse.terminal.view.ui/src/org/eclipse/terminal/view/ui/controls/ConfigurationPanelControl.java

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,9 @@ public void setupPanel(Composite parent, String[] configurationPanelKeys) {
145145

146146
if (isPanelIsGroup()) {
147147
panel = new Group(parent, SWT.NONE);
148-
if (getGroupLabel() != null)
148+
if (getGroupLabel() != null) {
149149
((Group) panel).setText(getGroupLabel());
150+
}
150151
} else {
151152
panel = new Composite(parent, SWT.NONE);
152153
}
@@ -208,8 +209,9 @@ public final boolean isEmptyConfigurationPanel(IConfigurationPanel panel) {
208209
* @param panel The configuration panel instance or <code>null</code>.
209210
*/
210211
public void addConfigurationPanel(String key, IConfigurationPanel panel) {
211-
if (key == null)
212+
if (key == null) {
212213
return;
214+
}
213215
if (panel != null) {
214216
configurationPanels.put(key, panel);
215217
} else {
@@ -252,17 +254,19 @@ public void showConfigurationPanel(String key) {
252254
}
253255
IConfigurationPanel configPanel = getActiveConfigurationPanel();
254256
Map<String, Object> data = new HashMap<>();
255-
if (configPanel != null)
257+
if (configPanel != null) {
256258
configPanel.extractData(data);
259+
}
257260
configPanel = getConfigurationPanel(key);
258261
Assert.isNotNull(configPanel);
259262
if (configPanel.getControl() != null) {
260263
activeConfigurationPanel = configPanel;
261264
activeConfigurationPanelKey = key;
262265
panelLayout.topControl = configPanel.getControl();
263266
panel.layout();
264-
if (!data.isEmpty())
267+
if (!data.isEmpty()) {
265268
configPanel.updateData(data);
269+
}
266270
configPanel.activate();
267271
} else {
268272
activeConfigurationPanelKey = key;
@@ -343,8 +347,9 @@ public void doRestoreWidgetValues(IDialogSettings settings, String idPrefix) {
343347
IConfigurationPanel configPanel = getConfigurationPanel(panelKey);
344348
if (configPanel != null && !isEmptyConfigurationPanel(configPanel)) {
345349
IDialogSettings configPanelSettings = settings.getSection(panelKey);
346-
if (configPanelSettings == null)
350+
if (configPanelSettings == null) {
347351
configPanelSettings = settings.addNewSection(panelKey);
352+
}
348353
configPanel.doRestoreWidgetValues(configPanelSettings, idPrefix);
349354
}
350355
}
@@ -383,8 +388,9 @@ public void doSaveWidgetValues(IDialogSettings settings, String idPrefix) {
383388
if (configPanel != null && !isEmptyConfigurationPanel(configPanel)) {
384389
String key = getActiveConfigurationPanelKey();
385390
IDialogSettings configPanelSettings = settings.getSection(key);
386-
if (configPanelSettings == null)
391+
if (configPanelSettings == null) {
387392
configPanelSettings = settings.addNewSection(key);
393+
}
388394
configPanel.doSaveWidgetValues(configPanelSettings, idPrefix);
389395
}
390396
}

terminal/bundles/org.eclipse.terminal.view.ui/src/org/eclipse/terminal/view/ui/internal/ExternalExecutablesState.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
*/
2424
public class ExternalExecutablesState extends AbstractSourceProvider {
2525
public final static String CONFIGURED_STATE = "org.eclipse.terminal.external.executable.configured"; //$NON-NLS-1$
26-
private boolean enabled;
26+
private final boolean enabled;
2727

2828
public ExternalExecutablesState() {
2929
this.enabled = ExternalExecutablesManager.hasEntries();

terminal/bundles/org.eclipse.terminal.view.ui/src/org/eclipse/terminal/view/ui/internal/PropertyTester.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public class PropertyTester extends org.eclipse.core.expressions.PropertyTester
2929
public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
3030

3131
if ("hasApplicableLauncherDelegates".equals(property)) { //$NON-NLS-1$
32-
ISelection selection = receiver instanceof ISelection ? (ISelection) receiver
32+
ISelection selection = receiver instanceof ISelection i ? i
3333
: new StructuredSelection(receiver);
3434
return expectedValue.equals(Boolean.valueOf(
3535
LauncherDelegateManager.getInstance().getApplicableLauncherDelegates(selection).length > 0));

terminal/bundles/org.eclipse.terminal.view.ui/src/org/eclipse/terminal/view/ui/internal/SettingsStore.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,10 @@ public final String get(String key) {
5252
@Override
5353
public final void put(String key, String value) {
5454
Assert.isNotNull(key);
55-
if (value == null)
55+
if (value == null) {
5656
settings.remove(key);
57-
else
57+
} else {
5858
settings.put(key, value);
59+
}
5960
}
6061
}

terminal/bundles/org.eclipse.terminal.view.ui/src/org/eclipse/terminal/view/ui/internal/dialogs/EncodingSelectionDialog.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,9 @@ public void setDialogTitle(String title) {
184184
@Override
185185
protected void okPressed() {
186186
// Save the selected encoding
187-
if (encodingPanel != null)
187+
if (encodingPanel != null) {
188188
encoding = encodingPanel.getEncoding();
189+
}
189190
super.okPressed();
190191
}
191192

terminal/bundles/org.eclipse.terminal.view.ui/src/org/eclipse/terminal/view/ui/internal/dialogs/ErrorSettingsPanel.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
*/
2222
public class ErrorSettingsPanel extends AbstractConfigurationPanel {
2323

24-
private String errorMessage;
24+
private final String errorMessage;
2525

2626
/**
2727
* Constructor.

0 commit comments

Comments
 (0)