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.navigator.resources; singleton:=true
Bundle-Version: 3.9.800.qualifier
Bundle-Version: 3.9.900.qualifier
Bundle-Activator: org.eclipse.ui.internal.navigator.resources.plugin.WorkbenchNavigatorPlugin
Bundle-Vendor: %Plugin.providerName
Bundle-Localization: plugin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
public class ProjectExplorerFilterActionGroup extends FilterActionGroup {

private SelectFiltersAction selectFiltersAction;
private CommonViewer commonViewer;
private final CommonViewer commonViewer;

public ProjectExplorerFilterActionGroup(CommonViewer aCommonViewer) {
super(aCommonViewer);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ public class ResourceToItemsMapper implements ICommonViewerMapper {
private static final int NUMBER_LIST_REUSE = 10;

// map from resource to item. Value can be single Item of List<Item>
private HashMap<IResource, Object> _resourceToItem;
private Stack<List<Item>> _reuseLists;
private final HashMap<IResource, Object> _resourceToItem;
private final Stack<List<Item>> _reuseLists;

private CommonViewer _commonViewer;
private final CommonViewer _commonViewer;

public ResourceToItemsMapper(CommonViewer viewer) {
_resourceToItem = new HashMap<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@
/**
* The shell in which to show any dialogs.
*/
private Shell shell;
private final Shell shell;

/**
* System clipboard
*/
private Clipboard clipboard;
private final Clipboard clipboard;

/**
* Associated paste action. May be <code>null</code>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public class EditActionGroup extends ActionGroup {

private TextActionHandler textActionHandler;

private Shell shell;
private final Shell shell;

public EditActionGroup(Shell aShell) {
shell = aShell;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,10 @@ public void run() {
dialog.open();
Object[] result = dialog.getResult();
if (result == null || result.length == 0
|| !(result[0] instanceof IResource)) {
|| !(result[0] instanceof IResource selection)) {
return;
}

IResource selection = (IResource) result[0];
viewer.setSelection(new StructuredSelection(selection), true);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@
/**
* The shell in which to show any dialogs.
*/
private Shell shell;
private final Shell shell;

/**
* System clipboard
*/
private Clipboard clipboard;
private final Clipboard clipboard;

/**
* Creates a new action.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public void setContext(ActionContext context) {

private static class DelegateIAdaptable implements IAdaptable {

private Object delegate;
private final Object delegate;

private DelegateIAdaptable(Object o) {
delegate = o;
Expand All @@ -96,7 +96,7 @@ public <T> T getAdapter(Class<T> adapter) {

private static class DelegateSelectionProvider implements ISelectionProvider {

private ISelectionProvider delegate;
private final ISelectionProvider delegate;

private DelegateSelectionProvider(ISelectionProvider s) {
delegate = s;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ public class RefactorActionGroup extends ActionGroup {

private MoveResourceAction moveAction;

private Shell shell;
private final Shell shell;

private Tree tree;
private final Tree tree;

private TextActionHandler textActionHandler;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,7 @@ private static List<IProject> selectionToProjects(IStructuredSelection selection
}
List<IProject> resources = new ArrayList<>();
for (Object currentObject : selection) {
if (currentObject instanceof IWorkingSet) {
IWorkingSet workingSet = (IWorkingSet) currentObject;
if (currentObject instanceof IWorkingSet workingSet) {
for (IAdaptable element : workingSet.getElements()) {
IProject project = element.getAdapter(IProject.class);
if (project != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public class WorkingSetActionProvider extends CommonActionProvider {
private WorkingSetFilterActionGroup workingSetActionGroup;
private WorkingSetRootModeActionGroup workingSetRootModeActionGroup;

private Object originalViewerInput = ResourcesPlugin.getWorkspace().getRoot();
private final Object originalViewerInput = ResourcesPlugin.getWorkspace().getRoot();

private IExtensionStateModel extensionStateModel;

Expand Down Expand Up @@ -110,8 +110,9 @@ public void propertyChange(PropertyChangeEvent event) {
}
}
if (viewer != null) {
if (newLabel != null)
if (newLabel != null) {
viewer.getCommonNavigator().setWorkingSetLabel(newLabel);
}
viewer.getFrameList().reset();
viewer.refresh();
}
Expand All @@ -138,10 +139,11 @@ public synchronized void ignore() {
}
}

private IPropertyChangeListener filterChangeListener = event -> {
private final IPropertyChangeListener filterChangeListener = event -> {

if (ignoreFilterChangeEvents)
if (ignoreFilterChangeEvents) {
return;
}

IWorkingSet newWorkingSet = (IWorkingSet) event.getNewValue();

Expand All @@ -163,18 +165,19 @@ public synchronized void ignore() {
} else {
viewer.getCommonNavigator().setWorkingSetLabel(null);
}
} else
} else {
viewer.getCommonNavigator().setWorkingSetLabel(workingSet.getLabel());
}
} else {
viewer.getCommonNavigator().setWorkingSetLabel(null);
}

viewer.getFrameList().reset();
};

private WorkingSetManagerListener managerChangeListener = new WorkingSetManagerListener();
private final WorkingSetManagerListener managerChangeListener = new WorkingSetManagerListener();

private IExtensionActivationListener activationListener = new IExtensionActivationListener() {
private final IExtensionActivationListener activationListener = new IExtensionActivationListener() {

private IWorkingSet savedWorkingSet;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
public class WorkingSetRootModeActionGroup extends ActionGroup {

private IExtensionStateModel stateModel;
private StructuredViewer structuredViewer;
private final StructuredViewer structuredViewer;

private boolean hasContributedToViewMenu = false;
private IAction workingSetsAction = null;
Expand Down Expand Up @@ -108,8 +108,9 @@ public WorkingSetRootModeActionGroup(StructuredViewer aStructuredViewer,

@Override
public void fillActionBars(IActionBars actionBars) {
if (hasContributedToViewMenu)
if (hasContributedToViewMenu) {
return;
}
IMenuManager topLevelSubMenu = new MenuManager(
WorkbenchNavigatorMessages.WorkingSetRootModeActionGroup_Top_Level_Element_);
addActions(topLevelSubMenu);
Expand All @@ -121,8 +122,9 @@ public void fillActionBars(IActionBars actionBars) {
* Adds the actions to the given menu manager.
*/
protected void addActions(IMenuManager viewMenu) {
if (actions == null)
if (actions == null) {
actions = createActions();
}

viewMenu.add(new Separator());
items = new MenuItem[actions.length];
Expand All @@ -136,8 +138,9 @@ protected void addActions(IMenuManager viewMenu) {
public void fill(Menu menu, int index) {

int style = SWT.CHECK;
if ((action.getStyle() & IAction.AS_RADIO_BUTTON) != 0)
if ((action.getStyle() & IAction.AS_RADIO_BUTTON) != 0) {
style = SWT.RADIO;
}

final MenuItem mi = new MenuItem(menu, style, index);
items[j] = mi;
Expand Down Expand Up @@ -207,17 +210,19 @@ private IAction[] createActions() {
* collapse to just show their contents.
*/
public void setShowTopLevelWorkingSets(boolean showTopLevelWorkingSets) {
if (actions == null)
if (actions == null) {
actions = createActions();
}

currentRadioSelection = showTopLevelWorkingSets ? 1 : 0;
workingSetsAction.setChecked(showTopLevelWorkingSets);
projectsAction.setChecked(!showTopLevelWorkingSets);

if (items != null) {
for (int i = 0; i < items.length; i++) {
if(items[i] != null && actions[i] != null)
if(items[i] != null && actions[i] != null) {
items[i].setSelection(actions[i].isChecked());
}
}
}
if (stateModel != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ public boolean select(Viewer viewer, Object parentElement, Object element) {
} else {
parentObject = parentElement;
}
if (parentObject instanceof IAdaptable) {
IAdaptable parentAdaptable = (IAdaptable)parentObject;
if (parentObject instanceof IAdaptable parentAdaptable) {
if (parentAdaptable.getAdapter(IWorkspaceRoot.class) != null ||
parentAdaptable.getAdapter(IWorkingSet.class) != null) {
return !NestedProjectManager.getInstance().isShownAsNested((IProject) element);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public class NestedProjectManager {
* ones) are the immediately following items in the map.</li>
* </ul>
*/
private SortedMap<IPath, IProject> locationsToProjects = new TreeMap<>(new PathComparator());
private final SortedMap<IPath, IProject> locationsToProjects = new TreeMap<>(new PathComparator());

private NestedProjectManager() {
refreshProjectsList();
Expand Down Expand Up @@ -172,8 +172,7 @@ public IContainer getMostDirectOpenContainer(IProject project) {
* @return the direct children projects for given container
*/
public IProject[] getDirectChildrenProjects(IContainer container) {
if (container instanceof IWorkspaceRoot) {
IWorkspaceRoot root = (IWorkspaceRoot) container;
if (container instanceof IWorkspaceRoot root) {
return root.getProjects();
}
Set<IProject> res = new HashSet<>();
Expand Down Expand Up @@ -202,8 +201,7 @@ public IProject[] getDirectChildrenProjects(IContainer container) {
* @return whether the container has some projects as direct children
*/
public boolean hasDirectChildrenProjects(IContainer container) {
if (container instanceof IWorkspaceRoot) {
IWorkspaceRoot root = (IWorkspaceRoot) container;
if (container instanceof IWorkspaceRoot root) {
return root.getProjects().length > 0;
}
IPath containerLocation = container.getLocation();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public class NestedProjectsContentProvider implements ITreeContentProvider, IRes
private static final Object[] EMPTY_OBJECT_ARRAY = new Object[0];
private static final IProject[] EMPTY_PROJECT_ARRAY = new IProject[0];

private Command projectPresetionCommand;
private final Command projectPresetionCommand;
private CommonViewer viewer;

public NestedProjectsContentProvider() {
Expand Down Expand Up @@ -99,17 +99,15 @@ public Object[] getElements(Object inputElement) {

@Override
public IProject[] getChildren(Object parentElement) {
if (! (parentElement instanceof IContainer)) {
if (! (parentElement instanceof IContainer container)) {
return EMPTY_PROJECT_ARRAY;
}
IContainer container = (IContainer)parentElement;
return NestedProjectManager.getInstance().getDirectChildrenProjects(container);
}

@Override
public IContainer getParent(Object element) {
if (element instanceof IProject) {
IProject project = (IProject)element;
if (element instanceof IProject project) {
if (NestedProjectManager.getInstance().isShownAsNested(project)) {
return NestedProjectManager.getInstance().getMostDirectOpenContainer(project);
}
Expand All @@ -135,9 +133,8 @@ public void resourceChanged(IResourceChangeEvent event) {
if (delta.getKind() == IResourceDelta.CHANGED && delta.getResource() instanceof IWorkspaceRoot) {
for (IResourceDelta childDelta : event.getDelta().getAffectedChildren()) {
IResource childResource = childDelta.getResource();
if (childResource instanceof IProject && (childDelta.getKind() == IResourceDelta.ADDED
if (childResource instanceof IProject affectedProject && (childDelta.getKind() == IResourceDelta.ADDED
|| childDelta.getKind() == IResourceDelta.REMOVED)) {
IProject affectedProject = (IProject) childResource;
IContainer parent = getParent(affectedProject);
if (parent != null) {
parentsToRefresh.add(parent);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,9 @@ private CompletableFuture<NestedProjectsProblemsModel> refreshSeverities() {
@Override
protected String decorateText(String input, Object element) {
super.decorateText(input, element);
if (! (element instanceof IProject)) {
if (! (element instanceof IProject project)) {
return input;
}
IProject project = (IProject)element;
IPath location = project.getLocation();
if (location == null) {
return input;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public void refreshModel() {
private void removeFromCache(Set<IResource> toRemove) {
Set<IContainer> dirtyLeafContainers = new LinkedHashSet<>();
for (IResource resource : toRemove) {
final IContainer currentContainer = resource instanceof IContainer ? (IContainer) resource
final IContainer currentContainer = resource instanceof IContainer i ? i
: resource.getParent();
if (currentContainer == null) {
continue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ public class ProjectPresentationHandler extends AbstractHandler {
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
IWorkbenchPart part = HandlerUtil.getActivePart(event);
if (part instanceof CommonNavigator) {
CommonNavigator navigator = (CommonNavigator)part;
if (part instanceof CommonNavigator navigator) {
String newNestParam = event.getParameter(ProjectPresentationHandler.NEST_PARAMETER);
boolean newNest = false;
if (newNestParam != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
*/
public class ResourceExtensionComparator extends ResourceComparator {

private Collator icuCollator;
private final Collator icuCollator;

/**
* Construct a sorter that uses the name of the resource as its sorting
Expand Down
Loading
Loading