Skip to content

Commit bc3e9e0

Browse files
authored
Merge branch 'eclipse-platform:master' into align_multi_page_editor_tab
2 parents ce27722 + 5c74619 commit bc3e9e0

File tree

51 files changed

+625
-478
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+625
-478
lines changed

bundles/org.eclipse.ltk.core.refactoring/META-INF/MANIFEST.MF

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Automatic-Module-Name: org.eclipse.ltk.core.refactoring
33
Bundle-ManifestVersion: 2
44
Bundle-Name: %pluginName
55
Bundle-SymbolicName: org.eclipse.ltk.core.refactoring; singleton:=true
6-
Bundle-Version: 3.14.500.qualifier
6+
Bundle-Version: 3.14.600.qualifier
77
Bundle-Activator: org.eclipse.ltk.internal.core.refactoring.RefactoringCorePlugin
88
Bundle-ActivationPolicy: lazy
99
Bundle-Vendor: %providerName

bundles/org.eclipse.ltk.core.refactoring/src/org/eclipse/ltk/core/refactoring/RefactoringDescriptor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ public final long getTimeStamp() {
357357
public final int hashCode() {
358358
int code= getDescription().hashCode();
359359
if (fTimeStamp >= 0)
360-
code+= (17 * fTimeStamp);
360+
code+= 17 * Long.hashCode(fTimeStamp);
361361
return code;
362362
}
363363

bundles/org.eclipse.ltk.core.refactoring/src/org/eclipse/ltk/core/refactoring/RefactoringDescriptorProxy.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ public final int hashCode() {
108108
int code= getDescription().hashCode();
109109
final long stamp= getTimeStamp();
110110
if (stamp >= 0)
111-
code+= (17 * stamp);
111+
code+= 17 * Long.hashCode(stamp);
112112
return code;
113113
}
114114

bundles/org.eclipse.search.core/META-INF/MANIFEST.MF

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
22
Bundle-ManifestVersion: 2
33
Bundle-Name: %pluginName
44
Bundle-SymbolicName: org.eclipse.search.core;singleton:=true
5-
Bundle-Version: 3.16.300.qualifier
5+
Bundle-Version: 3.16.400.qualifier
66
Bundle-Activator: org.eclipse.search.internal.core.SearchCorePlugin
77
Bundle-ActivationPolicy: lazy
88
Bundle-Vendor: %providerName

bundles/org.eclipse.search.core/search/org/eclipse/search/internal/core/text/TextSearchVisitor.java

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
import org.eclipse.core.runtime.Platform;
4141
import org.eclipse.core.runtime.Status;
4242
import org.eclipse.core.runtime.SubMonitor;
43-
import org.eclipse.core.runtime.content.IContentDescription;
4443
import org.eclipse.core.runtime.content.IContentType;
4544
import org.eclipse.core.runtime.content.IContentTypeManager;
4645
import org.eclipse.core.runtime.jobs.Job;
@@ -205,8 +204,13 @@ public IStatus processFile(List<IFile> sameFiles, IProgressMonitor monitor) {
205204
occurences = locateMatches(file, charsequence, matcher, monitor);
206205
} else {
207206
try {
207+
boolean reportTextOnly = !fCollector.reportBinaryFile(file);
208+
if (reportTextOnly && hasBinaryContentType(file)) {
209+
// fail fast for binary file types without opening the file
210+
return Status.OK_STATUS;
211+
}
208212
charsequence = fileCharSequenceProvider.newCharSequence(file);
209-
if (hasBinaryContent(charsequence, file) && !fCollector.reportBinaryFile(file)) {
213+
if (reportTextOnly && hasBinaryContent(charsequence)) {
210214
return Status.OK_STATUS;
211215
}
212216
occurences = locateMatches(file, charsequence, matcher, monitor);
@@ -435,21 +439,25 @@ public IStatus search(TextSearchScope scope, IProgressMonitor monitor) {
435439
return search(scope.evaluateFilesInScope(fStatus), monitor);
436440
}
437441

438-
private boolean hasBinaryContent(CharSequence seq, IFile file) throws CoreException {
439-
if (seq instanceof String) {
440-
if (!((String) seq).contains("\0")) { //$NON-NLS-1$
441-
// fail fast to avoid file.getContentDescription():
442-
return false;
442+
private final IContentType TEXT_TYPE = Platform.getContentTypeManager().getContentType(IContentTypeManager.CT_TEXT);
443+
444+
private boolean hasBinaryContentType(IFile file) {
445+
IContentType[] contentTypes = Platform.getContentTypeManager().findContentTypesFor(file.getName());
446+
for (IContentType contentType : contentTypes) {
447+
if (contentType.isKindOf(TEXT_TYPE)) {
448+
return false; // is text
443449
}
444450
}
445-
IContentDescription desc= file.getContentDescription();
446-
if (desc != null) {
447-
IContentType contentType= desc.getContentType();
448-
if (contentType != null && contentType.isKindOf(Platform.getContentTypeManager().getContentType(IContentTypeManager.CT_TEXT))) {
449-
return false;
450-
}
451+
if (contentTypes.length > 0) {
452+
return true; // has some not text type
451453
}
454+
return false; // unknown
455+
}
452456

457+
private boolean hasBinaryContent(CharSequence seq) {
458+
if (seq instanceof String s) {
459+
return (s.contains("\0")); //$NON-NLS-1$
460+
}
453461
// avoid calling seq.length() at it runs through the complete file,
454462
// thus it would do so for all binary files.
455463
try {

bundles/org.eclipse.ui.forms/META-INF/MANIFEST.MF

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
22
Bundle-ManifestVersion: 2
33
Bundle-Name: %name
44
Bundle-SymbolicName: org.eclipse.ui.forms;singleton:=true
5-
Bundle-Version: 3.13.300.qualifier
5+
Bundle-Version: 3.13.400.qualifier
66
Bundle-Vendor: %provider-name
77
Bundle-Localization: plugin
88
Export-Package: org.eclipse.ui.forms,

bundles/org.eclipse.ui.forms/src/org/eclipse/ui/internal/forms/widgets/Paragraph.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ public void layout(GC gc, int width, Locator loc, int lineHeight,
162162
computeRowHeights(gc, width, loc, lineHeight, resourceTable);
163163
for (ParagraphSegment segment : segments) {
164164
boolean doSelect = false;
165-
if (selectedLink != null && segment.equals(selectedLink))
165+
if (selectedLink instanceof ParagraphSegment sl && segment.equals(sl))
166166
doSelect = true;
167167
segment.layout(gc, width, loc, resourceTable, doSelect);
168168
}
@@ -182,7 +182,7 @@ public void paint(GC gc, Rectangle repaintRegion,
182182
if (!segment.intersects(repaintRegion))
183183
continue;
184184
boolean doSelect = false;
185-
if (selectedLink != null && segment.equals(selectedLink))
185+
if (selectedLink instanceof ParagraphSegment sl && segment.equals(sl))
186186
doSelect = true;
187187
segment.paint(gc, false, resourceTable, doSelect, selData, repaintRegion);
188188
}

bundles/org.eclipse.ui.ide/META-INF/MANIFEST.MF

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
22
Bundle-ManifestVersion: 2
33
Bundle-Name: %Plugin.name
44
Bundle-SymbolicName: org.eclipse.ui.ide; singleton:=true
5-
Bundle-Version: 3.22.300.qualifier
5+
Bundle-Version: 3.22.400.qualifier
66
Bundle-Activator: org.eclipse.ui.internal.ide.IDEWorkbenchPlugin
77
Bundle-ActivationPolicy: lazy
88
Bundle-Vendor: %Plugin.providerName

bundles/org.eclipse.ui.ide/extensions/org/eclipse/ui/actions/CopyFilesAndFoldersOperation.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
package org.eclipse.ui.actions;
1818

1919
import java.io.File;
20+
import java.io.IOException;
21+
import java.io.InputStream;
2022
import java.lang.reflect.InvocationTargetException;
2123
import java.math.BigDecimal;
2224
import java.net.URI;
@@ -528,7 +530,11 @@ private void copyExisting(IResource source, IResource existing, IProgressMonitor
528530
IFile sourceFile = getFile(source);
529531

530532
if (sourceFile != null) {
531-
existingFile.setContents(sourceFile.getContents(), IResource.KEEP_HISTORY, subMonitor.split(1));
533+
try (InputStream contents = sourceFile.getContents()) {
534+
existingFile.setContents(contents, IResource.KEEP_HISTORY, subMonitor.split(1));
535+
} catch (IOException closeException) {
536+
// never happens
537+
}
532538
}
533539
}
534540
}

bundles/org.eclipse.ui.ide/extensions/org/eclipse/ui/actions/MoveFilesAndFoldersOperation.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
*******************************************************************************/
1414
package org.eclipse.ui.actions;
1515

16+
import java.io.IOException;
17+
import java.io.InputStream;
18+
1619
import org.eclipse.core.resources.IContainer;
1720
import org.eclipse.core.resources.IFile;
1821
import org.eclipse.core.resources.IResource;
@@ -199,7 +202,11 @@ private void moveExisting(IResource source, IResource existing, IProgressMonitor
199202
IFile sourceFile = getFile(source);
200203

201204
if (sourceFile != null) {
202-
existingFile.setContents(sourceFile.getContents(), IResource.KEEP_HISTORY, subMonitor.split(1));
205+
try (InputStream contents = sourceFile.getContents()) {
206+
existingFile.setContents(contents, IResource.KEEP_HISTORY, subMonitor.split(1));
207+
} catch (IOException closeException) {
208+
// never happens
209+
}
203210
delete(sourceFile, subMonitor.split(1));
204211
}
205212
}

0 commit comments

Comments
 (0)