Skip to content
Open
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 @@ -4,13 +4,31 @@ Bundle-Name: Core Resources Tools
Bundle-SymbolicName: org.eclipse.core.tools.resources;singleton:=true
Bundle-Version: 1.8.200.qualifier
Bundle-Vendor: Eclipse.org
Export-Package: org.eclipse.core.tools.resources,
org.eclipse.core.tools.resources.markers
Export-Package: org.eclipse.core.tools.resources;
uses:="org.eclipse.core.internal.events,
org.eclipse.core.internal.resources,
org.eclipse.core.resources,
org.eclipse.core.tools,
org.eclipse.jface.action,
org.eclipse.jface.text,
org.eclipse.jface.viewers,
org.eclipse.swt.widgets,
org.eclipse.ui,
org.eclipse.ui.part",
org.eclipse.core.tools.resources.markers;
uses:="org.eclipse.core.resources,
org.eclipse.core.runtime,
org.eclipse.jface.action,
org.eclipse.jface.resource,
org.eclipse.jface.viewers,
org.eclipse.swt.widgets,
org.eclipse.ui,
org.eclipse.ui.part,
org.eclipse.ui.views.properties"
Require-Bundle: org.eclipse.core.resources,
org.eclipse.core.runtime;bundle-version="[3.29.0,4.0.0)",
org.eclipse.jface.text,
org.eclipse.ui,
org.eclipse.ui.workbench.texteditor,
org.eclipse.ui.editors,
org.eclipse.ui.ide,
org.eclipse.ui.views,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,7 @@ private List<IResource> getSelectedResources() {
ISelectionService selectionService = window.getSelectionService();
ISelection selection = selectionService.getSelection();

if (selection instanceof IStructuredSelection) {
IStructuredSelection structuredSelection = (IStructuredSelection) selection;
if (selection instanceof IStructuredSelection structuredSelection) {
for (Object element : structuredSelection) {
IResource resource = convertToResource(element);
if (resource != null) {
Expand Down Expand Up @@ -125,8 +124,7 @@ private IResource convertToResource(Object object) {
return (IResource) object;
}

if (object instanceof IAdaptable) {
IAdaptable adaptable = (IAdaptable) object;
if (object instanceof IAdaptable adaptable) {
return adaptable.getAdapter(IResource.class);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -335,8 +335,7 @@ int sizeof(Object object) {
if (object instanceof Map) {
return basicSizeof((Map<?, ?>) object);
}
if (object instanceof QualifiedName) {
QualifiedName name = (QualifiedName) object;
if (object instanceof QualifiedName name) {
return 20 + sizeof(name.getQualifier()) + sizeof(name.getLocalName());
}
// unknown -- use deep size
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,12 +189,12 @@ public Object[] getElements(Object parent) {

@Override
public Object getParent(Object child) {
return child instanceof Node ? ((Node) child).getParent() : null;
return child instanceof Node n ? n.getParent() : null;
}

@Override
public Object[] getChildren(Object parent) {
return parent instanceof Node ? ((Node) parent).getChildren() : new Object[0];
return parent instanceof Node n ? n.getChildren() : new Object[0];
}

@Override
Expand Down Expand Up @@ -306,9 +306,8 @@ public void run() {
public void run() {
ISelection selection = viewer.getSelection();
Object obj = ((IStructuredSelection) selection).getFirstElement();
if (obj instanceof IFileState) {
if (obj instanceof IFileState state) {
// Show the file contents
IFileState state = (IFileState) obj;
IWorkbench workbench = PlatformUI.getWorkbench();
IEditorRegistry editorRegistry = workbench.getEditorRegistry();
IEditorDescriptor descriptor = editorRegistry.getDefaultEditor(state.getName());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,10 +210,9 @@ private void initialize() {
}

private void initialize(Object input) {
if (!(input instanceof IResourceChangeEvent)) {
if (!(input instanceof IResourceChangeEvent evt)) {
return;
}
IResourceChangeEvent evt = (IResourceChangeEvent) input;
ResourceEventNode root = new ResourceEventNode(evt);
invisibleRoot = new DeltaNode();
invisibleRoot.addChild(root);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,12 @@ public class ResourceContentProvider extends AbstractTreeContentProvider {
*/
protected void extractInfo(IResource selectedResource) {

if (!(selectedResource instanceof Resource)) {
if (!(selectedResource instanceof Resource resource)) {
String message = NLS.bind(Messages.resource_error_unknown_resource_impl, selectedResource.getClass().getName());
getRootNode().addChild(new TreeContentProviderNode(message));
return;
}

Resource resource = (Resource) selectedResource;

ResourceInfo info = resource.getResourceInfo(true, false);
// Resource#getResourceInfo may return null when the resource
// does not exist anymore. In this case, we just ignore it.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,14 @@ synchronized void readMarkerDeclarations() {
IConfigurationElement elt = configElements[j];
if (elt.getName().equalsIgnoreCase("super")) {
String sup = elt.getAttribute("type");
if (sup != null)
if (sup != null) {
supersList.add(sup);
}
} else if (elt.getName().equalsIgnoreCase("attribute")) {
String attr = elt.getAttribute("name");
if (attr != null)
if (attr != null) {
attributes.add(attr);
}
} else if (elt.getName().equalsIgnoreCase("persistent")) {
String value = elt.getAttribute("value");
persistent = "yes".equalsIgnoreCase(value) ? true : false;
Expand All @@ -119,8 +121,9 @@ synchronized void readMarkerDeclarations() {
markerMap.put(identifier, info);
}
}
if (DEBUG)
if (DEBUG) {
dumpMarkerTypes();
}
}

// a cruddy debugging tool. Dumps the model out in pseudo xml
Expand All @@ -146,8 +149,9 @@ private void dumpMarkerType(String type, int indent) {
if (hasAttrs) {
System.out.println();
printlnIndented(indent + 1, " attrs='" + mtype.declaredAttributes + "'" + (hasSupers ? ">" : "/>"));
if (!hasSupers)
if (!hasSupers) {
return;
}
} else {
System.out.println(">");
}
Expand All @@ -163,8 +167,9 @@ private void dumpMarkerType(String type, int indent) {
}

private void printIndented(int indent, Object value) {
for (int i = 0; i < indent; i++)
for (int i = 0; i < indent; i++) {
System.out.print(" ");
}
System.out.print(value);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -398,8 +398,7 @@ class ViewLabelProvider extends LabelProvider {
@Override
public String getText(Object obj) {
try {
if (obj instanceof IMarker) {
IMarker marker = (IMarker) obj;
if (obj instanceof IMarker marker) {
String message = (String) marker.getAttribute(IMarker.MESSAGE);
String type = marker.getType();
return message == null ? type : message + " : " + type;
Expand Down Expand Up @@ -482,8 +481,7 @@ public void createPartControl(Composite parent) {
IStructuredSelection newSelection = emptySelection;
if (!sel.isEmpty() && sel.size() == 1) {
Object first = sel.getFirstElement();
if (first instanceof IMarker) {
IMarker marker = (IMarker) first;
if (first instanceof IMarker marker) {
propertySource.setSourceMarker(marker);
newSelection = new StructuredSelection(propertySource);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,9 @@ private void findPropertyDescriptors(ArrayList<PropertyDescriptor> descriptorLis
}

private void findDeclaredPropertyDescriptorsFor(MarkerExtensionModel.MarkerInfo anInfo, List<PropertyDescriptor> descriptorList, Set<String> actualAttributeSet) {
if (anInfo == null)
if (anInfo == null) {
return;
}
try {
if (anInfo.id.equals(marker.getType())) {
persistentDescriptor.setCategory(anInfo.id);
Expand Down Expand Up @@ -96,8 +97,9 @@ private void findDeclaredPropertyDescriptorsFor(MarkerExtensionModel.MarkerInfo
@Override
public Object getPropertyValue(Object id) {
String name = (String) id;
if ("persistent".equals(name))
if ("persistent".equals(name)) {
return info.persistent ? Boolean.TRUE : Boolean.FALSE;
}
try {
return marker.getAttribute(name);
} catch (CoreException e) {
Expand All @@ -109,8 +111,9 @@ public Object getPropertyValue(Object id) {
@Override
public boolean isPropertySet(Object id) {
String name = (String) id;
if ("persistent".equals(name))
if ("persistent".equals(name)) {
return info != null;
}
try {
return marker.getAttribute(name) != null;
} catch (CoreException e) {
Expand Down
Loading