diff options
author | Karsten Thoms | 2020-11-13 19:55:45 +0000 |
---|---|---|
committer | Karsten Thoms | 2021-01-15 17:22:01 +0000 |
commit | 1ea3997919429ee91303051c814ade6ad0f65825 (patch) | |
tree | 2cd09d4f3564538e198093c1eee60b26a640e5e3 | |
parent | 2abcf7451cac96ef70f0667cb04b7251a8f4ea42 (diff) | |
download | eclipse.platform.ui-1ea3997919429ee91303051c814ade6ad0f65825.tar.gz eclipse.platform.ui-1ea3997919429ee91303051c814ade6ad0f65825.tar.xz eclipse.platform.ui-1ea3997919429ee91303051c814ade6ad0f65825.zip |
[cleanup] Combine nested 'if' within 'else' block to 'else if'I20210116-1800
Cleanup performed on bundles
- org.eclipse.ui.ide
Signed-off-by: Karsten Thoms <karsten.thoms@karakun.com>
Change-Id: I5a4bd766a171cfea4338ee099ad7114706d8f464
19 files changed, 187 insertions, 233 deletions
diff --git a/bundles/org.eclipse.ui.ide/extensions/org/eclipse/ui/actions/BuildAction.java b/bundles/org.eclipse.ui.ide/extensions/org/eclipse/ui/actions/BuildAction.java index 42d7add82ab..86138a893a9 100644 --- a/bundles/org.eclipse.ui.ide/extensions/org/eclipse/ui/actions/BuildAction.java +++ b/bundles/org.eclipse.ui.ide/extensions/org/eclipse/ui/actions/BuildAction.java @@ -320,10 +320,8 @@ public class BuildAction extends WorkspaceAction { if (IDEWorkbenchMessages.BuildAction_text.equals(getText())) { setText(IDEWorkbenchMessages.BuildAction_text_plural); } - } else { - if (IDEWorkbenchMessages.BuildAction_text_plural.equals(getText())) { - setText(IDEWorkbenchMessages.BuildAction_text); - } + } else if (IDEWorkbenchMessages.BuildAction_text_plural.equals(getText())) { + setText(IDEWorkbenchMessages.BuildAction_text); } return BuildUtilities.isEnabled(projects, IncrementalProjectBuilder.INCREMENTAL_BUILD); } diff --git a/bundles/org.eclipse.ui.ide/extensions/org/eclipse/ui/actions/CopyFilesAndFoldersOperation.java b/bundles/org.eclipse.ui.ide/extensions/org/eclipse/ui/actions/CopyFilesAndFoldersOperation.java index 40d494aff95..00826af7c1a 100644 --- a/bundles/org.eclipse.ui.ide/extensions/org/eclipse/ui/actions/CopyFilesAndFoldersOperation.java +++ b/bundles/org.eclipse.ui.ide/extensions/org/eclipse/ui/actions/CopyFilesAndFoldersOperation.java @@ -455,37 +455,35 @@ public class CopyFilesAndFoldersOperation { delete(existing, iterationMonitor.split(10)); resource.copy(destinationPath, IResource.SHALLOW, iterationMonitor.split(90)); } - } else { - if (existing != null) { - if (homogenousResources(resource, existing)) { - copyExisting(resource, existing, iterationMonitor.split(100)); - } else { - // Copying a linked resource over unlinked or vice - // versa. - // Can't use setContents here. Fixes bug 28772. - delete(existing, iterationMonitor.split(10)); - iterationMonitor.setWorkRemaining(100); - - if ((createLinks || createVirtualFoldersAndLinks) && (resource.isLinked() == false) - && (resource.isVirtual() == false)) { - if (resource.getType() == IResource.FILE) { - IFile file = workspaceRoot.getFile(destinationPath); - file.createLink(createRelativePath(resource.getLocationURI(), file), 0, + } else if (existing != null) { + if (homogenousResources(resource, existing)) { + copyExisting(resource, existing, iterationMonitor.split(100)); + } else { + // Copying a linked resource over unlinked or vice + // versa. + // Can't use setContents here. Fixes bug 28772. + delete(existing, iterationMonitor.split(10)); + iterationMonitor.setWorkRemaining(100); + + if ((createLinks || createVirtualFoldersAndLinks) && (resource.isLinked() == false) + && (resource.isVirtual() == false)) { + if (resource.getType() == IResource.FILE) { + IFile file = workspaceRoot.getFile(destinationPath); + file.createLink(createRelativePath(resource.getLocationURI(), file), 0, + iterationMonitor.split(100)); + } else { + IFolder folder = workspaceRoot.getFolder(destinationPath); + if (createVirtualFoldersAndLinks) { + folder.create(IResource.VIRTUAL, true, iterationMonitor.split(1)); + IResource[] members = ((IContainer) resource).members(); + if (members.length > 0) + copy(members, destinationPath, iterationMonitor.split(99)); + } else + folder.createLink(createRelativePath(resource.getLocationURI(), folder), 0, iterationMonitor.split(100)); - } else { - IFolder folder = workspaceRoot.getFolder(destinationPath); - if (createVirtualFoldersAndLinks) { - folder.create(IResource.VIRTUAL, true, iterationMonitor.split(1)); - IResource[] members = ((IContainer) resource).members(); - if (members.length > 0) - copy(members, destinationPath, iterationMonitor.split(99)); - } else - folder.createLink(createRelativePath(resource.getLocationURI(), folder), 0, - iterationMonitor.split(100)); - } - } else - resource.copy(destinationPath, IResource.SHALLOW, iterationMonitor.split(100)); - } + } + } else + resource.copy(destinationPath, IResource.SHALLOW, iterationMonitor.split(100)); } } } @@ -753,21 +751,19 @@ public class CopyFilesAndFoldersOperation { //check if resource linking is disabled if (ResourcesPlugin.getPlugin().getPluginPreferences().getBoolean(ResourcesPlugin.PREF_DISABLE_LINKING)) mode= ImportTypeDialog.IMPORT_COPY; - else { - if (dndPreference.equals(IDEInternalPreferences.IMPORT_FILES_AND_FOLDERS_MODE_PROMPT)) { - ImportTypeDialog dialog= new ImportTypeDialog(messageShell, dropOperation, fileNames, destination); - dialog.setResource(destination); - if (dialog.open() == Window.OK) { - mode= dialog.getSelection(); - variable= dialog.getVariable(); - } - } else if (dndPreference.equals(IDEInternalPreferences.IMPORT_FILES_AND_FOLDERS_MODE_MOVE_COPY)) { - mode= ImportTypeDialog.IMPORT_COPY; - } else if (dndPreference.equals(IDEInternalPreferences.IMPORT_FILES_AND_FOLDERS_MODE_LINK)) { - mode= ImportTypeDialog.IMPORT_LINK; - } else if (dndPreference.equals(IDEInternalPreferences.IMPORT_FILES_AND_FOLDERS_MODE_LINK_AND_VIRTUAL_FOLDER)) { - mode= ImportTypeDialog.IMPORT_VIRTUAL_FOLDERS_AND_LINKS; + else if (dndPreference.equals(IDEInternalPreferences.IMPORT_FILES_AND_FOLDERS_MODE_PROMPT)) { + ImportTypeDialog dialog= new ImportTypeDialog(messageShell, dropOperation, fileNames, destination); + dialog.setResource(destination); + if (dialog.open() == Window.OK) { + mode= dialog.getSelection(); + variable= dialog.getVariable(); } + } else if (dndPreference.equals(IDEInternalPreferences.IMPORT_FILES_AND_FOLDERS_MODE_MOVE_COPY)) { + mode= ImportTypeDialog.IMPORT_COPY; + } else if (dndPreference.equals(IDEInternalPreferences.IMPORT_FILES_AND_FOLDERS_MODE_LINK)) { + mode= ImportTypeDialog.IMPORT_LINK; + } else if (dndPreference.equals(IDEInternalPreferences.IMPORT_FILES_AND_FOLDERS_MODE_LINK_AND_VIRTUAL_FOLDER)) { + mode= ImportTypeDialog.IMPORT_VIRTUAL_FOLDERS_AND_LINKS; } switch (mode) { diff --git a/bundles/org.eclipse.ui.ide/extensions/org/eclipse/ui/actions/MoveFilesAndFoldersOperation.java b/bundles/org.eclipse.ui.ide/extensions/org/eclipse/ui/actions/MoveFilesAndFoldersOperation.java index 8062235ae1c..db4b51cb9f4 100644 --- a/bundles/org.eclipse.ui.ide/extensions/org/eclipse/ui/actions/MoveFilesAndFoldersOperation.java +++ b/bundles/org.eclipse.ui.ide/extensions/org/eclipse/ui/actions/MoveFilesAndFoldersOperation.java @@ -100,23 +100,21 @@ public class MoveFilesAndFoldersOperation extends CopyFilesAndFoldersOperation { resource.move(destinationPath, IResource.SHALLOW | IResource.KEEP_HISTORY, iterationMonitor.split(50)); } - } else { - // if we're merging folders, we could be overwriting an existing - // file - if (existing != null) { - if (homogenousResources(resource, existing)) { - moveExisting(resource, existing, iterationMonitor.split(100)); - } else { - // Moving a linked resource over unlinked or vice versa. - // Can't use setContents here. Fixes bug 28772. - delete(existing, iterationMonitor.split(50)); - resource.move(destinationPath, IResource.SHALLOW | IResource.KEEP_HISTORY, - iterationMonitor.split(50)); - } + } else // if we're merging folders, we could be overwriting an existing + // file + if (existing != null) { + if (homogenousResources(resource, existing)) { + moveExisting(resource, existing, iterationMonitor.split(100)); } else { + // Moving a linked resource over unlinked or vice versa. + // Can't use setContents here. Fixes bug 28772. + delete(existing, iterationMonitor.split(50)); resource.move(destinationPath, IResource.SHALLOW | IResource.KEEP_HISTORY, - iterationMonitor.split(100)); + iterationMonitor.split(50)); } + } else { + resource.move(destinationPath, IResource.SHALLOW | IResource.KEEP_HISTORY, + iterationMonitor.split(100)); } } } diff --git a/bundles/org.eclipse.ui.ide/extensions/org/eclipse/ui/actions/OpenFileAction.java b/bundles/org.eclipse.ui.ide/extensions/org/eclipse/ui/actions/OpenFileAction.java index 17632fb41cf..0108478762f 100644 --- a/bundles/org.eclipse.ui.ide/extensions/org/eclipse/ui/actions/OpenFileAction.java +++ b/bundles/org.eclipse.ui.ide/extensions/org/eclipse/ui/actions/OpenFileAction.java @@ -101,11 +101,9 @@ public class OpenFileAction extends OpenSystemEditorAction { boolean activate = OpenStrategy.activateOnOpen(); if (editorDescriptor == null) { IDE.openEditor(getWorkbenchPage(), file, activate); - } else { - if (ensureFileLocal(file)) { - getWorkbenchPage().openEditor(new FileEditorInput(file), - editorDescriptor.getId(), activate); - } + } else if (ensureFileLocal(file)) { + getWorkbenchPage().openEditor(new FileEditorInput(file), + editorDescriptor.getId(), activate); } } catch (PartInitException e) { DialogUtil.openError(getWorkbenchPage().getWorkbenchWindow() diff --git a/bundles/org.eclipse.ui.ide/extensions/org/eclipse/ui/actions/RenameResourceAction.java b/bundles/org.eclipse.ui.ide/extensions/org/eclipse/ui/actions/RenameResourceAction.java index 3069f52307b..42910b7bf33 100644 --- a/bundles/org.eclipse.ui.ide/extensions/org/eclipse/ui/actions/RenameResourceAction.java +++ b/bundles/org.eclipse.ui.ide/extensions/org/eclipse/ui/actions/RenameResourceAction.java @@ -545,12 +545,10 @@ public class RenameResourceAction extends WorkspaceAction { inlinedResource.getType()); if (!status.isOK()) { displayError(status.getMessage()); - } else { - if (!LTKLauncher.renameResource(newName, new StructuredSelection(inlinedResource))) { - // LTK Launcher couldn't rename the resource - IPath newPath = inlinedResource.getFullPath().removeLastSegments(1).append(newName); - runWithNewPath(newPath, inlinedResource); - } + } else if (!LTKLauncher.renameResource(newName, new StructuredSelection(inlinedResource))) { + // LTK Launcher couldn't rename the resource + IPath newPath = inlinedResource.getFullPath().removeLastSegments(1).append(newName); + runWithNewPath(newPath, inlinedResource); } } inlinedResource = null; diff --git a/bundles/org.eclipse.ui.ide/extensions/org/eclipse/ui/dialogs/ContainerGenerator.java b/bundles/org.eclipse.ui.ide/extensions/org/eclipse/ui/dialogs/ContainerGenerator.java index 894f324678d..d7b3877cdbc 100644 --- a/bundles/org.eclipse.ui.ide/extensions/org/eclipse/ui/dialogs/ContainerGenerator.java +++ b/bundles/org.eclipse.ui.ide/extensions/org/eclipse/ui/dialogs/ContainerGenerator.java @@ -174,14 +174,12 @@ public class ContainerGenerator { } container = (IContainer) resource; subMonitor.worked(1); + } else if (i == 0) { + IProject projectHandle = createProjectHandle(root, currentSegment); + container = createProject(projectHandle, subMonitor.split(1)); } else { - if (i == 0) { - IProject projectHandle = createProjectHandle(root, currentSegment); - container = createProject(projectHandle, subMonitor.split(1)); - } else { - IFolder folderHandle = createFolderHandle(container, currentSegment); - container = createFolder(folderHandle, subMonitor.split(1)); - } + IFolder folderHandle = createFolderHandle(container, currentSegment); + container = createFolder(folderHandle, subMonitor.split(1)); } } }, null, IResource.NONE, monitor); diff --git a/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/IDEWorkbenchErrorHandler.java b/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/IDEWorkbenchErrorHandler.java index fd9d9a50f78..795635ab357 100644 --- a/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/IDEWorkbenchErrorHandler.java +++ b/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/IDEWorkbenchErrorHandler.java @@ -144,10 +144,8 @@ public class IDEWorkbenchErrorHandler extends WorkbenchErrorHandler { dialog.updateMessage(MessageFormat.format(MSG_FATAL_ERROR, MSG_FATAL_ERROR_Recursive)); dialog.getShell().forceActive(); - } else { - if (openQuestionDialog(t)) { - closeWorkbench(); - } + } else if (openQuestionDialog(t)) { + closeWorkbench(); } } finally { exceptionCount--; @@ -169,13 +167,11 @@ public class IDEWorkbenchErrorHandler extends WorkbenchErrorHandler { msg = MSG_VirtualMachineError; } else if (t instanceof SWTError) { msg = MSG_SWTError; + } else if (t.getMessage() == null) { + msg = IDEWorkbenchMessages.InternalErrorNoArg; } else { - if (t.getMessage() == null) { - msg = IDEWorkbenchMessages.InternalErrorNoArg; - } else { - msg = NLS.bind(IDEWorkbenchMessages.InternalErrorOneArg, t - .getMessage()); - } + msg = NLS.bind(IDEWorkbenchMessages.InternalErrorOneArg, t + .getMessage()); } // Always open the dialog in case of major error but do not show the diff --git a/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/actions/BuildUtilities.java b/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/actions/BuildUtilities.java index e6e6c424b0f..fce435e5edb 100644 --- a/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/actions/BuildUtilities.java +++ b/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/actions/BuildUtilities.java @@ -102,14 +102,12 @@ public class BuildUtilities { IProject[] selected = null; if (selection != null && !selection.isEmpty() && selection instanceof IStructuredSelection) { selected = extractProjects(((IStructuredSelection) selection).toArray()); - } else { - //see if we can extract a selected project from the active editor - if (activePart instanceof IEditorPart) { - IEditorPart editor= (IEditorPart)activePart; - IFile file = ResourceUtil.getFile(editor.getEditorInput()); - if (file != null) { - selected = new IProject[] {file.getProject()}; - } + } else //see if we can extract a selected project from the active editor + if (activePart instanceof IEditorPart) { + IEditorPart editor= (IEditorPart)activePart; + IFile file = ResourceUtil.getFile(editor.getEditorInput()); + if (file != null) { + selected = new IProject[] {file.getProject()}; } } if (selected == null) { diff --git a/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/dialogs/LinkedResourceEditor.java b/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/dialogs/LinkedResourceEditor.java index 583f985b06e..fc7218a8c71 100644 --- a/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/dialogs/LinkedResourceEditor.java +++ b/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/dialogs/LinkedResourceEditor.java @@ -936,12 +936,10 @@ public class LinkedResourceEditor { TreeMap<String, IResource> container = null; if (isBroken) container = fBrokenResources; - else { - if (isAbsolute(resource)) - container = fAbsoluteResources; - else - container = fFixedResources; - } + else if (isAbsolute(resource)) + container = fAbsoluteResources; + else + container = fFixedResources; String fullPath = resource.getFullPath().toPortableString(); if (!container.containsKey(fullPath)) { diff --git a/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/dialogs/ProjectContentsLocationArea.java b/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/dialogs/ProjectContentsLocationArea.java index 1891d8c9535..cb873462c15 100644 --- a/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/dialogs/ProjectContentsLocationArea.java +++ b/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/dialogs/ProjectContentsLocationArea.java @@ -229,13 +229,11 @@ public class ProjectContentsLocationArea { if (defaultEnabled) { locationPathField.setText(TextProcessor.process(getDefaultPathDisplayString())); + } else if (existingProject == null) { + locationPathField.setText(IDEResourceInfoUtils.EMPTY_STRING); } else { - if (existingProject == null) { - locationPathField.setText(IDEResourceInfoUtils.EMPTY_STRING); - } else { - locationPathField.setText(TextProcessor.process(existingProject - .getLocation().toOSString())); - } + locationPathField.setText(TextProcessor.process(existingProject + .getLocation().toOSString())); } locationPathField.addModifyListener(e -> errorReporter.reportError(checkValidLocation(), false)); diff --git a/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/dialogs/ResourceInfoPage.java b/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/dialogs/ResourceInfoPage.java index cb3f1567f70..38750b37f35 100644 --- a/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/dialogs/ResourceInfoPage.java +++ b/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/dialogs/ResourceInfoPage.java @@ -304,56 +304,54 @@ public class ResourceInfoPage extends PropertyPage { resolvedLocationValue.setLayoutData(gd); resolvedLocationValue.setBackground(resolvedLocationValue .getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND)); - } else { - if (!resource.isVirtual()) { - // The group for location - Label locationTitle = new Label(basicInfoComposite, SWT.LEFT); - locationTitle.setText(LOCATION_TITLE); - gd = new GridData(); - locationTitle.setLayoutData(gd); - - Text locationValue = new Text(basicInfoComposite, SWT.WRAP - | SWT.READ_ONLY); - final String locationStr = TextProcessor.process(IDEResourceInfoUtils - .getLocationText(resource)); - locationValue.setText(locationStr); - gd = new GridData(); - gd.horizontalAlignment = GridData.FILL; - locationValue.setLayoutData(gd); - locationValue.setBackground(locationValue.getDisplay() - .getSystemColor(SWT.COLOR_WIDGET_BACKGROUND)); - - Button goToLocationButton = new Button(basicInfoComposite, SWT.PUSH); - gd = new GridData(); - gd.verticalAlignment = SWT.TOP; - goToLocationButton.setLayoutData(gd); - ResourceManager resourceManager = new LocalResourceManager(JFaceResources.getResources(), - goToLocationButton); - Bundle bundle = FrameworkUtil.getBundle(getClass()); - URL goToFolderUrl = FileLocator.find(bundle, new Path("icons/full/obj16/goto_input.png"), //$NON-NLS-1$ - null); - goToLocationButton.setImage(resourceManager.createImage(ImageDescriptor.createFromURL(goToFolderUrl))); - goToLocationButton.setToolTipText(LOCATION_BUTTON_TOOLTIP); - goToLocationButton.addSelectionListener(new SelectionAdapter() { - - @SuppressWarnings("restriction") - @Override - public void widgetSelected(SelectionEvent e) { - ECommandService commandService = PlatformUI.getWorkbench().getService(ECommandService.class); - EHandlerService handlerService = PlatformUI.getWorkbench().getService(EHandlerService.class); - - Command command = commandService.getCommand(ShowInSystemExplorerHandler.ID); - if (command.isDefined()) { - ParameterizedCommand parameterizedCommand = commandService - .createCommand(ShowInSystemExplorerHandler.ID, Collections.singletonMap( - ShowInSystemExplorerHandler.RESOURCE_PATH_PARAMETER, locationStr)); - if (handlerService.canExecute(parameterizedCommand)) { - handlerService.executeHandler(parameterizedCommand); - } + } else if (!resource.isVirtual()) { + // The group for location + Label locationTitle = new Label(basicInfoComposite, SWT.LEFT); + locationTitle.setText(LOCATION_TITLE); + gd = new GridData(); + locationTitle.setLayoutData(gd); + + Text locationValue = new Text(basicInfoComposite, SWT.WRAP + | SWT.READ_ONLY); + final String locationStr = TextProcessor.process(IDEResourceInfoUtils + .getLocationText(resource)); + locationValue.setText(locationStr); + gd = new GridData(); + gd.horizontalAlignment = GridData.FILL; + locationValue.setLayoutData(gd); + locationValue.setBackground(locationValue.getDisplay() + .getSystemColor(SWT.COLOR_WIDGET_BACKGROUND)); + + Button goToLocationButton = new Button(basicInfoComposite, SWT.PUSH); + gd = new GridData(); + gd.verticalAlignment = SWT.TOP; + goToLocationButton.setLayoutData(gd); + ResourceManager resourceManager = new LocalResourceManager(JFaceResources.getResources(), + goToLocationButton); + Bundle bundle = FrameworkUtil.getBundle(getClass()); + URL goToFolderUrl = FileLocator.find(bundle, new Path("icons/full/obj16/goto_input.png"), //$NON-NLS-1$ + null); + goToLocationButton.setImage(resourceManager.createImage(ImageDescriptor.createFromURL(goToFolderUrl))); + goToLocationButton.setToolTipText(LOCATION_BUTTON_TOOLTIP); + goToLocationButton.addSelectionListener(new SelectionAdapter() { + + @SuppressWarnings("restriction") + @Override + public void widgetSelected(SelectionEvent e) { + ECommandService commandService = PlatformUI.getWorkbench().getService(ECommandService.class); + EHandlerService handlerService = PlatformUI.getWorkbench().getService(EHandlerService.class); + + Command command = commandService.getCommand(ShowInSystemExplorerHandler.ID); + if (command.isDefined()) { + ParameterizedCommand parameterizedCommand = commandService + .createCommand(ShowInSystemExplorerHandler.ID, Collections.singletonMap( + ShowInSystemExplorerHandler.RESOURCE_PATH_PARAMETER, locationStr)); + if (handlerService.canExecute(parameterizedCommand)) { + handlerService.executeHandler(parameterizedCommand); } } - }); - } + } + }); } if (resource.getType() == IResource.FILE) { // The group for size diff --git a/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/registry/MarkerQuery.java b/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/registry/MarkerQuery.java index fa78e14bbc4..8cb79d545a2 100644 --- a/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/registry/MarkerQuery.java +++ b/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/registry/MarkerQuery.java @@ -107,10 +107,8 @@ public class MarkerQuery { if(!marker.isSubtypeOf(type)) { return null; } - } else { - if(!type.equals(marker.getType())) { - return null; - } + } else if(!type.equals(marker.getType())) { + return null; } } } catch (CoreException e) { diff --git a/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/undo/ContainerDescription.java b/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/undo/ContainerDescription.java index 71779db8991..5cc6e16dca9 100644 --- a/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/undo/ContainerDescription.java +++ b/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/undo/ContainerDescription.java @@ -107,25 +107,23 @@ public abstract class ContainerDescription extends AbstractResourceDescription { if (resource != null) { // parent already exists, no need to create a description for it currentContainer = (IContainer) resource; + } else if (i == 0) { + // parent does not exist and it is a project + firstCreatedParent = new ProjectDescription(root + .getProject(currentSegment)); + currentContainerDescription = firstCreatedParent; } else { - if (i == 0) { - // parent does not exist and it is a project - firstCreatedParent = new ProjectDescription(root - .getProject(currentSegment)); - currentContainerDescription = firstCreatedParent; - } else { - IFolder folderHandle = currentContainer.getFolder(new Path( - currentSegment)); - ContainerDescription currentFolder; - currentFolder = new FolderDescription(folderHandle, usingVirtualFolder); - currentContainer = folderHandle; - if (currentContainerDescription != null) { - currentContainerDescription.addMember(currentFolder); - } - currentContainerDescription = currentFolder; - if (firstCreatedParent == null) { - firstCreatedParent = currentFolder; - } + IFolder folderHandle = currentContainer.getFolder(new Path( + currentSegment)); + ContainerDescription currentFolder; + currentFolder = new FolderDescription(folderHandle, usingVirtualFolder); + currentContainer = folderHandle; + if (currentContainerDescription != null) { + currentContainerDescription.addMember(currentFolder); + } + currentContainerDescription = currentFolder; + if (firstCreatedParent == null) { + firstCreatedParent = currentFolder; } } } diff --git a/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/views/markers/CachedMarkerBuilder.java b/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/views/markers/CachedMarkerBuilder.java index 040ef638bd4..a0595696f70 100644 --- a/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/views/markers/CachedMarkerBuilder.java +++ b/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/views/markers/CachedMarkerBuilder.java @@ -95,16 +95,14 @@ public class CachedMarkerBuilder { String categoryGroupID = m.getString(TAG_CATEGORY_GROUP); if (categoryGroupID == null) { setDefaultCategoryGroup(getGenerator()); + } else if (categoryGroupID.equals(VALUE_NONE)) { + this.categoryGroup = null; } else { - if (categoryGroupID.equals(VALUE_NONE)) { - this.categoryGroup = null; + MarkerGroup newGroup = getGenerator().getMarkerGroup(categoryGroupID); + if (newGroup == null) { + setDefaultCategoryGroup(getGenerator()); } else { - MarkerGroup newGroup = getGenerator().getMarkerGroup(categoryGroupID); - if (newGroup == null) { - setDefaultCategoryGroup(getGenerator()); - } else { - this.categoryGroup = newGroup; - } + this.categoryGroup = newGroup; } } } diff --git a/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/views/markers/ExtendedMarkersView.java b/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/views/markers/ExtendedMarkersView.java index 4fcba07db49..7c90d2579a2 100644 --- a/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/views/markers/ExtendedMarkersView.java +++ b/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/views/markers/ExtendedMarkersView.java @@ -922,12 +922,10 @@ public class ExtendedMarkersView extends ViewPart { } filteredCount += childCount; } + } else if(markerLimitsEnabled) { + filteredCount = markerLimit; } else { - if(markerLimitsEnabled) { - filteredCount = markerLimit; - } else { - filteredCount = -1; - } + filteredCount = -1; } // Any errors or warnings? If not then send the filtering message @@ -1165,10 +1163,8 @@ public class ExtendedMarkersView extends ViewPart { if (provider instanceof ILazyTreeContentProvider) { ((ILazyTreeContentProvider) provider).updateElement(builder.getMarkers(), i); viewer.setExpandedState(items[i], true); - } else { - if (!viewer.getExpandedState(items[i])) { - viewer.expandToLevel(items[i], 2); - } + } else if (!viewer.getExpandedState(items[i])) { + viewer.expandToLevel(items[i], 2); } } } @@ -1631,11 +1627,9 @@ public class ExtendedMarkersView extends ViewPart { if (part instanceof IEditorPart) { IEditorPart editor = (IEditorPart) part; objectsToAdapt.add(editor.getEditorInput()); - } else { - if (selection instanceof IStructuredSelection) { - for (Object object : (IStructuredSelection) selection) { - objectsToAdapt.add(object); - } + } else if (selection instanceof IStructuredSelection) { + for (Object object : (IStructuredSelection) selection) { + objectsToAdapt.add(object); } } // try to adapt them in resources and add it to the diff --git a/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/views/markers/FiltersConfigurationDialog.java b/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/views/markers/FiltersConfigurationDialog.java index 9e3427c3ba6..929366ed67f 100644 --- a/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/views/markers/FiltersConfigurationDialog.java +++ b/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/views/markers/FiltersConfigurationDialog.java @@ -227,15 +227,13 @@ public class FiltersConfigurationDialog extends ViewSettingsDialog { if (showAll) { previouslyChecked = configsTable.getCheckedElements(); configsTable.setAllChecked(false); + } else if (previouslyChecked != null && previouslyChecked.length > 0) { + configsTable.setCheckedElements(previouslyChecked); } else { - if (previouslyChecked != null && previouslyChecked.length > 0) { - configsTable.setCheckedElements(previouslyChecked); - } else { - // make the first entry checked - if (filterGroups.size() > 0) { - Object group = filterGroups.iterator().next(); - configsTable.setChecked(group, true); - } + // make the first entry checked + if (filterGroups.size() > 0) { + Object group = filterGroups.iterator().next(); + configsTable.setChecked(group, true); } } } diff --git a/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/wizards/datatransfer/WizardProjectsImportPage.java b/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/wizards/datatransfer/WizardProjectsImportPage.java index 4a6e665ab6f..6360d31c673 100644 --- a/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/wizards/datatransfer/WizardProjectsImportPage.java +++ b/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/wizards/datatransfer/WizardProjectsImportPage.java @@ -424,16 +424,14 @@ public class WizardProjectsImportPage extends WizardDataTransferPage { super(pageName); if (initialPath != null) { this.initialPath = initialPath; - } else { - if (currentSelection != null) { - Object firstElement = currentSelection.getFirstElement(); - if (firstElement instanceof File) { - this.initialPath = ((File) firstElement).getAbsolutePath(); - } else if (firstElement instanceof IResource) { - this.initialPath = ((IResource) firstElement).getLocation().toFile().getAbsolutePath(); - } else if (firstElement instanceof String && new File((String) firstElement).exists()) { - this.initialPath = new File((String) firstElement).getAbsolutePath(); - } + } else if (currentSelection != null) { + Object firstElement = currentSelection.getFirstElement(); + if (firstElement instanceof File) { + this.initialPath = ((File) firstElement).getAbsolutePath(); + } else if (firstElement instanceof IResource) { + this.initialPath = ((IResource) firstElement).getLocation().toFile().getAbsolutePath(); + } else if (firstElement instanceof String && new File((String) firstElement).exists()) { + this.initialPath = new File((String) firstElement).getAbsolutePath(); } } this.currentSelection = currentSelection; diff --git a/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/views/markers/internal/DialogMarkerProperties.java b/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/views/markers/internal/DialogMarkerProperties.java index e46060405fe..f1cc9a38bf7 100644 --- a/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/views/markers/internal/DialogMarkerProperties.java +++ b/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/views/markers/internal/DialogMarkerProperties.java @@ -522,10 +522,8 @@ public class DialogMarkerProperties extends TrayDialog { return; } op = new CreateMarkersOperation(type, attrs, resource, getCreateOperationTitle()); - } else { - if (isDirty()) { - op = new UpdateMarkersOperation(marker, attrs, getModifyOperationTitle(), true); - } + } else if (isDirty()) { + op = new UpdateMarkersOperation(marker, attrs, getModifyOperationTitle(), true); } if (op != null) { try { diff --git a/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/wizards/datatransfer/ImportOperation.java b/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/wizards/datatransfer/ImportOperation.java index 667d78693a2..f10690a84be 100644 --- a/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/wizards/datatransfer/ImportOperation.java +++ b/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/wizards/datatransfer/ImportOperation.java @@ -547,16 +547,14 @@ public class ImportOperation extends WorkspaceModifyOperation { targetResource.createLink( createRelativePath(new Path(provider.getFullPath(fileObject)), targetResource), 0, subMonitor.split(50)); - } else { - if (targetResource.exists()) { - if (targetResource.isLinked()) { - targetResource.delete(true, subMonitor.split(50)); - targetResource.create(contentStream, false, subMonitor.split(50)); - } else - targetResource.setContents(contentStream, IResource.KEEP_HISTORY, subMonitor.split(100)); + } else if (targetResource.exists()) { + if (targetResource.isLinked()) { + targetResource.delete(true, subMonitor.split(50)); + targetResource.create(contentStream, false, subMonitor.split(50)); } else - targetResource.create(contentStream, false, subMonitor.split(100)); - } + targetResource.setContents(contentStream, IResource.KEEP_HISTORY, subMonitor.split(100)); + } else + targetResource.create(contentStream, false, subMonitor.split(100)); setResourceAttributes(targetResource, fileObject); if (provider instanceof TarLeveledStructureProvider) { |