diff --git a/bundles/org.eclipse.ui.views/META-INF/MANIFEST.MF b/bundles/org.eclipse.ui.views/META-INF/MANIFEST.MF index 8644f87cd36..1f3a0233a32 100644 --- a/bundles/org.eclipse.ui.views/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.ui.views/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.ui.views; singleton:=true -Bundle-Version: 3.12.700.qualifier +Bundle-Version: 3.12.800.qualifier Bundle-Vendor: %providerName Bundle-Localization: plugin Export-Package: org.eclipse.ui.internal.views.contentoutline;x-internal:=true, diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/contentoutline/ContentOutline.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/contentoutline/ContentOutline.java index 6df8ba29f38..022f80cb8a3 100644 --- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/contentoutline/ContentOutline.java +++ b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/contentoutline/ContentOutline.java @@ -96,7 +96,7 @@ public class ContentOutline extends PageBookView implements ISelectionProvider, /** * Message to show on the default page. */ - private String defaultText =ContentOutlineMessages.ContentOutline_noOutline; + private final String defaultText =ContentOutlineMessages.ContentOutline_noOutline; /** * Creates a content outline view with no content outline pages. diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/contentoutline/ContentOutlinePage.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/contentoutline/ContentOutlinePage.java index 7440918738f..97711660847 100644 --- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/contentoutline/ContentOutlinePage.java +++ b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/contentoutline/ContentOutlinePage.java @@ -53,7 +53,7 @@ *

*/ public abstract class ContentOutlinePage extends Page implements IContentOutlinePage, ISelectionChangedListener { - private ListenerList selectionChangedListeners = new ListenerList<>(); + private final ListenerList selectionChangedListeners = new ListenerList<>(); private TreeViewer treeViewer; diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/ComboBoxPropertyDescriptor.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/ComboBoxPropertyDescriptor.java index b2f9aced139..c904d1e340d 100644 --- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/ComboBoxPropertyDescriptor.java +++ b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/ComboBoxPropertyDescriptor.java @@ -48,7 +48,7 @@ public class ComboBoxPropertyDescriptor extends PropertyDescriptor { /** * The labels to display in the combo box */ - private String[] labels; + private final String[] labels; /** * Creates an property descriptor with the given id, display name, and list diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/CopyPropertyAction.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/CopyPropertyAction.java index 49a3a8e0c1b..b58d6e6e923 100644 --- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/CopyPropertyAction.java +++ b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/CopyPropertyAction.java @@ -31,7 +31,7 @@ /** * System clipboard */ - private Clipboard clipboard; + private final Clipboard clipboard; /** * Creates the action. diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/NewPropertySheetHandler.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/NewPropertySheetHandler.java index 2130235d97c..20315c1c0a7 100644 --- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/NewPropertySheetHandler.java +++ b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/NewPropertySheetHandler.java @@ -62,8 +62,7 @@ public Object execute(ExecutionEvent event) throws ExecutionException { try { PropertySheet sheet = findPropertySheet(event, context); sheet.show(context); - if (activePart instanceof PropertySheet) { - PropertySheet parent = (PropertySheet) activePart; + if (activePart instanceof PropertySheet parent) { parent.setPinned(true); } else if(!sheet.isPinned()) { sheet.setPinned(PIN_NEW_PROPERTY_VIEW); @@ -84,8 +83,7 @@ public Object execute(ExecutionEvent event) throws ExecutionException { protected PropertyShowInContext getShowInContext(ExecutionEvent event) throws ExecutionException { IWorkbenchPart activePart = HandlerUtil.getActivePartChecked(event); - if (activePart instanceof PropertySheet) { - PropertySheet sheet = (PropertySheet) activePart; + if (activePart instanceof PropertySheet sheet) { return (PropertyShowInContext) sheet.getShowInContext(); } IShowInSource adapter = Adapters.adapt(activePart, IShowInSource.class); diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/PropertyDescriptor.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/PropertyDescriptor.java index ba86b33d05b..486f468beb5 100644 --- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/PropertyDescriptor.java +++ b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/PropertyDescriptor.java @@ -56,12 +56,12 @@ public class PropertyDescriptor implements IPropertyDescriptor { /** * The property id. */ - private Object id; + private final Object id; /** * The name to display for the property. */ - private String display; + private final String display; /** * Category name, or null if none (the default). diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/PropertySheet.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/PropertySheet.java index 2970eb158b2..e8a9f9985de 100644 --- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/PropertySheet.java +++ b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/PropertySheet.java @@ -119,7 +119,7 @@ public class PropertySheet extends PageBookView /** * Message to show on the default page. */ - private String defaultText = PropertiesMessages.PropertyViewer_noProperties; + private final String defaultText = PropertiesMessages.PropertyViewer_noProperties; /** * The initial selection when the property sheet opens @@ -410,8 +410,9 @@ protected boolean isImportant(IWorkbenchPart part) { @Override public void partClosed(IWorkbenchPart part) { if (part.equals(currentPart)) { - if (isPinned()) + if (isPinned()) { pinPropertySheetAction.setChecked(false); + } currentSelection = null; currentPart = null; } @@ -656,8 +657,7 @@ public ShowInContext getShowInContext() { @Override public boolean show(ShowInContext aContext) { if (!isPinned() - && aContext instanceof PropertyShowInContext) { - PropertyShowInContext context = (PropertyShowInContext) aContext; + && aContext instanceof PropertyShowInContext context) { IWorkbenchPart part = context.getPart(); if (part != null) { partActivated(part); @@ -689,8 +689,9 @@ private HashSet getIgnoredViews() { for (IConfigurationElement element : elements) { if ("excludeSources".equalsIgnoreCase(element.getName())) { //$NON-NLS-1$ String id = element.getAttribute("id"); //$NON-NLS-1$ - if (id != null) + if (id != null) { ignoredViews.add(id); + } } } } diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/PropertySheetCategory.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/PropertySheetCategory.java index 43918aa4e64..6efc79bdbe6 100644 --- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/PropertySheetCategory.java +++ b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/PropertySheetCategory.java @@ -21,7 +21,7 @@ * entries so they are displayed together. */ /*package*/class PropertySheetCategory { - private String categoryName; + private final String categoryName; private List entries = new ArrayList<>(); diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/PropertySheetEntry.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/PropertySheetEntry.java index 6394f598931..03ab897820a 100644 --- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/PropertySheetEntry.java +++ b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/PropertySheetEntry.java @@ -91,7 +91,7 @@ public class PropertySheetEntry extends EventManager implements IPropertySheetEn * Create the CellEditorListener for this entry. It listens for value * changes in the CellEditor, and cancel and finish requests. */ - private ICellEditorListener cellEditorListener = new ICellEditorListener() { + private final ICellEditorListener cellEditorListener = new ICellEditorListener() { @Override public void editorValueChanged(boolean oldValidState, boolean newValidState) { @@ -438,8 +438,9 @@ protected PropertySheetEntry getParent() { * @since 3.1 (was previously private) */ protected IPropertySource getPropertySource(Object object) { - if (sources.containsKey(object)) + if (sources.containsKey(object)) { return sources.get(object); + } IPropertySource result = null; IPropertySourceProvider provider = propertySourceProvider; @@ -608,8 +609,7 @@ public void resetPropertyValue() { IPropertySource source = getPropertySource(object); if (source.isPropertySet(descriptor.getId())) { // fix for https://bugs.eclipse.org/bugs/show_bug.cgi?id=21756 - if (source instanceof IPropertySource2) { - IPropertySource2 extendedSource = (IPropertySource2) source; + if (source instanceof IPropertySource2 extendedSource) { // continue with next if property is not resettable if (!extendedSource.isPropertyResettable(descriptor.getId())) { continue; diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/PropertySheetPage.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/PropertySheetPage.java index dae354fc0e0..f8d4d108148 100644 --- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/PropertySheetPage.java +++ b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/PropertySheetPage.java @@ -219,8 +219,9 @@ private Object getFirstContext(Object helpContext, HelpEvent e) { Object[] contexts; contexts = (Object[]) helpContext; - if (contexts.length > 0) + if (contexts.length > 0) { return contexts[0]; + } return null; } }); diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/PropertySheetSorter.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/PropertySheetSorter.java index 5f683f3cfc3..605eff140dd 100644 --- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/PropertySheetSorter.java +++ b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/PropertySheetSorter.java @@ -31,7 +31,7 @@ public class PropertySheetSorter { /** * The collator used to sort strings. */ - private Collator collator; + private final Collator collator; /** * Creates a new sorter, which uses the default collator to sort strings. diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/PropertySheetViewer.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/PropertySheetViewer.java index bb765a1add1..4dfd00927b6 100644 --- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/PropertySheetViewer.java +++ b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/PropertySheetViewer.java @@ -85,7 +85,7 @@ class PropertySheetViewer extends Viewer { * corresponding TreeItem. This is used in 'findItem' to * greatly increase the performance. */ - private HashMap entryToItemMap = new HashMap<>(); + private final HashMap entryToItemMap = new HashMap<>(); private TreeEditor treeEditor; @@ -95,7 +95,7 @@ class PropertySheetViewer extends Viewer { private static String MISCELLANEOUS_CATEGORY_NAME = PropertiesMessages.PropertyViewer_misc; // Cell editor support. - private int columnToEdit = 1; + private final int columnToEdit = 1; private CellEditor cellEditor; @@ -113,7 +113,7 @@ class PropertySheetViewer extends Viewer { private IStatusLineManager statusLineManager; // Cell editor activation listeners - private ListenerList activationListeners = new ListenerList<>(); + private final ListenerList activationListeners = new ListenerList<>(); // the property sheet sorter private PropertySheetSorter sorter = new PropertySheetSorter(); @@ -382,8 +382,9 @@ private void createItem(Object node, Widget parent, int index) { // removed from the cache item.addDisposeListener(e -> { Object possibleEntry = e.widget.getData(); - if (possibleEntry != null) + if (possibleEntry != null) { entryToItemMap.remove(possibleEntry); + } }); // add our listener @@ -713,10 +714,8 @@ private void handleSelect(TreeItem selection) { setErrorMessage(null); } else { Object object = selection.getData(); - if (object instanceof IPropertySheetEntry) { + if (object instanceof IPropertySheetEntry activeEntry) { // get the entry for this item - IPropertySheetEntry activeEntry = (IPropertySheetEntry) object; - // display the description for the item setMessage(activeEntry.getDescription()); @@ -795,8 +794,9 @@ public void widgetSelected(SelectionEvent e) { @Override public void widgetDefaultSelected(SelectionEvent e) { - if (e.item instanceof TreeItem) + if (e.item instanceof TreeItem) { handleSelect((TreeItem) e.item); + } } }); // Part2: handle single click activation of cell editor @@ -1326,9 +1326,7 @@ private void updateEntry(IPropertySheetEntry entry, TreeItem item) { item.setImage(1, image); } - if (entry instanceof PropertySheetEntry) { - PropertySheetEntry entry2 = (PropertySheetEntry) entry; - + if (entry instanceof PropertySheetEntry entry2) { Color color = entry2.getForeground(); if (item.getForeground() != color) { item.setForeground(color); diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/PropertyShowInContext.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/PropertyShowInContext.java index 51b9fdf2d63..920496156ca 100644 --- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/PropertyShowInContext.java +++ b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/PropertyShowInContext.java @@ -75,12 +75,15 @@ public int hashCode() { @Override public boolean equals(Object obj) { - if (this == obj) + if (this == obj) { return true; - if (obj == null) + } + if (obj == null) { return false; - if (getClass() != obj.getClass()) + } + if (getClass() != obj.getClass()) { return false; + } PropertyShowInContext other = (PropertyShowInContext) obj; if (Objects.equals(part, other.part) && Objects.equals(getSelection(), other.getSelection())) { // input needs to be equal, but only if both are really set.