diff --git a/bundles/org.eclipse.ui.ide.application/META-INF/MANIFEST.MF b/bundles/org.eclipse.ui.ide.application/META-INF/MANIFEST.MF index 161698f8d9a..8e8ed96585b 100644 --- a/bundles/org.eclipse.ui.ide.application/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.ui.ide.application/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %Plugin.name Bundle-SymbolicName: org.eclipse.ui.ide.application;singleton:=true -Bundle-Version: 1.5.800.qualifier +Bundle-Version: 1.5.900.qualifier Bundle-Vendor: %Plugin.providerName Bundle-Localization: plugin Require-Bundle: org.eclipse.ui.ide;bundle-version="[3.21.0,4.0.0)", diff --git a/bundles/org.eclipse.ui.ide.application/src/org/eclipse/ui/internal/ide/application/DelayedEventsProcessor.java b/bundles/org.eclipse.ui.ide.application/src/org/eclipse/ui/internal/ide/application/DelayedEventsProcessor.java index 2db6efa2dad..d6b2a6c0577 100644 --- a/bundles/org.eclipse.ui.ide.application/src/org/eclipse/ui/internal/ide/application/DelayedEventsProcessor.java +++ b/bundles/org.eclipse.ui.ide.application/src/org/eclipse/ui/internal/ide/application/DelayedEventsProcessor.java @@ -78,8 +78,8 @@ public class DelayedEventsProcessor implements Listener { private static final String TEXTEDITOR_BUNDLE_NAME = "org.eclipse.ui.workbench.texteditor"; //$NON-NLS-1$ private static final String TEXTEDITOR_CLASS_NAME = "org.eclipse.ui.texteditor.ITextEditor"; //$NON-NLS-1$ - private ArrayList filesToOpen = new ArrayList<>(1); - private ArrayList urlsToOpen = new ArrayList<>(1); + private final ArrayList filesToOpen = new ArrayList<>(1); + private final ArrayList urlsToOpen = new ArrayList<>(1); /** * Constructor. @@ -94,8 +94,9 @@ public DelayedEventsProcessor(Display display) { @Override public void handleEvent(Event event) { final String path = event.text; - if (path == null) + if (path == null) { return; + } // If we start supporting events that can arrive on a non-UI thread, the // following lines will need to be in a "synchronized" block: if (event.type == SWT.OpenUrl) { @@ -111,8 +112,9 @@ public void handleEvent(Event event) { * @param display display associated with the workbench */ public void catchUp(Display display) { - if (filesToOpen.isEmpty() && urlsToOpen.isEmpty()) + if (filesToOpen.isEmpty() && urlsToOpen.isEmpty()) { return; + } // If we start supporting events that can arrive on a non-UI thread, the // following @@ -195,8 +197,9 @@ public static void openFile(Display display, final String initialPath) { @Override public void run() { IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); - if (window == null) + if (window == null) { return; + } FileLocationDetails details = FileLocationDetails.resolve(initialPath); if (details == null || !details.fileInfo.exists()) { String msg = NLS.bind(IDEWorkbenchMessages.OpenDelayedFileAction_message_fileNotFound, initialPath); @@ -214,8 +217,9 @@ public void run() { } Shell shell = window.getShell(); if (shell != null) { - if (shell.getMinimized()) + if (shell.getMinimized()) { shell.setMinimized(false); + } shell.forceActive(); } try { diff --git a/bundles/org.eclipse.ui.ide.application/src/org/eclipse/ui/internal/ide/application/IDEApplication.java b/bundles/org.eclipse.ui.ide.application/src/org/eclipse/ui/internal/ide/application/IDEApplication.java index 0a8aadbea01..de109fddcea 100644 --- a/bundles/org.eclipse.ui.ide.application/src/org/eclipse/ui/internal/ide/application/IDEApplication.java +++ b/bundles/org.eclipse.ui.ide.application/src/org/eclipse/ui/internal/ide/application/IDEApplication.java @@ -201,8 +201,9 @@ public Object start(IApplicationContext appContext) throws Exception { display.dispose(); } Location instanceLoc = Platform.getInstanceLocation(); - if (instanceLoc != null) + if (instanceLoc != null) { instanceLoc.release(); + } } } @@ -562,8 +563,9 @@ private static Path createLockInfoFile(URL workspaceUrl) throws Exception { @SuppressWarnings("rawtypes") private static boolean isDevLaunchMode(Map args) { // see org.eclipse.pde.internal.core.PluginPathFinder.isDevLaunchMode() - if (Boolean.getBoolean("eclipse.pde.launch")) //$NON-NLS-1$ + if (Boolean.getBoolean("eclipse.pde.launch")) { //$NON-NLS-1$ return true; + } return args.containsKey("-pdelaunch"); //$NON-NLS-1$ } @@ -917,12 +919,14 @@ protected static Version toMajorMinorVersion(Version version) { @Override public void stop() { final IWorkbench workbench = PlatformUI.getWorkbench(); - if (workbench == null) + if (workbench == null) { return; + } final Display display = workbench.getDisplay(); display.syncExec(() -> { - if (!display.isDisposed()) + if (!display.isDisposed()) { workbench.close(); + } }); } } diff --git a/bundles/org.eclipse.ui.ide.application/src/org/eclipse/ui/internal/ide/application/IDEWorkbenchAdvisor.java b/bundles/org.eclipse.ui.ide.application/src/org/eclipse/ui/internal/ide/application/IDEWorkbenchAdvisor.java index 3d3a770372f..2596b516f4e 100644 --- a/bundles/org.eclipse.ui.ide.application/src/org/eclipse/ui/internal/ide/application/IDEWorkbenchAdvisor.java +++ b/bundles/org.eclipse.ui.ide.application/src/org/eclipse/ui/internal/ide/application/IDEWorkbenchAdvisor.java @@ -160,8 +160,9 @@ public class IDEWorkbenchAdvisor extends WorkbenchAdvisor { private final Listener closeListener = event -> { boolean doExit = IDEWorkbenchWindowAdvisor.promptOnExit(null); event.doit = doExit; - if (!doExit) + if (!doExit) { event.type = SWT.None; + } }; /** @@ -298,8 +299,9 @@ protected void activateProxyService() { Object proxyService = null; if (bundle != null) { ServiceReference ref = bundle.getBundleContext().getServiceReference(IProxyService.class); - if (ref != null) + if (ref != null) { proxyService = bundle.getBundleContext().getService(ref); + } } if (proxyService == null) { IDEWorkbenchPlugin.log("Proxy service could not be found."); //$NON-NLS-1$ @@ -317,8 +319,9 @@ protected void initializeSettingsChangeListener() { @Override public void handleEvent(org.eclipse.swt.widgets.Event event) { - if (Display.getCurrent().getHighContrast() == currentHighContrast) + if (Display.getCurrent().getHighContrast() == currentHighContrast) { return; + } currentHighContrast = !currentHighContrast; @@ -444,8 +447,7 @@ protected void refreshFromLocal() { // We should try to use RefreshManager which avoids multiple refresh requests // for same objects - if (workspace instanceof Workspace) { - Workspace wsp = (Workspace) workspace; + if (workspace instanceof Workspace wsp) { if (!wsp.isCrashed()) { // Only refresh if no crash happened before: the workspace itself // triggers refresh in that case, see Workspace.open() @@ -467,7 +469,7 @@ public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException { protected static class CancelableProgressMonitorWrapper extends ProgressMonitorWrapper { private double total = 0; - private ProgressMonitorJobsDialog dialog; + private final ProgressMonitorJobsDialog dialog; CancelableProgressMonitorWrapper(IProgressMonitor monitor, ProgressMonitorJobsDialog dialog) { @@ -549,8 +551,9 @@ protected void disconnectFromWorkspace() { IRunnableWithProgress runnable = monitor -> { try { - if (applyPolicy) + if (applyPolicy) { monitor = new CancelableProgressMonitorWrapper(monitor, p); + } status.merge(((Workspace) ResourcesPlugin.getWorkspace()).save(true, true, monitor)); } catch (CoreException e) { @@ -681,14 +684,17 @@ protected Map createNewBundleGroupsMap() { protected static void setWorkspaceNameDefault() { IPreferenceStore preferences = IDEWorkbenchPlugin.getDefault().getPreferenceStore(); String workspaceNameDefault = preferences.getDefaultString(IDEInternalPreferences.WORKSPACE_NAME); - if (workspaceNameDefault != null && !workspaceNameDefault.isEmpty()) + if (workspaceNameDefault != null && !workspaceNameDefault.isEmpty()) { return; // Default is set in a plugin customization file - don't change it. + } IPath workspaceDir = Platform.getLocation(); - if (workspaceDir == null) + if (workspaceDir == null) { return; + } String workspaceName = workspaceDir.lastSegment(); - if (workspaceName == null) + if (workspaceName == null) { return; + } preferences.setDefault(IDEInternalPreferences.WORKSPACE_NAME, workspaceName); } @@ -970,8 +976,9 @@ public synchronized AbstractStatusHandler getWorkbenchErrorHandler() { @Override public void eventLoopIdle(Display display) { - if (delayedEventsProcessor != null) + if (delayedEventsProcessor != null) { delayedEventsProcessor.catchUp(display); + } super.eventLoopIdle(display); } } diff --git a/bundles/org.eclipse.ui.ide.application/src/org/eclipse/ui/internal/ide/application/IDEWorkbenchWindowAdvisor.java b/bundles/org.eclipse.ui.ide.application/src/org/eclipse/ui/internal/ide/application/IDEWorkbenchWindowAdvisor.java index 075201610d9..0c59b9f9fd2 100644 --- a/bundles/org.eclipse.ui.ide.application/src/org/eclipse/ui/internal/ide/application/IDEWorkbenchWindowAdvisor.java +++ b/bundles/org.eclipse.ui.ide.application/src/org/eclipse/ui/internal/ide/application/IDEWorkbenchWindowAdvisor.java @@ -97,15 +97,15 @@ public class IDEWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor { private static final String WELCOME_EDITOR_ID = "org.eclipse.ui.internal.ide.dialogs.WelcomeEditor"; //$NON-NLS-1$ - private IDEWorkbenchAdvisor wbAdvisor; + private final IDEWorkbenchAdvisor wbAdvisor; private boolean editorsAndIntrosOpened = false; private IEditorPart lastActiveEditor = null; private IPerspectiveDescriptor lastPerspective = null; private IWorkbenchPage lastActivePage; - private String lastEditorTitleTooltip = ""; //$NON-NLS-1$ + private final String lastEditorTitleTooltip = ""; //$NON-NLS-1$ - private IPropertyListener editorPropertyListener = (source, propId) -> { + private final IPropertyListener editorPropertyListener = (source, propId) -> { if (propId == IWorkbenchPartConstants.PROP_TITLE) { if (lastActiveEditor != null) { String newTitle = lastActiveEditor.getTitleToolTip(); @@ -125,7 +125,7 @@ public class IDEWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor { */ private IPropertyChangeListener propertyChangeListener; - private TitlePathUpdater titlePathUpdater; + private final TitlePathUpdater titlePathUpdater; /** * Crates a new IDE workbench window advisor. diff --git a/bundles/org.eclipse.ui.ide.application/src/org/eclipse/ui/internal/ide/application/dialogs/UriSchemeHandlerPreferencePage.java b/bundles/org.eclipse.ui.ide.application/src/org/eclipse/ui/internal/ide/application/dialogs/UriSchemeHandlerPreferencePage.java index 819a0fa68cc..4ac8c81c761 100644 --- a/bundles/org.eclipse.ui.ide.application/src/org/eclipse/ui/internal/ide/application/dialogs/UriSchemeHandlerPreferencePage.java +++ b/bundles/org.eclipse.ui.ide.application/src/org/eclipse/ui/internal/ide/application/dialogs/UriSchemeHandlerPreferencePage.java @@ -344,8 +344,7 @@ public Image getColumnImage(Object element, int columnIndex) { @Override public String getColumnText(Object element, int columnIndex) { - if (element instanceof UiSchemeInformation) { - UiSchemeInformation schemeInfo = (UiSchemeInformation) element; + if (element instanceof UiSchemeInformation schemeInfo) { switch (columnIndex) { case 0: return schemeInfo.getName(); @@ -354,9 +353,9 @@ public String getColumnText(Object element, int columnIndex) { return schemeInfo.getDescription(); case 2: String text = ""; //$NON-NLS-1$ - if (UrlHandlerPreferencePage_LoadingText.equals(schemeInfo.getHandlerInstanceLocation())) + if (UrlHandlerPreferencePage_LoadingText.equals(schemeInfo.getHandlerInstanceLocation())) { text = schemeInfo.getHandlerInstanceLocation(); - else if (schemeInfo.isChecked()) { + } else if (schemeInfo.isChecked()) { text = UrlHandlerPreferencePage_Column_Handler_Text_Current_Application; } else if (schemeInfo.information.schemeIsHandledByOther()) { text = UrlHandlerPreferencePage_Column_Handler_Text_Other_Application; @@ -377,7 +376,7 @@ public boolean isLabelProperty(Object element, String property) { static class UiSchemeInformation { private boolean checked; - private ISchemeInformation information; + private final ISchemeInformation information; public UiSchemeInformation(boolean checked, ISchemeInformation information) { this.checked = checked; @@ -403,7 +402,7 @@ public boolean isChecked() { static final class LoadingSchemeInformation extends UiSchemeInformation { - private IScheme scheme; + private final IScheme scheme; public LoadingSchemeInformation(IScheme scheme) { super(false, null);