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 @@ -52,7 +52,7 @@ public class AddBookmarkAction extends SelectionListenerAction {
/**
* The IShellProvider in which to show any dialogs.
*/
private IShellProvider shellProvider;
private final IShellProvider shellProvider;

/**
* Creates a new bookmark action. By default, prompts the user for the
Expand Down Expand Up @@ -107,8 +107,9 @@ private void initAction() {

@Override
public void run() {
if (getSelectedResources().isEmpty())
if (getSelectedResources().isEmpty()) {
return;
}

IResource resource= getSelectedResources().get(0);
if (resource != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public class AddTaskAction extends SelectionListenerAction {
/**
* The IShellProvider in which to show any dialogs.
*/
private IShellProvider shellProvider;
private final IShellProvider shellProvider;

/**
* Creates a new instance of the receiver.
Expand Down Expand Up @@ -91,8 +91,7 @@ private IResource getElement(IStructuredSelection selection) {
Object element = selection.getFirstElement();
IResource resource = Adapters.adapt(element, IResource.class);

if (resource != null && resource instanceof IProject) {
IProject project = (IProject) resource;
if (resource != null && resource instanceof IProject project) {
if (!project.isOpen()) {
resource = null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,9 @@ protected List<? extends IResource> getActionResources() {

@Override
protected String getOperationMessage() {
if (getProjectsToBuild().size() > 1)
if (getProjectsToBuild().size() > 1) {
return IDEWorkbenchMessages.BuildAction_operationMessage_plural;
}
return IDEWorkbenchMessages.BuildAction_operationMessage;
}

Expand Down Expand Up @@ -204,8 +205,9 @@ protected List<? extends IBuildConfiguration> getBuildConfigurationsToBuild() {
* <code>false</code> if not, or if this couldn't be determined
*/
boolean hasBuilder(IProject project) {
if (!project.isAccessible())
if (!project.isAccessible()) {
return false;
}
try {
ICommand[] commands = project.getDescription().getBuildSpec();
if (commands.length > 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,9 @@ private void initAction() {

@Override
protected String getOperationMessage() {
if (getActionResources().size() > 1)
if (getActionResources().size() > 1) {
return IDEWorkbenchMessages.CloseResourceAction_operationMessage_plural;
}
return IDEWorkbenchMessages.CloseResourceAction_operationMessage;
}

Expand Down Expand Up @@ -318,8 +319,7 @@ private boolean validateClose() {
IResourceChangeDescriptionFactory factory = ResourceChangeValidator.getValidator().createDeltaFactory();
List<? extends IResource> resources = getActionResources();
for (IResource resource : resources) {
if (resource instanceof IProject) {
IProject project = (IProject) resource;
if (resource instanceof IProject project) {
factory.close(project);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,9 @@ private boolean promptForConfirmation() {
projectName = firstSelected.getName();
}
message = NLS.bind(IDEWorkbenchMessages.CloseUnrelatedProjectsAction_confirmMsg1, projectName);
} else // if more then one project is selected then print there number
} else { // if more then one project is selected then print there number
message = NLS.bind(IDEWorkbenchMessages.CloseUnrelatedProjectsAction_confirmMsgN, selectionSize);
}

MessageDialogWithToggle dialog = MessageDialogWithToggle.openOkCancelConfirm(
getShell(), IDEWorkbenchMessages.CloseUnrelatedProjectsAction_toolTip,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
/**
* The parent shell used to show any dialogs.
*/
private Shell messageShell;
private final Shell messageShell;

/**
* Whether or not the copy has been canceled by the user.
Expand Down Expand Up @@ -477,14 +477,17 @@
if (createVirtualFoldersAndLinks) {
folder.create(IResource.VIRTUAL, true, iterationMonitor.split(1));
IResource[] members = ((IContainer) resource).members();
if (members.length > 0)
if (members.length > 0) {
copy(members, destinationPath, iterationMonitor.split(99));
} else
}
} else {
folder.createLink(createRelativePath(resource.getLocationURI(), folder), 0,
iterationMonitor.split(100));
}
}
} else
} else {
resource.copy(destinationPath, IResource.SHALLOW, iterationMonitor.split(100));
}
}
}
}
Expand All @@ -498,8 +501,9 @@
* @return an URI that was made relative to a variable
*/
private URI createRelativePath(URI locationURI, IResource resource) {
if (relativeVariable == null)
if (relativeVariable == null) {
return locationURI;
}
IPath location = URIUtil.toPath(locationURI);
IPath result;
try {
Expand Down Expand Up @@ -752,9 +756,9 @@
String variable= null;

//check if resource linking is disabled
if (ResourcesPlugin.getPlugin().getPluginPreferences().getBoolean(ResourcesPlugin.PREF_DISABLE_LINKING))
if (ResourcesPlugin.getPlugin().getPluginPreferences().getBoolean(ResourcesPlugin.PREF_DISABLE_LINKING)) {

Check warning on line 759 in bundles/org.eclipse.ui.ide/extensions/org/eclipse/ui/actions/CopyFilesAndFoldersOperation.java

View check run for this annotation

Jenkins - Eclipse Platform / Compiler

Deprecation

NORMAL: The method getPluginPreferences() from the type Plugin is deprecated

Check warning on line 759 in bundles/org.eclipse.ui.ide/extensions/org/eclipse/ui/actions/CopyFilesAndFoldersOperation.java

View check run for this annotation

Jenkins - Eclipse Platform / Compiler

Deprecation

NORMAL: The method getBoolean(String) from the type Preferences is deprecated
mode= ImportTypeDialog.IMPORT_COPY;
else if (dndPreference.equals(IDEInternalPreferences.IMPORT_FILES_AND_FOLDERS_MODE_PROMPT)) {
} 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) {
Expand All @@ -774,13 +778,15 @@
copyFiles(fileNames, destination);
break;
case ImportTypeDialog.IMPORT_VIRTUAL_FOLDERS_AND_LINKS:
if (variable != null)
if (variable != null) {
setRelativeVariable(variable);
}
createVirtualFoldersAndLinks(fileNames, destination);
break;
case ImportTypeDialog.IMPORT_LINK:
if (variable != null)
if (variable != null) {
setRelativeVariable(variable);
}
linkFiles(fileNames, destination);
break;
case ImportTypeDialog.IMPORT_NONE:
Expand Down Expand Up @@ -1239,8 +1245,7 @@
AbstractWorkspaceOperation op = getUndoableCopyOrMoveOperation(
resources, destination);
op.setModelProviderIds(getModelProviderIds());
if (op instanceof CopyResourcesOperation) {
CopyResourcesOperation copyMoveOp = (CopyResourcesOperation) op;
if (op instanceof CopyResourcesOperation copyMoveOp) {
copyMoveOp.setCreateVirtualFolders(createVirtualFoldersAndLinks);
copyMoveOp.setCreateLinks(createLinks);
copyMoveOp.setRelativeVariable(relativeVariable);
Expand Down Expand Up @@ -1574,8 +1579,9 @@
*/
private String validateImportDestinationInternal(IContainer destination,
IFileStore[] sourceStores) {
if (!isAccessible(destination))
if (!isAccessible(destination)) {
return IDEWorkbenchMessages.CopyFilesAndFoldersOperation_destinationAccessError;
}

if (!destination.isVirtual()) {
IFileStore destinationStore;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public class CopyProjectOperation {
/**
* The parent shell used to show any dialogs.
*/
private Shell parentShell;
private final Shell parentShell;

private String[] modelProviderIds;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public class DeleteResourceAction extends SelectionListenerAction {

static class DeleteProjectDialog extends MessageDialog {

private List<? extends IResource> projects;
private final List<? extends IResource> projects;

private boolean deleteContent;

Expand Down Expand Up @@ -179,7 +179,7 @@ public void mouseUp(MouseEvent e) {
return composite;
}

private SelectionListener selectionListener = new SelectionAdapter() {
private final SelectionListener selectionListener = new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
Button button = (Button) e.widget;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public class NewExampleAction extends Action {
/**
* The workbench window this action will run in
*/
private IWorkbenchWindow window;
private final IWorkbenchWindow window;

/**
* This default constructor allows the the action to be called from the welcome page.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public class NewProjectAction extends Action {
/**
* The workbench window this action will run in
*/
private IWorkbenchWindow window;
private final IWorkbenchWindow window;

/**
* This default constructor allows the the action to be called from the welcome page.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public class OpenFileAction extends OpenSystemEditorAction {
/**
* The editor to open.
*/
private IEditorDescriptor editorDescriptor;
private final IEditorDescriptor editorDescriptor;

/**
* Creates a new action that will open editors on the then-selected file
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,9 @@ private int countClosedProjects() {

@Override
protected String getOperationMessage() {
if (getActionResources().size() > 1)
if (getActionResources().size() > 1) {
return IDEWorkbenchMessages.OpenResourceAction_operationMessage_plural;
}
return IDEWorkbenchMessages.OpenResourceAction_operationMessage;
}

Expand All @@ -139,8 +140,9 @@ private boolean hasOtherClosedProjects() {
//count the closed projects in the selection
int closedInSelection = 0;
for (IResource project : getSelectedResources()) {
if (!((IProject) project).isOpen())
if (!((IProject) project).isOpen()) {
closedInSelection++;
}
}
//there are other closed projects if the selection does
//not contain all closed projects in the workspace
Expand Down Expand Up @@ -250,8 +252,9 @@ private void doOpenWithReferences(IProject project, IProgressMonitor mon) throws
//remember that we have prompted to avoid repeating the analysis
hasPrompted = true;
});
if (canceled)
if (canceled) {
throw new OperationCanceledException();
}
}
}
if (openProjectReferences) {
Expand All @@ -268,11 +271,10 @@ public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
// at most we can only open all projects currently closed
subMonitor.setTaskName(getOperationMessage());
for (IResource resource : resources) {
if (!(resource instanceof IProject)) {
if (!(resource instanceof IProject project)) {
continue;
}

IProject project = (IProject) resource;
if (!project.exists() || project.isOpen()) {
continue;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public class OpenSystemEditorAction extends SelectionListenerAction {
/**
* The workbench page to open the editor in.
*/
private IWorkbenchPage workbenchPage;
private final IWorkbenchPage workbenchPage;

/**
* Creates a new action that will open system editors on the then-selected file
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,11 @@
*/
public class OpenWithMenu extends ContributionItem {

private IWorkbenchPage page;
private final IWorkbenchPage page;

private IAdaptable adaptable;
private final IAdaptable adaptable;

private IEditorRegistry registry;
private final IEditorRegistry registry;

/**
* The id of this action.
Expand All @@ -86,7 +86,7 @@ public class OpenWithMenu extends ContributionItem {
* Compares the labels from two IEditorDescriptor objects
*/
private static final Comparator<IEditorDescriptor> comparer = new Comparator<>() {
private Collator collator = Collator.getInstance();
private final Collator collator = Collator.getInstance();

@Override
public int compare(IEditorDescriptor arg0, IEditorDescriptor arg1) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,19 @@
* not they wish to continue the operation on it.
*/
public class ReadOnlyStateChecker {
private Shell shell;
private final Shell shell;

private String titleMessage;
private final String titleMessage;

private String mainMessage;
private final String mainMessage;

private boolean yesToAllSelected = false;

private boolean cancelSelected = false;

private boolean ignoreLinkedResources = false;

private String READ_ONLY_EXCEPTION_MESSAGE = IDEWorkbenchMessages.ReadOnlyCheck_problems;
private final String READ_ONLY_EXCEPTION_MESSAGE = IDEWorkbenchMessages.ReadOnlyCheck_problems;

/**
* Create a new checker that parents the dialog off of parent using the supplied
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -408,8 +408,9 @@ protected String queryNewResourceName(final IResource resource) {
resource.getName(), validator);
dialog.setBlockOnOpen(true);
int result = dialog.open();
if (result == Window.OK)
if (result == Window.OK) {
return dialog.getValue();
}
return null;
}

Expand Down
Loading
Loading