Skip to content
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -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)",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<String> filesToOpen = new ArrayList<>(1);
private ArrayList<Event> urlsToOpen = new ArrayList<>(1);
private final ArrayList<String> filesToOpen = new ArrayList<>(1);
private final ArrayList<Event> urlsToOpen = new ArrayList<>(1);

/**
* Constructor.
Expand All @@ -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) {
Expand All @@ -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
Expand Down Expand Up @@ -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);
Expand All @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
}

Expand Down Expand Up @@ -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$
}

Expand Down Expand Up @@ -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();
}
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
};

/**
Expand Down Expand Up @@ -298,8 +299,9 @@ protected void activateProxyService() {
Object proxyService = null;
if (bundle != null) {
ServiceReference<IProxyService> 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$
Expand All @@ -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;

Expand Down Expand Up @@ -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()
Expand All @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -681,14 +684,17 @@ protected Map<String, AboutInfo> 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);
}

Expand Down Expand Up @@ -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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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);
Expand Down
Loading