Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
BoykoAlex committed Oct 1, 2024
1 parent 17db235 commit 01ebb34
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2021 IBM Corporation and others.
* Copyright (c) 2000, 2024 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
Expand Down Expand Up @@ -965,11 +965,11 @@ public IPreferenceStore getCombinedPreferenceStore() {
return fCombinedPreferenceStore;
}
}

// Block below may init other bundles and shouldn't be executed with lock held
IPreferenceStore generalTextStore= EditorsUI.getPreferenceStore();
ChainedPreferenceStore store = new ChainedPreferenceStore(new IPreferenceStore[] { getPreferenceStore(), new PreferencesAdapter(getJavaCorePluginPreferences()), generalTextStore });

synchronized (this) {
if (fCombinedPreferenceStore == null) {
fCombinedPreferenceStore = store;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ public void widgetSelected(SelectionEvent e) {
fJRE50InfoText= new Link(infoComposite, SWT.WRAP);
fJRE50InfoText.setFont(composite.getFont());
// set a text: not the real one, just for layouting
String versionLabel= getVersionLabel(JavaCore.getAllJavaSourceVersionsSupportedByCompiler().get(0));
String versionLabel= getVersionLabel(JavaCore.getAllJavaSourceVersionsSupportedByCompiler().first());
fJRE50InfoText.setText(Messages.format(PreferencesMessages.ComplianceConfigurationBlock_jrecompliance_info_project, new String[] { versionLabel, versionLabel }));
fJRE50InfoText.setVisible(false);
fJRE50InfoText.addSelectionListener(new SelectionListener() {
Expand Down Expand Up @@ -825,7 +825,7 @@ private IStatus validateCompliance() {
String source= getValue(PREF_SOURCE_COMPATIBILITY);
String target= getValue(PREF_CODEGEN_TARGET_PLATFORM);

String firstSupported = JavaCore.getAllJavaSourceVersionsSupportedByCompiler().get(0);
String firstSupported = JavaCore.getAllJavaSourceVersionsSupportedByCompiler().first();

// compliance must be supported
if (JavaModelUtil.isVersionLessThan(compliance, firstSupported)) {
Expand Down Expand Up @@ -1106,8 +1106,8 @@ private void updateComplianceDefaultSettings(boolean rememberOld, String oldComp
} else {
enablePreview= DISABLED;
reportPreview= WARNING;
source= JavaCore.getAllJavaSourceVersionsSupportedByCompiler().get(0);
target= JavaCore.getAllJavaSourceVersionsSupportedByCompiler().get(0);
source= JavaCore.getAllJavaSourceVersionsSupportedByCompiler().first();
target= JavaCore.getAllJavaSourceVersionsSupportedByCompiler().first();
}
}
} else {
Expand Down Expand Up @@ -1200,7 +1200,7 @@ private String getComplianceFollowsEE(IExecutionEnvironment ee) {
if (options == null)
return DISABLED;
String complianceOption= options.get(JavaCore.COMPILER_COMPLIANCE);
if (JavaCore.compareJavaVersions(complianceOption, JavaCore.getAllJavaSourceVersionsSupportedByCompiler().get(0)) < 0) {
if (JavaCore.compareJavaVersions(complianceOption, JavaCore.getAllJavaSourceVersionsSupportedByCompiler().first()) < 0) {
return DISABLED;
} else if (JavaCore.compareJavaVersions(complianceOption, JavaCore.VERSION_10) > 0) {
return checkDefaults(PREFS_COMPLIANCE_11_OR_HIGHER, options);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
/*******************************************************************************
* Copyright (c) 2024 Broadcom Inc. and others.
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* - Alex Boyko (Broadcom Inc.) - Initial implementation
*******************************************************************************/
package org.eclipse.jdt.internal.ui.preferences;

import org.eclipse.jdt.ui.PreferenceConstants;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
/*******************************************************************************
* Copyright (c) 2024 Broadcom Inc. and others.
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* - Alex Boyko (Broadcom Inc.) - Initial implementation
*******************************************************************************/
package org.eclipse.jdt.ui.text.java;

import java.util.Collection;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -475,8 +475,8 @@ private void initializeJvmFields () {
fInstalledJVMs= getWorkspaceJREs();
Arrays.sort(fInstalledJVMs, (i0, i1) -> {
if (i1 instanceof IVMInstall2 && i0 instanceof IVMInstall2) {
String cc0= JavaModelUtil.getCompilerCompliance((IVMInstall2) i0, JavaCore.getAllJavaSourceVersionsSupportedByCompiler().get(0));
String cc1= JavaModelUtil.getCompilerCompliance((IVMInstall2) i1, JavaCore.getAllJavaSourceVersionsSupportedByCompiler().get(0));
String cc0= JavaModelUtil.getCompilerCompliance((IVMInstall2) i0, JavaCore.getAllJavaSourceVersionsSupportedByCompiler().first());
String cc1= JavaModelUtil.getCompilerCompliance((IVMInstall2) i1, JavaCore.getAllJavaSourceVersionsSupportedByCompiler().first());
int result= JavaCore.compareJavaVersions(cc1, cc0);
if (result != 0)
return result;
Expand Down

0 comments on commit 01ebb34

Please sign in to comment.