New upstream version 4.26
Emmanuel Bourg
1 year, 4 months ago
0 | version: 2 | |
1 | updates: | |
2 | - package-ecosystem: github-actions | |
3 | directory: "/" | |
4 | schedule: | |
5 | interval: daily |
6 | 6 | core.* |
7 | 7 | Snap.* |
8 | 8 | # maven |
9 | >>>>>>> 2411f5e... Bug 548210 - Only send textDocument/didSave if the supports it | |
10 | 9 | target/ |
11 | /*/target/ | |
12 | 10 | .DS_Store |
11 | .polyglot.* | |
12 | pom.tycho |
3 | 3 | <extension> |
4 | 4 | <groupId>org.eclipse.tycho</groupId> |
5 | 5 | <artifactId>tycho-build</artifactId> |
6 | <version>2.7.2</version> | |
6 | <version>3.0.0</version> | |
7 | 7 | </extension> |
8 | 8 | </extensions>⏎ |
1 | 1 | Bundle-ManifestVersion: 2 |
2 | 2 | Bundle-Name: %Plugin.name |
3 | 3 | Bundle-SymbolicName: org.eclipse.core.filebuffers.tests;singleton:=true |
4 | Bundle-Version: 3.12.200.qualifier | |
4 | Bundle-Version: 3.12.300.qualifier | |
5 | 5 | Bundle-Activator: org.eclipse.core.filebuffers.tests.FileBuffersTestPlugin |
6 | 6 | Bundle-ActivationPolicy: lazy |
7 | 7 | Bundle-Vendor: %Plugin.providerName |
22 | 22 | src.includes = about.html |
23 | 23 | |
24 | 24 | source.. = src/ |
25 | ||
26 | # Maven/Tycho pom model adjustments | |
27 | pom.model.property.code.ignoredWarnings = ${tests.ignoredWarnings} | |
28 | pom.model.property.testClass = org.eclipse.core.filebuffers.tests.FileBuffersTestSuite |
0 | <?xml version="1.0" encoding="UTF-8"?> | |
1 | <!-- | |
2 | Copyright (c) 2012, 2019 Eclipse Foundation and others. | |
3 | All rights reserved. This program and the accompanying materials | |
4 | are made available under the terms of the Eclipse Distribution License v1.0 | |
5 | which accompanies this distribution, and is available at | |
6 | http://www.eclipse.org/org/documents/edl-v10.php | |
7 | ||
8 | Contributors: | |
9 | Igor Fedorenko - initial implementation | |
10 | --> | |
11 | <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |
12 | <modelVersion>4.0.0</modelVersion> | |
13 | <parent> | |
14 | <artifactId>text-tests-pom</artifactId> | |
15 | <groupId>org.eclipse.platform</groupId> | |
16 | <version>4.25.0-SNAPSHOT</version> | |
17 | <relativePath>../tests-pom/</relativePath> | |
18 | </parent> | |
19 | <artifactId>org.eclipse.core.filebuffers.tests</artifactId> | |
20 | <version>3.12.200-SNAPSHOT</version> | |
21 | <packaging>eclipse-test-plugin</packaging> | |
22 | <properties> | |
23 | <testSuite>${project.artifactId}</testSuite> | |
24 | <testClass>org.eclipse.core.filebuffers.tests.FileBuffersTestSuite</testClass> | |
25 | </properties> | |
26 | </project> |
0 | 0 | <?xml version="1.0" encoding="UTF-8" standalone="no"?> |
1 | 1 | <component id="org.eclipse.jface.text" version="2"> |
2 | <resource path="src/org/eclipse/jface/text/TextViewer.java" type="org.eclipse.jface.text.TextViewer"> | |
3 | <filter id="572522506"> | |
2 | <resource path="META-INF/MANIFEST.MF"> | |
3 | <filter comment="See https://github.com/eclipse-pde/eclipse.pde/issues/411 , applied to addition of IExitPolicy.doExit(...) addition" id="926941240"> | |
4 | 4 | <message_arguments> |
5 | <message_argument value="ChildDocumentManager"/> | |
6 | <message_argument value="TextViewer"/> | |
5 | <message_argument value="3.22.0"/> | |
6 | <message_argument value="3.21.0"/> | |
7 | 7 | </message_arguments> |
8 | 8 | </filter> |
9 | 9 | </resource> |
10 | <resource path="src/org/eclipse/jface/text/templates/persistence/TemplatePersistenceData.java" type="org.eclipse.jface.text.templates.persistence.TemplatePersistenceData"> | |
11 | <filter comment="Extended to prevent API breakage" id="571473929"> | |
10 | <resource path="src/org/eclipse/jface/text/link/LinkedModeUI.java" type="org.eclipse.jface.text.link.LinkedModeUI$IExitPolicy"> | |
11 | <filter comment="A new default IExitPolicy.doExit(LinkedModeModel model, DocumentEvent event) method is added. Despite the fact that the interface is implementable by Clients and https://wiki.eclipse.org/Evolving_Java-based_APIs_2#Evolving_API_Interfaces say that such a change may 'break compatibility', we don't know any such client that may implement such a method at present, so we believe this change will NOT add any compatibility break." id="404000815"> | |
12 | 12 | <message_arguments> |
13 | <message_argument value="TemplatePersistenceData"/> | |
14 | <message_argument value="TemplatePersistenceData"/> | |
15 | </message_arguments> | |
16 | </filter> | |
17 | </resource> | |
18 | <resource path="src/org/eclipse/jface/text/templates/persistence/TemplateReaderWriter.java" type="org.eclipse.jface.text.templates.persistence.TemplateReaderWriter"> | |
19 | <filter comment="Extended to prevent API breakage" id="571473929"> | |
20 | <message_arguments> | |
21 | <message_argument value="TemplateReaderWriter"/> | |
22 | <message_argument value="TemplateReaderWriter"/> | |
13 | <message_argument value="org.eclipse.jface.text.link.LinkedModeUI.IExitPolicy"/> | |
14 | <message_argument value="doExit(LinkedModeModel, DocumentEvent)"/> | |
23 | 15 | </message_arguments> |
24 | 16 | </filter> |
25 | 17 | </resource> |
1 | 1 | Bundle-ManifestVersion: 2 |
2 | 2 | Bundle-Name: %pluginName |
3 | 3 | Bundle-SymbolicName: org.eclipse.jface.text |
4 | Bundle-Version: 3.21.0.qualifier | |
4 | Bundle-Version: 3.22.0.qualifier | |
5 | 5 | Bundle-Vendor: %providerName |
6 | 6 | Bundle-Localization: plugin |
7 | 7 | Export-Package: |
+4
-0
87 | 87 | * label and <code>false</code> otherwise. |
88 | 88 | */ |
89 | 89 | private boolean hasAtLeastOneResolvedMiningNotEmpty() { |
90 | if (fMinings.stream().anyMatch(m -> m.getLabel() != null)) { | |
91 | return true; // will have a resolved mining. | |
92 | } | |
93 | ||
90 | 94 | if (fResolvedMinings == null || fResolvedMinings.length == 0) { |
91 | 95 | return false; |
92 | 96 | } |
+2
-1
43 | 43 | @Override |
44 | 44 | public void uninstall() { |
45 | 45 | ITextViewer viewer= getTextViewer(); |
46 | if (viewer != null && viewer.getTextWidget().getData(KEY) == this) { | |
46 | if (viewer != null && viewer.getTextWidget() != null && viewer.getTextWidget().getData(KEY) == this) { | |
47 | 47 | super.uninstall(); |
48 | 48 | viewer.getTextWidget().setData(KEY, null); |
49 | 49 | } |
50 | viewer= null; | |
50 | 51 | } |
51 | 52 | |
52 | 53 |
0 | 0 | /******************************************************************************* |
1 | * Copyright (c) 2000, 2018 IBM Corporation and others. | |
1 | * Copyright (c) 2000, 2022 IBM Corporation and others. | |
2 | 2 | * |
3 | 3 | * This program and the accompanying materials |
4 | 4 | * are made available under the terms of the Eclipse Public License 2.0 |
30 | 30 | import org.eclipse.swt.widgets.Shell; |
31 | 31 | |
32 | 32 | import org.eclipse.core.runtime.Assert; |
33 | ||
34 | import org.eclipse.text.undo.DocumentUndoEvent; | |
35 | import org.eclipse.text.undo.DocumentUndoManagerRegistry; | |
36 | import org.eclipse.text.undo.IDocumentUndoListener; | |
37 | import org.eclipse.text.undo.IDocumentUndoManager; | |
33 | 38 | |
34 | 39 | import org.eclipse.jface.internal.text.link.contentassist.ContentAssistant2; |
35 | 40 | import org.eclipse.jface.internal.text.link.contentassist.IProposalListener; |
276 | 281 | * should be taken |
277 | 282 | */ |
278 | 283 | ExitFlags doExit(LinkedModeModel model, VerifyEvent event, int offset, int length); |
284 | ||
285 | /** | |
286 | * Checks whether the linked mode should be left after receiving the given | |
287 | * <code>DocumentEvent</code>, especially allowing to control Copy-Paste operations. | |
288 | * | |
289 | * @param model the linked mode model | |
290 | * @param event the document event | |
291 | * @return valid exit flags or <code>null</code> if no special action should be taken | |
292 | * @since 3.22 | |
293 | */ | |
294 | default ExitFlags doExit(LinkedModeModel model, DocumentEvent event) { | |
295 | return null; | |
296 | } | |
279 | 297 | } |
280 | 298 | |
281 | 299 | /** |
291 | 309 | /** |
292 | 310 | * Listens for shell events and acts upon them. |
293 | 311 | */ |
294 | private class Closer implements ShellListener, ITextInputListener { | |
312 | private class Closer implements ShellListener, ITextInputListener, IDocumentUndoListener { | |
295 | 313 | |
296 | 314 | @Override |
297 | 315 | public void shellActivated(ShellEvent e) { |
368 | 386 | public void inputDocumentChanged(IDocument oldInput, IDocument newInput) { |
369 | 387 | } |
370 | 388 | |
389 | @Override | |
390 | public void documentUndoNotification(DocumentUndoEvent event) { | |
391 | int type= event.getEventType(); | |
392 | if ((type & DocumentUndoEvent.ABOUT_TO_UNDO) != 0 || (type & DocumentUndoEvent.ABOUT_TO_REDO) != 0) { | |
393 | // default behavior: any document change outside a linked position | |
394 | // causes us to exit | |
395 | String textRemoved= event.getPreservedText(); | |
396 | int end= event.getOffset() + (textRemoved != null ? textRemoved.length() : 0); | |
397 | for (int offset= event.getOffset(); offset <= end; offset++) { | |
398 | if (!fModel.anyPositionContains(offset)) { | |
399 | ITextViewer viewer= fCurrentTarget.getViewer(); | |
400 | if (fFramePosition != null && viewer instanceof IEditingSupportRegistry) { | |
401 | IEditingSupport[] helpers= ((IEditingSupportRegistry) viewer).getRegisteredSupports(); | |
402 | for (IEditingSupport helper : helpers) { | |
403 | if (helper.isOriginator(null, new Region(fFramePosition.getOffset(), fFramePosition.getLength()))) | |
404 | return; | |
405 | } | |
406 | } | |
407 | ||
408 | leave(ILinkedModeListener.EXTERNAL_MODIFICATION); | |
409 | return; | |
410 | } | |
411 | } | |
412 | ||
413 | // Make sure that any document compound change is done committed | |
414 | endCompoundChangeIfNeeded(); | |
415 | } | |
416 | } | |
371 | 417 | } |
372 | 418 | |
373 | 419 | /** |
392 | 438 | } |
393 | 439 | |
394 | 440 | leave(ILinkedModeListener.EXTERNAL_MODIFICATION); |
441 | return; | |
442 | } | |
443 | } | |
444 | ||
445 | // Apply ExitPolicy to any inserted text if the insertion is made inside a linked region | |
446 | if (fExitPolicy != null) { | |
447 | ExitFlags flags= fExitPolicy.doExit(fModel, event); | |
448 | if (flags != null) { | |
449 | leave(flags.flags); | |
395 | 450 | return; |
396 | 451 | } |
397 | 452 | } |
954 | 1009 | viewer.addTextInputListener(fCloser); |
955 | 1010 | |
956 | 1011 | viewer.getDocument().addDocumentListener(fDocumentListener); |
1012 | ||
1013 | IDocumentUndoManager undoManager= DocumentUndoManagerRegistry.getDocumentUndoManager(viewer.getDocument()); | |
1014 | if (undoManager != null) { | |
1015 | undoManager.addDocumentUndoListener(fCloser); | |
1016 | } | |
957 | 1017 | } |
958 | 1018 | |
959 | 1019 | /** |
1096 | 1156 | |
1097 | 1157 | ((IPostSelectionProvider) viewer).removePostSelectionChangedListener(fSelectionListener); |
1098 | 1158 | |
1159 | IDocumentUndoManager undoManager= DocumentUndoManagerRegistry.getDocumentUndoManager(viewer.getDocument()); | |
1160 | if (undoManager != null) { | |
1161 | undoManager.removeDocumentUndoListener(fCloser); | |
1162 | } | |
1163 | ||
1099 | 1164 | redraw(); |
1100 | 1165 | } |
1101 | 1166 |
1 | 1 | output.. = bin/ |
2 | 2 | bin.includes = META-INF/,\ |
3 | 3 | . |
4 | ||
5 | # Maven/Tycho pom model adjustments | |
6 | # bundle not in baseline | |
7 | pom.model.property.skipAPIAnalysis = true |
0 | <?xml version="1.0" encoding="UTF-8"?> | |
1 | <!-- | |
2 | Copyright (c) 2012, 2014 Eclipse Foundation and others. | |
3 | All rights reserved. This program and the accompanying materials | |
4 | are made available under the terms of the Eclipse Distribution License v1.0 | |
5 | which accompanies this distribution, and is available at | |
6 | http://www.eclipse.org/org/documents/edl-v10.php | |
7 | ||
8 | Contributors: | |
9 | Igor Fedorenko - initial implementation | |
10 | --> | |
11 | <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |
12 | <modelVersion>4.0.0</modelVersion> | |
13 | <parent> | |
14 | <artifactId>eclipse.platform.text</artifactId> | |
15 | <groupId>org.eclipse.platform</groupId> | |
16 | <version>4.25.0-SNAPSHOT</version> | |
17 | </parent> | |
18 | <groupId>org.eclipse.core</groupId> | |
19 | <artifactId>org.eclipse.jface.text.examples</artifactId> | |
20 | <version>1.1.0-SNAPSHOT</version> | |
21 | <packaging>eclipse-plugin</packaging> | |
22 | ||
23 | <properties> | |
24 | <skipAPIAnalysis>true</skipAPIAnalysis> <!-- bundle not in baseline --> | |
25 | </properties> | |
26 | ||
27 | </project> |
1 | 1 | Bundle-ManifestVersion: 2 |
2 | 2 | Bundle-Name: %Plugin.name |
3 | 3 | Bundle-SymbolicName: org.eclipse.jface.text.tests |
4 | Bundle-Version: 3.12.500.qualifier | |
4 | Bundle-Version: 3.12.600.qualifier | |
5 | 5 | Bundle-Vendor: %Plugin.providerName |
6 | 6 | Bundle-Localization: plugin |
7 | 7 | Export-Package: |
20 | 20 | src.includes = about.html |
21 | 21 | |
22 | 22 | source.. = src/ |
23 | ||
24 | # Maven/Tycho pom model adjustments | |
25 | pom.model.property.code.ignoredWarnings = ${tests.ignoredWarnings} | |
26 | pom.model.property.testClass = org.eclipse.jface.text.tests.JFaceTextTestSuite | |
27 | pom.model.property.tycho.surefire.useUIHarness = true | |
28 | pom.model.property.tycho.surefire.useUIThread = true |
0 | <?xml version="1.0" encoding="UTF-8"?> | |
1 | <!-- | |
2 | Copyright (c) 2012, 2019 Eclipse Foundation and others. | |
3 | All rights reserved. This program and the accompanying materials | |
4 | are made available under the terms of the Eclipse Distribution License v1.0 | |
5 | which accompanies this distribution, and is available at | |
6 | http://www.eclipse.org/org/documents/edl-v10.php | |
7 | ||
8 | Contributors: | |
9 | Igor Fedorenko - initial implementation | |
10 | --> | |
11 | <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |
12 | <modelVersion>4.0.0</modelVersion> | |
13 | <parent> | |
14 | <artifactId>text-tests-pom</artifactId> | |
15 | <groupId>org.eclipse.platform</groupId> | |
16 | <version>4.25.0-SNAPSHOT</version> | |
17 | <relativePath>../tests-pom/</relativePath> | |
18 | </parent> | |
19 | <groupId>org.eclipse.jface</groupId> | |
20 | <artifactId>org.eclipse.jface.text.tests</artifactId> | |
21 | <version>3.12.500-SNAPSHOT</version> | |
22 | <packaging>eclipse-test-plugin</packaging> | |
23 | <properties> | |
24 | <testClass>org.eclipse.jface.text.tests.JFaceTextTestSuite</testClass> | |
25 | </properties> | |
26 | <build> | |
27 | <plugins> | |
28 | <plugin> | |
29 | <groupId>org.eclipse.tycho</groupId> | |
30 | <artifactId>tycho-surefire-plugin</artifactId> | |
31 | <version>${tycho.version}</version> | |
32 | <configuration> | |
33 | <useUIHarness>true</useUIHarness> | |
34 | <useUIThread>true</useUIThread> | |
35 | </configuration> | |
36 | </plugin> | |
37 | </plugins> | |
38 | </build> | |
39 | </project> | |
40 |
+45
-29
19 | 19 | |
20 | 20 | import java.util.Arrays; |
21 | 21 | import java.util.Set; |
22 | import java.util.concurrent.atomic.AtomicBoolean; | |
22 | 23 | import java.util.stream.Collectors; |
23 | 24 | |
24 | 25 | import org.junit.After; |
152 | 153 | final Set<Shell> beforeShells= Arrays.stream(display.getShells()).filter(Shell::isVisible).collect(Collectors.toSet()); |
153 | 154 | Event keyEvent= new Event(); |
154 | 155 | Control control= viewer.getTextWidget(); |
155 | display.timerExec(200, new Runnable() { | |
156 | @Override | |
157 | public void run() { | |
158 | control.forceFocus(); | |
159 | keyEvent.widget= control; | |
160 | keyEvent.type= SWT.KeyDown; | |
161 | keyEvent.character= 'b'; | |
162 | keyEvent.keyCode= 'b'; | |
163 | control.getDisplay().post(keyEvent); | |
164 | keyEvent.type= SWT.KeyUp; | |
165 | control.getDisplay().post(keyEvent); | |
166 | DisplayHelper.driveEventQueue(control.getDisplay()); | |
167 | if (!document.get().startsWith("bb")) { | |
168 | display.timerExec(200, this); | |
169 | } | |
170 | } | |
171 | }); | |
172 | assertTrue("Completion item not shown", new DisplayHelper() { | |
173 | @Override | |
174 | protected boolean condition() { | |
175 | Set<Shell> newShells= Arrays.stream(display.getShells()).filter(Shell::isVisible).collect(Collectors.toSet()); | |
176 | newShells.removeAll(beforeShells); | |
177 | if (!newShells.isEmpty()) { | |
178 | Table completionTable= findCompletionSelectionControl(newShells.iterator().next()); | |
179 | return Arrays.stream(completionTable.getItems()).map(TableItem::getText).anyMatch(item -> item.contains(BarContentAssistProcessor.PROPOSAL.substring(document.getLength()))); | |
180 | } | |
181 | return false; | |
182 | } | |
183 | }.waitForCondition(display, 4000)); | |
156 | AtomicBoolean testEnded= new AtomicBoolean(); | |
157 | try { | |
158 | display.timerExec(0, new Runnable() { | |
159 | @Override | |
160 | public void run() { | |
161 | if (control.isDisposed() || testEnded.get()) { | |
162 | // https://github.com/eclipse-platform/eclipse.platform.text/issues/75#issuecomment-1263429480 | |
163 | return; // do not fail other unit tests | |
164 | } | |
165 | control.getShell().forceActive(); | |
166 | if (!control.forceFocus()) { | |
167 | display.timerExec(200, this); | |
168 | System.out.println("no focus"); | |
169 | return; | |
170 | } | |
171 | keyEvent.widget= control; | |
172 | keyEvent.type= SWT.KeyDown; | |
173 | keyEvent.character= 'b'; | |
174 | keyEvent.keyCode= 'b'; | |
175 | control.getDisplay().post(keyEvent); | |
176 | keyEvent.type= SWT.KeyUp; | |
177 | control.getDisplay().post(keyEvent); | |
178 | DisplayHelper.driveEventQueue(control.getDisplay()); | |
179 | if (!document.get().startsWith("bb")) { | |
180 | System.out.println("character b not added to control"); | |
181 | display.timerExec(200, this); | |
182 | } | |
183 | } | |
184 | }); | |
185 | assertTrue("Completion item not shown", new DisplayHelper() { | |
186 | @Override | |
187 | protected boolean condition() { | |
188 | Set<Shell> newShells= Arrays.stream(display.getShells()).filter(Shell::isVisible).collect(Collectors.toSet()); | |
189 | newShells.removeAll(beforeShells); | |
190 | if (!newShells.isEmpty()) { | |
191 | Table completionTable= findCompletionSelectionControl(newShells.iterator().next()); | |
192 | return Arrays.stream(completionTable.getItems()).map(TableItem::getText).anyMatch(item -> item.contains(BarContentAssistProcessor.PROPOSAL.substring(document.getLength()))); | |
193 | } | |
194 | return false; | |
195 | } | |
196 | }.waitForCondition(display, 4000)); | |
197 | } finally { | |
198 | testEnded.set(true); | |
199 | } | |
184 | 200 | } |
185 | 201 | |
186 | 202 | private static Table findCompletionSelectionControl(Widget control) { |
+1
-1
27 | 27 | } catch (InterruptedException e) { |
28 | 28 | Thread.currentThread().interrupt(); |
29 | 29 | } |
30 | throw new RuntimeException(); | |
30 | throw new RuntimeException("Expected Exception for junit test"); | |
31 | 31 | } |
32 | 32 | |
33 | 33 | @Override |
1 | 1 | Bundle-ManifestVersion: 2 |
2 | 2 | Bundle-Name: %pluginName |
3 | 3 | Bundle-SymbolicName: org.eclipse.search; singleton:=true |
4 | Bundle-Version: 3.14.200.qualifier | |
4 | Bundle-Version: 3.14.300.qualifier | |
5 | 5 | Bundle-Activator: org.eclipse.search.internal.ui.SearchPlugin |
6 | 6 | Bundle-ActivationPolicy: lazy |
7 | 7 | Bundle-Vendor: %providerName |
126 | 126 | private final String fDescription; |
127 | 127 | private final IResource[] fRootElements; |
128 | 128 | private final String[] fFileNamePatterns; |
129 | private final Matcher fPositiveFileNameMatcher; | |
130 | private final Matcher fNegativeFileNameMatcher; | |
129 | private final ThreadLocal<Matcher> fPositiveFileNameMatcher; | |
130 | private final ThreadLocal<Matcher> fNegativeFileNameMatcher; | |
131 | 131 | |
132 | 132 | private boolean fVisitDerived; |
133 | 133 | private IWorkingSet[] fWorkingSets; |
138 | 138 | fFileNamePatterns= fileNamePatterns; |
139 | 139 | fVisitDerived= visitDerived; |
140 | 140 | fWorkingSets= workingSets; |
141 | fPositiveFileNameMatcher= createMatcher(fileNamePatterns, false); | |
142 | fNegativeFileNameMatcher= createMatcher(fileNamePatterns, true); | |
141 | fPositiveFileNameMatcher = ThreadLocal.withInitial(() -> createMatcher(fileNamePatterns, false)); | |
142 | fNegativeFileNameMatcher = ThreadLocal.withInitial(() -> createMatcher(fileNamePatterns, true)); | |
143 | 143 | } |
144 | 144 | |
145 | 145 | /** |
222 | 222 | } |
223 | 223 | |
224 | 224 | private boolean matchesFileName(String fileName) { |
225 | if (fPositiveFileNameMatcher != null && !fPositiveFileNameMatcher.reset(fileName).matches()) { | |
225 | Matcher positiveFileNameMatcher = fPositiveFileNameMatcher.get(); | |
226 | if (positiveFileNameMatcher != null && !positiveFileNameMatcher.reset(fileName).matches()) { | |
226 | 227 | return false; |
227 | 228 | } |
228 | if (fNegativeFileNameMatcher != null && fNegativeFileNameMatcher.reset(fileName).matches()) { | |
229 | Matcher negativeFileNameMatcher = fNegativeFileNameMatcher.get(); | |
230 | if (negativeFileNameMatcher != null && negativeFileNameMatcher.reset(fileName).matches()) { | |
229 | 231 | return false; |
230 | 232 | } |
231 | 233 | return true; |
+67
-65
180 | 180 | SubMonitor subMonitor = SubMonitor.convert(inner, fileBatches.size() / jobCount); // approximate |
181 | 181 | this.fileCharSequenceProvider= new FileCharSequenceProvider(); |
182 | 182 | List<IFile> sameFiles; |
183 | while (((sameFiles = fileBatches.poll()) != null) && !fFatalError) { | |
183 | while (((sameFiles = fileBatches.poll()) != null) && !fFatalError && !fProgressMonitor.isCanceled()) { | |
184 | 184 | IStatus status = processFile(sameFiles, subMonitor.split(1)); |
185 | 185 | // Only accumulate interesting status |
186 | 186 | if (!status.isOK()) |
189 | 189 | // Stop processing and return the status for the completed jobs. |
190 | 190 | } |
191 | 191 | fileCharSequenceProvider= null; |
192 | synchronized (fLock) { | |
193 | fLock.notify(); | |
194 | } | |
192 | 195 | return multiStatus; |
193 | 196 | } |
194 | 197 | |
290 | 293 | private final TextSearchRequestor fCollector; |
291 | 294 | private final Pattern fSearchPattern; |
292 | 295 | |
293 | private IProgressMonitor fProgressMonitor; | |
294 | ||
295 | private int fNumberOfFilesToScan; | |
296 | private volatile IProgressMonitor fProgressMonitor; | |
297 | ||
296 | 298 | private int fNumberOfScannedFiles; // Protected by fLock |
297 | 299 | private IFile fCurrentFile; // Protected by fLock |
298 | private Object fLock= new Object(); | |
300 | private final Object fLock = new Object(); | |
299 | 301 | |
300 | 302 | private final MultiStatus fStatus; |
301 | 303 | private volatile boolean fFatalError; // If true, terminates the search. |
302 | 304 | |
303 | private boolean fIsLightweightAutoRefresh; | |
305 | private volatile boolean fIsLightweightAutoRefresh; | |
304 | 306 | |
305 | 307 | public TextSearchVisitor(TextSearchRequestor collector, Pattern searchPattern) { |
306 | 308 | fCollector= collector; |
316 | 318 | if (files.length == 0) { |
317 | 319 | return fStatus; |
318 | 320 | } |
319 | fProgressMonitor= monitor == null ? new NullProgressMonitor() : monitor; | |
320 | fNumberOfScannedFiles= 0; | |
321 | fNumberOfFilesToScan= files.length; | |
322 | fCurrentFile= null; | |
323 | ||
321 | fProgressMonitor = monitor == null ? new NullProgressMonitor() : monitor; | |
322 | synchronized (fLock) { | |
323 | fNumberOfScannedFiles = 0; | |
324 | fCurrentFile = null; | |
325 | } | |
324 | 326 | int threadsNeeded = Math.min(files.length, NUMBER_OF_LOGICAL_THREADS); |
325 | 327 | // All but 1 threads should search. 1 thread does the UI updates: |
326 | 328 | int jobCount = fCollector.canRunInParallel() && threadsNeeded > 1 ? threadsNeeded - 1 : 1; |
327 | ||
328 | // Seed count over 1 can cause endless waits, see bug 543629 comment 2 | |
329 | // TODO use seed = jobCount after the bug 543660 in JobGroup is fixed | |
330 | final int seed = 1; | |
331 | final JobGroup jobGroup = new TextSearchJobGroup("Text Search", jobCount, seed); //$NON-NLS-1$ | |
332 | 329 | long startTime= TRACING ? System.currentTimeMillis() : 0; |
333 | ||
334 | Job monitorUpdateJob= new Job(SearchMessages.TextSearchVisitor_progress_updating_job) { | |
335 | private int fLastNumberOfScannedFiles= 0; | |
336 | ||
337 | @Override | |
338 | public IStatus run(IProgressMonitor inner) { | |
339 | while (!inner.isCanceled()) { | |
340 | // Propagate user cancellation to the JobGroup. | |
341 | if (fProgressMonitor.isCanceled()) { | |
342 | jobGroup.cancel(); | |
343 | break; | |
344 | } | |
345 | ||
346 | IFile file; | |
347 | int numberOfScannedFiles; | |
348 | synchronized (fLock) { | |
349 | file= fCurrentFile; | |
350 | numberOfScannedFiles= fNumberOfScannedFiles; | |
351 | } | |
352 | if (file != null) { | |
353 | String fileName= file.getName(); | |
354 | Object[] args= { fileName, Integer.valueOf(numberOfScannedFiles), Integer.valueOf(fNumberOfFilesToScan)}; | |
355 | fProgressMonitor.subTask(Messages.format(SearchMessages.TextSearchVisitor_scanning, args)); | |
356 | int steps= numberOfScannedFiles - fLastNumberOfScannedFiles; | |
357 | fProgressMonitor.worked(steps); | |
358 | fLastNumberOfScannedFiles += steps; | |
359 | } | |
360 | try { | |
361 | Thread.sleep(100); | |
362 | } catch (InterruptedException e) { | |
363 | return Status.OK_STATUS; | |
364 | } | |
365 | } | |
366 | return Status.OK_STATUS; | |
367 | } | |
368 | }; | |
369 | 330 | |
370 | 331 | try { |
371 | 332 | String taskName= fSearchPattern.pattern().isEmpty() |
372 | 333 | ? SearchMessages.TextSearchVisitor_filesearch_task_label |
373 | 334 | : ""; //$NON-NLS-1$ |
374 | fProgressMonitor.beginTask(taskName, fNumberOfFilesToScan); | |
375 | monitorUpdateJob.setSystem(true); | |
376 | monitorUpdateJob.schedule(); | |
377 | 335 | try { |
378 | 336 | fCollector.beginReporting(); |
337 | if (fProgressMonitor.isCanceled()) { | |
338 | throw new OperationCanceledException(SearchMessages.TextSearchVisitor_canceled); | |
339 | } | |
340 | ||
379 | 341 | Map<IFile, IDocument> documentsInEditors= PlatformUI.isWorkbenchRunning() ? evalNonFileBufferDocuments() : Collections.emptyMap(); |
380 | 342 | |
381 | 343 | // group files with same content together: |
382 | ||
383 | 344 | Map<String, List<IFile>> localFilesByLocation = new LinkedHashMap<>(); |
384 | Map<String, List<IFile>> remotFilesByLocation = new LinkedHashMap<>(); | |
345 | Map<String, List<IFile>> remoteFilesByLocation = new LinkedHashMap<>(); | |
385 | 346 | |
386 | 347 | for (IFile file : files) { |
387 | 348 | IPath path = file.getLocation(); |
388 | 349 | String key = path == null ? file.getLocationURI().toString() : path.toString(); |
389 | 350 | Map<String, List<IFile>> filesByLocation = (path != null) ? localFilesByLocation |
390 | : remotFilesByLocation; | |
351 | : remoteFilesByLocation; | |
391 | 352 | filesByLocation.computeIfAbsent(key, k -> new ArrayList<>()).add(file); |
392 | 353 | |
393 | 354 | } |
394 | 355 | localFilesByLocation.values().forEach(fileBatches::offer); |
395 | remotFilesByLocation.values().forEach(fileBatches::offer); | |
396 | ||
356 | remoteFilesByLocation.values().forEach(fileBatches::offer); | |
357 | int numberOfFilesToScan = fileBatches.size(); | |
358 | fProgressMonitor.beginTask(taskName, numberOfFilesToScan); | |
359 | ||
360 | // Seed count over 1 can cause endless waits, see bug 543629 | |
361 | // comment 2 | |
362 | // TODO use seed = jobCount after the bug 543660 in JobGroup is | |
363 | // fixed | |
364 | ||
365 | final int seed = 1; | |
366 | final JobGroup jobGroup = new TextSearchJobGroup("Text Search", jobCount, seed); //$NON-NLS-1$ | |
397 | 367 | for (int i = 0; i < jobCount; i++) { |
398 | 368 | Job job = new TextSearchJob(documentsInEditors, jobCount); |
399 | 369 | job.setJobGroup(jobGroup); |
400 | 370 | job.schedule(); |
401 | 371 | } |
402 | ||
403 | // The monitorUpdateJob is managing progress and cancellation, | |
404 | // so it is ok to pass a null monitor into the job group. | |
372 | // update progress until finished or canceled: | |
373 | int numberOfScannedFiles = 0; | |
374 | int lastNumberOfScannedFiles = 0; | |
375 | while (!fProgressMonitor.isCanceled() && !jobGroup.getActiveJobs().isEmpty() | |
376 | && numberOfScannedFiles != numberOfFilesToScan) { | |
377 | IFile file; | |
378 | synchronized (fLock) { | |
379 | try { | |
380 | // time only relevant on how often progress is | |
381 | // updated, but cancel is notified immediately: | |
382 | fLock.wait(100); | |
383 | } catch (InterruptedException e) { | |
384 | fProgressMonitor.setCanceled(true); | |
385 | break; | |
386 | } | |
387 | file = fCurrentFile; | |
388 | numberOfScannedFiles = fNumberOfScannedFiles; | |
389 | } | |
390 | if (file != null) { | |
391 | String fileName = file.getName(); | |
392 | Object[] args = { fileName, Integer.valueOf(numberOfScannedFiles), | |
393 | Integer.valueOf(numberOfFilesToScan) }; | |
394 | fProgressMonitor.subTask(Messages.format(SearchMessages.TextSearchVisitor_scanning, args)); | |
395 | int steps = numberOfScannedFiles - lastNumberOfScannedFiles; | |
396 | fProgressMonitor.worked(steps); | |
397 | lastNumberOfScannedFiles += steps; | |
398 | } | |
399 | } | |
400 | if (fProgressMonitor.isCanceled()) { | |
401 | jobGroup.cancel(); | |
402 | } | |
403 | // no need to pass progressMonitor (which would show wrong | |
404 | // progress) but null because jobGroup was already finished / | |
405 | // canceled anyway: | |
405 | 406 | jobGroup.join(0, null); |
406 | if (fProgressMonitor.isCanceled()) | |
407 | if (fProgressMonitor.isCanceled()) { | |
407 | 408 | throw new OperationCanceledException(SearchMessages.TextSearchVisitor_canceled); |
409 | } | |
408 | 410 | |
409 | 411 | fStatus.addAll(jobGroup.getResult()); |
410 | 412 | return fStatus; |
411 | 413 | } catch (InterruptedException e) { |
412 | 414 | throw new OperationCanceledException(SearchMessages.TextSearchVisitor_canceled); |
413 | 415 | } finally { |
414 | monitorUpdateJob.cancel(); | |
415 | 416 | fileBatches.clear(); |
416 | 417 | } |
417 | 418 | } finally { |
500 | 501 | } |
501 | 502 | } |
502 | 503 | } catch (IndexOutOfBoundsException e) { |
504 | // ignored | |
503 | 505 | } catch (FileCharSequenceException ex) { |
504 | 506 | if (ex.getCause() instanceof CharConversionException) |
505 | 507 | return true; |
133 | 133 | public static String TextSearchPage_searchBinary_label; |
134 | 134 | public static String TextSearchVisitor_filesearch_task_label; |
135 | 135 | public static String TextSearchVisitor_patterntoocomplex0; |
136 | public static String TextSearchVisitor_progress_updating_job; | |
137 | 136 | public static String TextSearchVisitor_scanning; |
138 | 137 | public static String TextSearchVisitor_error; |
139 | 138 | public static String TextSearchVisitor_canceled; |
105 | 105 | TextSearchVisitor_canceled= Operation Canceled |
106 | 106 | TextSearchVisitor_unsupportedcharset=File ''{1}'' has been skipped: Unsupported encoding ''{0}''. |
107 | 107 | TextSearchVisitor_patterntoocomplex0=Search pattern is too complex. Search canceled. |
108 | TextSearchVisitor_progress_updating_job=Search progress polling | |
109 | 108 | TextSearchVisitor_filesearch_task_label=Searching for files... |
110 | TextSearchVisitor_textsearch_task_label=Searching for pattern ''{0}''... | |
109 | TextSearchVisitor_textsearch_task_label=Searching ''{0}'' | |
111 | 110 | TextSearchVisitor_illegalcharset=File ''{1}'' has been skipped: Illegal encoding ''{0}''. |
112 | 111 | |
113 | 112 | SortDropDownAction_label= S&ort By |
1 | 1 | Bundle-ManifestVersion: 2 |
2 | 2 | Bundle-Name: %pluginName |
3 | 3 | Bundle-SymbolicName: org.eclipse.search.tests |
4 | Bundle-Version: 3.10.100.qualifier | |
4 | Bundle-Version: 3.10.200.qualifier | |
5 | 5 | Bundle-Activator: org.eclipse.search.tests.SearchTestPlugin |
6 | 6 | Bundle-Vendor: %providerName |
7 | 7 | Bundle-Localization: plugin |
19 | 19 | META-INF/,\ |
20 | 20 | about.html,\ |
21 | 21 | test.xml |
22 | ||
23 | # Maven/Tycho pom model adjustments | |
24 | pom.model.property.code.ignoredWarnings = ${tests.ignoredWarnings} | |
25 | pom.model.property.testClass = org.eclipse.search.tests.AllSearchTests | |
26 | pom.model.property.tycho.surefire.useUIHarness = true | |
27 | pom.model.property.tycho.surefire.useUIThread = true |
0 | <?xml version="1.0" encoding="UTF-8"?> | |
1 | <!-- | |
2 | Copyright (c) 2012, 2019 Eclipse Foundation and others. | |
3 | All rights reserved. This program and the accompanying materials | |
4 | are made available under the terms of the Eclipse Distribution License v1.0 | |
5 | which accompanies this distribution, and is available at | |
6 | http://www.eclipse.org/org/documents/edl-v10.php | |
7 | ||
8 | Contributors: | |
9 | Igor Fedorenko - initial implementation | |
10 | --> | |
11 | <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |
12 | <modelVersion>4.0.0</modelVersion> | |
13 | <parent> | |
14 | <artifactId>text-tests-pom</artifactId> | |
15 | <groupId>org.eclipse.platform</groupId> | |
16 | <version>4.25.0-SNAPSHOT</version> | |
17 | <relativePath>../tests-pom/</relativePath> | |
18 | </parent> | |
19 | <artifactId>org.eclipse.search.tests</artifactId> | |
20 | <version>3.10.100-SNAPSHOT</version> | |
21 | <packaging>eclipse-test-plugin</packaging> | |
22 | <properties> | |
23 | <testClass>org.eclipse.search.tests.AllSearchTests</testClass> | |
24 | </properties> | |
25 | <build> | |
26 | <plugins> | |
27 | <plugin> | |
28 | <groupId>org.eclipse.tycho</groupId> | |
29 | <artifactId>tycho-surefire-plugin</artifactId> | |
30 | <version>${tycho.version}</version> | |
31 | <configuration> | |
32 | <useUIHarness>true</useUIHarness> | |
33 | <useUIThread>true</useUIThread> | |
34 | </configuration> | |
35 | </plugin> | |
36 | </plugins> | |
37 | </build> | |
38 | </project> |
1 | 1 | Bundle-ManifestVersion: 2 |
2 | 2 | Bundle-Name: %pluginName |
3 | 3 | Bundle-SymbolicName: org.eclipse.text |
4 | Bundle-Version: 3.12.200.qualifier | |
4 | Bundle-Version: 3.12.300.qualifier | |
5 | 5 | Bundle-Vendor: %providerName |
6 | 6 | Bundle-Localization: plugin |
7 | 7 | Export-Package: |
13 | 13 | package org.eclipse.jface.text; |
14 | 14 | |
15 | 15 | import java.util.ArrayList; |
16 | import java.util.Collections; | |
16 | 17 | import java.util.Iterator; |
17 | 18 | import java.util.List; |
18 | 19 | |
79 | 80 | return this.offset > -1 && this.length > -1; |
80 | 81 | } |
81 | 82 | } |
82 | ||
83 | /** | |
84 | * The active rewrite session. | |
85 | * | |
86 | * @since 3.1 | |
87 | */ | |
88 | private DocumentRewriteSession fActiveRewriteSession; | |
89 | /** | |
90 | * The list of pending requests. | |
91 | * | |
92 | * @since 3.1 | |
93 | */ | |
94 | private List<Request> fPendingRequests; | |
83 | ||
84 | /** | |
85 | * Holder of the active {@link DocumentRewriteSession} with associated list of {@link Request} | |
86 | * objects. | |
87 | * <p> | |
88 | * On starting new {@link DocumentRewriteSession} or on the end of the active | |
89 | * {@link DocumentRewriteSession} this object is being replaced by another one. | |
90 | * <p> | |
91 | * | |
92 | * @see AbstractLineTracker#startRewriteSession(DocumentRewriteSession) | |
93 | * @see AbstractLineTracker#stopRewriteSession(DocumentRewriteSession, String) | |
94 | */ | |
95 | private static class SessionData { | |
96 | ||
97 | /** | |
98 | * The active rewrite session. Not final, but can only be changed to null. | |
99 | * | |
100 | * @since 3.1 | |
101 | */ | |
102 | private volatile DocumentRewriteSession fActiveRewriteSession; | |
103 | /** | |
104 | * The list of pending requests. | |
105 | * | |
106 | * @since 3.1 | |
107 | */ | |
108 | private List<Request> fPendingRequests; | |
109 | ||
110 | /** | |
111 | * @param activeRewriteSession may be null | |
112 | */ | |
113 | SessionData(DocumentRewriteSession activeRewriteSession){ | |
114 | fActiveRewriteSession = activeRewriteSession; | |
115 | if (activeRewriteSession != null) { | |
116 | fPendingRequests = new ArrayList<>(20); | |
117 | } else { | |
118 | fPendingRequests = Collections.emptyList(); | |
119 | } | |
120 | } | |
121 | ||
122 | boolean isSessionActive() { | |
123 | return fActiveRewriteSession != null; | |
124 | } | |
125 | ||
126 | boolean setIfActive(String text) { | |
127 | if (isSessionActive()) { | |
128 | synchronized (this) { | |
129 | if (!isSessionActive()) { | |
130 | return false; | |
131 | } | |
132 | fPendingRequests.clear(); | |
133 | fPendingRequests.add(new Request(text)); | |
134 | } | |
135 | return true; | |
136 | } else { | |
137 | return false; | |
138 | } | |
139 | } | |
140 | ||
141 | boolean addIfActive(int offset, int length, String text) { | |
142 | if (isSessionActive()) { | |
143 | synchronized (this) { | |
144 | if (!isSessionActive()) { | |
145 | return false; | |
146 | } | |
147 | fPendingRequests.add(new Request(offset, length, text)); | |
148 | } | |
149 | return true; | |
150 | } else { | |
151 | return false; | |
152 | } | |
153 | } | |
154 | ||
155 | Iterator<Request> flush() { | |
156 | synchronized (this) { | |
157 | fActiveRewriteSession = null; | |
158 | Iterator<Request> requests = fPendingRequests.iterator(); | |
159 | fPendingRequests = Collections.emptyList(); | |
160 | return requests; | |
161 | } | |
162 | } | |
163 | ||
164 | boolean sameSession(DocumentRewriteSession session) { | |
165 | return fActiveRewriteSession == session; | |
166 | } | |
167 | ||
168 | @Override | |
169 | public String toString() { | |
170 | StringBuilder builder= new StringBuilder(); | |
171 | builder.append("SessionData ["); //$NON-NLS-1$ | |
172 | builder.append("activeRewriteSession="); //$NON-NLS-1$ | |
173 | builder.append(fActiveRewriteSession); | |
174 | builder.append(", "); //$NON-NLS-1$ | |
175 | builder.append("pendingRequests="); //$NON-NLS-1$ | |
176 | builder.append(fPendingRequests); | |
177 | builder.append("]"); //$NON-NLS-1$ | |
178 | return builder.toString(); | |
179 | } | |
180 | } | |
181 | ||
182 | private volatile SessionData sessionData; | |
183 | private final Object sessionLock = new Object(); | |
184 | ||
95 | 185 | /** |
96 | 186 | * The implementation that this tracker delegates to. |
97 | 187 | * |
98 | 188 | * @since 3.2 |
99 | 189 | */ |
100 | private ILineTracker fDelegate= new ListLineTracker() { | |
190 | private volatile ILineTracker fDelegate= new ListLineTracker() { | |
101 | 191 | @Override |
102 | 192 | public String[] getLegalLineDelimiters() { |
103 | 193 | return AbstractLineTracker.this.getLegalLineDelimiters(); |
117 | 207 | * Creates a new line tracker. |
118 | 208 | */ |
119 | 209 | protected AbstractLineTracker() { |
210 | sessionData = new SessionData(null); | |
120 | 211 | } |
121 | 212 | |
122 | 213 | @Override |
178 | 269 | |
179 | 270 | @Override |
180 | 271 | public void set(String text) { |
181 | if (hasActiveRewriteSession()) { | |
182 | fPendingRequests.clear(); | |
183 | fPendingRequests.add(new Request(text)); | |
272 | boolean hasActiveRewriteSession = sessionData.setIfActive(text); | |
273 | if (hasActiveRewriteSession) { | |
184 | 274 | return; |
185 | 275 | } |
186 | 276 | |
189 | 279 | |
190 | 280 | @Override |
191 | 281 | public void replace(int offset, int length, String text) throws BadLocationException { |
192 | if (hasActiveRewriteSession()) { | |
193 | fPendingRequests.add(new Request(offset, length, text)); | |
282 | boolean hasActiveRewriteSession = sessionData.addIfActive(offset, length, text); | |
283 | if (hasActiveRewriteSession) { | |
194 | 284 | return; |
195 | 285 | } |
196 | 286 | |
204 | 294 | * |
205 | 295 | * @since 3.2 |
206 | 296 | */ |
207 | private void checkImplementation() { | |
297 | private synchronized void checkImplementation() { | |
208 | 298 | if (fNeedsConversion) { |
209 | 299 | fNeedsConversion= false; |
210 | 300 | fDelegate= new TreeLineTracker((ListLineTracker) fDelegate) { |
233 | 323 | |
234 | 324 | @Override |
235 | 325 | public final void startRewriteSession(DocumentRewriteSession session) { |
236 | if (fActiveRewriteSession != null) | |
237 | throw new IllegalStateException(); | |
238 | fActiveRewriteSession= session; | |
239 | fPendingRequests= new ArrayList<>(20); | |
326 | synchronized (sessionLock) { | |
327 | if (sessionData.isSessionActive()){ | |
328 | throw new IllegalStateException("Rewrite session is already active: " + sessionData); //$NON-NLS-1$ | |
329 | } | |
330 | sessionData = new SessionData(session); | |
331 | } | |
240 | 332 | } |
241 | 333 | |
242 | 334 | @Override |
243 | 335 | public final void stopRewriteSession(DocumentRewriteSession session, String text) { |
244 | if (fActiveRewriteSession == session) { | |
245 | fActiveRewriteSession= null; | |
246 | fPendingRequests= null; | |
247 | set(text); | |
336 | synchronized (sessionLock) { | |
337 | if (sessionData.sameSession(session)) { | |
338 | sessionData = new SessionData(null); | |
339 | set(text); | |
340 | } | |
248 | 341 | } |
249 | 342 | } |
250 | 343 | |
256 | 349 | * @since 3.1 |
257 | 350 | */ |
258 | 351 | protected final boolean hasActiveRewriteSession() { |
259 | return fActiveRewriteSession != null; | |
352 | return sessionData.isSessionActive(); | |
260 | 353 | } |
261 | 354 | |
262 | 355 | /** |
267 | 360 | */ |
268 | 361 | protected final void flushRewriteSession() throws BadLocationException { |
269 | 362 | if (DEBUG) |
270 | System.out.println("AbstractLineTracker: Flushing rewrite session: " + fActiveRewriteSession); //$NON-NLS-1$ | |
271 | ||
272 | Iterator<Request> e= fPendingRequests.iterator(); | |
273 | ||
274 | fPendingRequests= null; | |
275 | fActiveRewriteSession= null; | |
276 | ||
277 | while (e.hasNext()) { | |
278 | Request request= e.next(); | |
279 | if (request.isReplaceRequest()) | |
280 | replace(request.offset, request.length, request.text); | |
281 | else | |
282 | set(request.text); | |
363 | System.out.println("AbstractLineTracker: Flushing rewrite session: " + sessionData); //$NON-NLS-1$ | |
364 | synchronized (sessionData) { | |
365 | Iterator<Request> e= sessionData.flush(); | |
366 | while (e.hasNext()) { | |
367 | Request request= e.next(); | |
368 | if (request.isReplaceRequest()) | |
369 | replace(request.offset, request.length, request.text); | |
370 | else | |
371 | set(request.text); | |
372 | } | |
283 | 373 | } |
284 | 374 | } |
285 | 375 |
1 | 1 | Bundle-ManifestVersion: 2 |
2 | 2 | Bundle-Name: %pluginName |
3 | 3 | Bundle-SymbolicName: org.eclipse.text.quicksearch;singleton:=true |
4 | Bundle-Version: 1.1.300.qualifier | |
4 | Bundle-Version: 1.1.400.qualifier | |
5 | 5 | Bundle-Activator: org.eclipse.text.quicksearch.internal.ui.QuickSearchActivator |
6 | 6 | Require-Bundle: org.eclipse.ui;bundle-version="[3.113.0,4.0.0)", |
7 | 7 | org.eclipse.core.resources;bundle-version="[3.13.0,4.0.0)", |
+3
-7
30 | 30 | import org.eclipse.core.commands.ExecutionEvent; |
31 | 31 | import org.eclipse.core.commands.IHandler; |
32 | 32 | import org.eclipse.core.resources.IFile; |
33 | import org.eclipse.core.runtime.ICoreRunnable; | |
33 | 34 | import org.eclipse.core.runtime.IPath; |
34 | 35 | import org.eclipse.core.runtime.IProgressMonitor; |
35 | 36 | import org.eclipse.core.runtime.IStatus; |
129 | 130 | |
130 | 131 | public static final Styler HIGHLIGHT_STYLE = org.eclipse.search.internal.ui.text.DecoratingFileSearchLabelProvider.HIGHLIGHT_STYLE; |
131 | 132 | |
132 | private UIJob refreshJob = new UIJob(Messages.QuickSearchDialog_RefreshJob) { | |
133 | @Override | |
134 | public IStatus runInUIThread(IProgressMonitor monitor) { | |
135 | refreshWidgets(); | |
136 | return Status.OK_STATUS; | |
137 | } | |
138 | }; | |
133 | private UIJob refreshJob = UIJob.create(Messages.QuickSearchDialog_RefreshJob, | |
134 | (ICoreRunnable) m -> refreshWidgets()); | |
139 | 135 | |
140 | 136 | protected void openSelection() { |
141 | 137 | try { |
1 | 1 | Bundle-ManifestVersion: 2 |
2 | 2 | Bundle-Name: %pluginName |
3 | 3 | Bundle-SymbolicName: org.eclipse.text.quicksearch.tests |
4 | Bundle-Version: 1.1.200.qualifier | |
4 | Bundle-Version: 1.1.300.qualifier | |
5 | 5 | Require-Bundle: org.eclipse.core.runtime, |
6 | 6 | org.eclipse.text.quicksearch;bundle-version="1.0.300", |
7 | 7 | org.eclipse.core.resources, |
16 | 16 | about.html,\ |
17 | 17 | .,\ |
18 | 18 | plugin.properties |
19 | ||
20 | # Maven/Tycho pom model adjustments | |
21 | pom.model.property.code.ignoredWarnings = ${tests.ignoredWarnings} | |
22 | pom.model.property.testClass = org.eclipse.text.quicksearch.tests.*Test | |
23 | pom.model.property.tycho.surefire.useUIHarness = true | |
24 | pom.model.property.tycho.surefire.useUIThread = true |
0 | <?xml version="1.0" encoding="UTF-8"?> | |
1 | <!-- | |
2 | Copyright (c) 2012, 2014. 2019 Eclipse Foundation and others. | |
3 | All rights reserved. This program and the accompanying materials | |
4 | are made available under the terms of the Eclipse Distribution License v2.0 | |
5 | which accompanies this distribution, and is available at | |
6 | http://www.eclipse.org/org/documents/edl-v20.php | |
7 | ||
8 | SPDX-License-Identifier: EPL-2.0 | |
9 | ||
10 | Contributors: | |
11 | Igor Fedorenko - initial implementation | |
12 | Pivotal Inc - copy adapted for quicksearch | |
13 | --> | |
14 | <project xmlns="http://maven.apache.org/POM/4.0.0" | |
15 | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
16 | xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/maven-v4_0_0.xsd"> | |
17 | <modelVersion>4.0.0</modelVersion> | |
18 | <parent> | |
19 | <artifactId>text-tests-pom</artifactId> | |
20 | <groupId>org.eclipse.platform</groupId> | |
21 | <version>4.25.0-SNAPSHOT</version> | |
22 | <relativePath>../tests-pom/</relativePath> | |
23 | </parent> | |
24 | <artifactId>org.eclipse.text.quicksearch.tests</artifactId> | |
25 | <version>1.1.200-SNAPSHOT</version> | |
26 | <packaging>eclipse-test-plugin</packaging> | |
27 | <properties> | |
28 | <testSuite>${project.artifactId}</testSuite> | |
29 | <testClass>org.eclipse.text.quicksearch.tests.*Test</testClass> | |
30 | </properties> | |
31 | ||
32 | <build> | |
33 | <plugins> | |
34 | <plugin> | |
35 | <groupId>org.eclipse.tycho</groupId> | |
36 | <artifactId>tycho-surefire-plugin</artifactId> | |
37 | <configuration> | |
38 | <useUIHarness>true</useUIHarness> | |
39 | <useUIThread>true</useUIThread> | |
40 | </configuration> | |
41 | </plugin> | |
42 | </plugins> | |
43 | </build> | |
44 | </project> |
1 | 1 | Bundle-ManifestVersion: 2 |
2 | 2 | Bundle-Name: %Plugin.name |
3 | 3 | Bundle-SymbolicName: org.eclipse.text.tests |
4 | Bundle-Version: 3.13.100.qualifier | |
4 | Bundle-Version: 3.13.200.qualifier | |
5 | 5 | Bundle-Vendor: %Plugin.providerName |
6 | 6 | Bundle-Localization: plugin |
7 | 7 | Export-Package: |
20 | 20 | |
21 | 21 | source.. = projection/,\ |
22 | 22 | src/ |
23 | ||
24 | # Maven/Tycho pom model adjustments | |
25 | pom.model.property.code.ignoredWarnings = ${tests.ignoredWarnings} | |
26 | pom.model.property.testClass = org.eclipse.text.tests.EclipseTextTestSuite |
0 | <?xml version="1.0" encoding="UTF-8"?> | |
1 | <!-- | |
2 | Copyright (c) 2012, 2019 Eclipse Foundation and others. | |
3 | All rights reserved. This program and the accompanying materials | |
4 | are made available under the terms of the Eclipse Distribution License v1.0 | |
5 | which accompanies this distribution, and is available at | |
6 | http://www.eclipse.org/org/documents/edl-v10.php | |
7 | ||
8 | Contributors: | |
9 | Igor Fedorenko - initial implementation | |
10 | --> | |
11 | <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |
12 | <modelVersion>4.0.0</modelVersion> | |
13 | <parent> | |
14 | <artifactId>text-tests-pom</artifactId> | |
15 | <groupId>org.eclipse.platform</groupId> | |
16 | <version>4.25.0-SNAPSHOT</version> | |
17 | <relativePath>../tests-pom/</relativePath> | |
18 | </parent> | |
19 | <artifactId>org.eclipse.text.tests</artifactId> | |
20 | <version>3.13.100-SNAPSHOT</version> | |
21 | <packaging>eclipse-test-plugin</packaging> | |
22 | <properties> | |
23 | <testSuite>${project.artifactId}</testSuite> | |
24 | <testClass>org.eclipse.text.tests.EclipseTextTestSuite</testClass> | |
25 | </properties> | |
26 | </project> |
1 | 1 | Bundle-ManifestVersion: 2 |
2 | 2 | Bundle-Name: %Plugin.name |
3 | 3 | Bundle-SymbolicName: org.eclipse.ui.editors.tests;singleton:=true |
4 | Bundle-Version: 3.12.500.qualifier | |
4 | Bundle-Version: 3.12.600.qualifier | |
5 | 5 | Bundle-Vendor: %Plugin.providerName |
6 | 6 | Bundle-Localization: plugin |
7 | 7 | Export-Package: org.eclipse.ui.editors.tests |
21 | 21 | src.includes = about.html |
22 | 22 | |
23 | 23 | source.. = src/ |
24 | ||
25 | # Maven/Tycho pom model adjustments | |
26 | pom.model.property.code.ignoredWarnings = ${tests.ignoredWarnings} | |
27 | pom.model.property.testClass = org.eclipse.ui.editors.tests.EditorsTestSuite | |
28 | pom.model.property.tycho.surefire.useUIHarness = true | |
29 | pom.model.property.tycho.surefire.useUIThread = true |
0 | <?xml version="1.0" encoding="UTF-8"?> | |
1 | <!-- | |
2 | Copyright (c) 2012, 2019 Eclipse Foundation and others. | |
3 | All rights reserved. This program and the accompanying materials | |
4 | are made available under the terms of the Eclipse Distribution License v1.0 | |
5 | which accompanies this distribution, and is available at | |
6 | http://www.eclipse.org/org/documents/edl-v10.php | |
7 | ||
8 | Contributors: | |
9 | Igor Fedorenko - initial implementation | |
10 | --> | |
11 | <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |
12 | <modelVersion>4.0.0</modelVersion> | |
13 | <parent> | |
14 | <artifactId>text-tests-pom</artifactId> | |
15 | <groupId>org.eclipse.platform</groupId> | |
16 | <version>4.25.0-SNAPSHOT</version> | |
17 | <relativePath>../tests-pom/</relativePath> | |
18 | </parent> | |
19 | <artifactId>org.eclipse.ui.editors.tests</artifactId> | |
20 | <version>3.12.500-SNAPSHOT</version> | |
21 | <packaging>eclipse-test-plugin</packaging> | |
22 | <properties> | |
23 | <testClass>org.eclipse.ui.editors.tests.EditorsTestSuite</testClass> | |
24 | </properties> | |
25 | <build> | |
26 | <plugins> | |
27 | <plugin> | |
28 | <groupId>org.eclipse.tycho</groupId> | |
29 | <artifactId>tycho-surefire-plugin</artifactId> | |
30 | <version>${tycho.version}</version> | |
31 | <configuration> | |
32 | <useUIHarness>true</useUIHarness> | |
33 | <useUIThread>true</useUIThread> | |
34 | </configuration> | |
35 | </plugin> | |
36 | </plugins> | |
37 | </build> | |
38 | </project> |
1 | 1 | Bundle-ManifestVersion: 2 |
2 | 2 | Bundle-Name: %Bundle-Name |
3 | 3 | Bundle-SymbolicName: org.eclipse.ui.genericeditor;singleton:=true |
4 | Bundle-Version: 1.2.200.qualifier | |
4 | Bundle-Version: 1.2.300.qualifier | |
5 | 5 | Bundle-Vendor: %Bundle-Vendor |
6 | 6 | Bundle-RequiredExecutionEnvironment: JavaSE-11 |
7 | 7 | Require-Bundle: org.eclipse.ui.workbench.texteditor;bundle-version="3.10.0", |
+1
-0
73 | 73 | setAutoActivationDelay(0); |
74 | 74 | enableColoredLabels(true); |
75 | 75 | enableAutoActivation(true); |
76 | enableAutoActivateCompletionOnType(true); | |
76 | 77 | setInformationControlCreator(new AbstractReusableInformationControlCreator() { |
77 | 78 | @Override |
78 | 79 | protected IInformationControl doCreateInformationControl(Shell parent) { |
+5
-1
18 | 18 | import org.eclipse.compare.CompareConfiguration; |
19 | 19 | import org.eclipse.compare.contentmergeviewer.TextMergeViewer; |
20 | 20 | import org.eclipse.core.runtime.content.IContentType; |
21 | import org.eclipse.jface.preference.IPreferenceStore; | |
21 | 22 | import org.eclipse.jface.text.IDocument; |
22 | 23 | import org.eclipse.jface.text.ITextInputListener; |
23 | 24 | import org.eclipse.jface.text.TextViewer; |
24 | 25 | import org.eclipse.jface.text.source.ISourceViewer; |
25 | 26 | import org.eclipse.jface.text.source.SourceViewer; |
26 | 27 | import org.eclipse.swt.widgets.Composite; |
28 | import org.eclipse.ui.editors.text.EditorsUI; | |
27 | 29 | import org.eclipse.ui.internal.genericeditor.ExtensionBasedTextViewerConfiguration; |
28 | 30 | import org.eclipse.ui.internal.genericeditor.GenericEditorPlugin; |
31 | import org.eclipse.ui.texteditor.ChainedPreferenceStore; | |
29 | 32 | |
30 | 33 | public class GenericEditorMergeViewer extends TextMergeViewer { |
31 | 34 | |
58 | 61 | protected void configureTextViewer(TextViewer textViewer) { |
59 | 62 | if (textViewer.getDocument() != null && textViewer instanceof ISourceViewer) { |
60 | 63 | ExtensionBasedTextViewerConfiguration configuration = new ExtensionBasedTextViewerConfiguration(null, |
61 | GenericEditorPlugin.getDefault().getPreferenceStore()); | |
64 | new ChainedPreferenceStore(new IPreferenceStore[] { EditorsUI.getPreferenceStore(), | |
65 | GenericEditorPlugin.getDefault().getPreferenceStore() })); | |
62 | 66 | configuration.setFallbackContentTypes(fallbackContentTypes); |
63 | 67 | ((ISourceViewer) textViewer).configure(configuration); |
64 | 68 | } |
1 | 1 | Bundle-ManifestVersion: 2 |
2 | 2 | Bundle-Name: Examples for Generic Editor |
3 | 3 | Bundle-SymbolicName: org.eclipse.ui.genericeditor.examples;singleton:=true |
4 | Bundle-Version: 1.2.0.qualifier | |
4 | Bundle-Version: 1.2.100.qualifier | |
5 | 5 | Bundle-Vendor: Eclipse.org |
6 | 6 | Bundle-RequiredExecutionEnvironment: JavaSE-11 |
7 | 7 | Require-Bundle: org.eclipse.ui.genericeditor;bundle-version="1.0.0", |
1 | 1 | Bundle-ManifestVersion: 2 |
2 | 2 | Bundle-Name: %Plugin.name |
3 | 3 | Bundle-SymbolicName: org.eclipse.ui.genericeditor.tests;singleton:=true |
4 | Bundle-Version: 1.2.100.qualifier | |
4 | Bundle-Version: 1.2.200.qualifier | |
5 | 5 | Bundle-Vendor: %Plugin.providerName |
6 | 6 | Bundle-Localization: plugin |
7 | 7 | Export-Package: org.eclipse.ui.genericeditor.tests, |
22 | 22 | src.includes = about.html |
23 | 23 | |
24 | 24 | source.. = src/ |
25 | ||
26 | # Maven/Tycho pom model adjustments | |
27 | pom.model.property.code.ignoredWarnings = ${tests.ignoredWarnings} | |
28 | pom.model.property.testClass = org.eclipse.ui.genericeditor.tests.GenericEditorTestSuite | |
29 | pom.model.property.tycho.surefire.useUIHarness = true | |
30 | pom.model.property.tycho.surefire.useUIThread = true |
0 | <?xml version="1.0" encoding="UTF-8"?> | |
1 | <!-- | |
2 | Copyright (c) 2012, 2019 Eclipse Foundation and others. | |
3 | All rights reserved. This program and the accompanying materials | |
4 | are made available under the terms of the Eclipse Distribution License v1.0 | |
5 | which accompanies this distribution, and is available at | |
6 | http://www.eclipse.org/org/documents/edl-v10.php | |
7 | ||
8 | Contributors: | |
9 | Igor Fedorenko - initial implementation | |
10 | --> | |
11 | <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |
12 | <modelVersion>4.0.0</modelVersion> | |
13 | <parent> | |
14 | <artifactId>text-tests-pom</artifactId> | |
15 | <groupId>org.eclipse.platform</groupId> | |
16 | <version>4.25.0-SNAPSHOT</version> | |
17 | <relativePath>../tests-pom/</relativePath> | |
18 | </parent> | |
19 | <artifactId>org.eclipse.ui.genericeditor.tests</artifactId> | |
20 | <version>1.2.100-SNAPSHOT</version> | |
21 | <packaging>eclipse-test-plugin</packaging> | |
22 | <properties> | |
23 | <testClass>org.eclipse.ui.genericeditor.tests.GenericEditorTestSuite</testClass> | |
24 | </properties> | |
25 | <build> | |
26 | <plugins> | |
27 | <plugin> | |
28 | <groupId>org.eclipse.tycho</groupId> | |
29 | <artifactId>tycho-surefire-plugin</artifactId> | |
30 | <version>${tycho.version}</version> | |
31 | <configuration> | |
32 | <useUIHarness>true</useUIHarness> | |
33 | <useUIThread>true</useUIThread> | |
34 | </configuration> | |
35 | </plugin> | |
36 | </plugins> | |
37 | </build> | |
38 | </project> |
1 | 1 | Bundle-ManifestVersion: 2 |
2 | 2 | Bundle-Name: %Plugin.name |
3 | 3 | Bundle-SymbolicName: org.eclipse.ui.workbench.texteditor.tests |
4 | Bundle-Version: 3.13.100.qualifier | |
4 | Bundle-Version: 3.13.200.qualifier | |
5 | 5 | Bundle-Vendor: %Plugin.providerName |
6 | 6 | Bundle-Localization: plugin |
7 | 7 | Export-Package: |
20 | 20 | src.includes = about.html |
21 | 21 | |
22 | 22 | source.. = src/ |
23 | ||
24 | # Maven/Tycho pom model adjustments | |
25 | pom.model.property.code.ignoredWarnings = ${tests.ignoredWarnings} | |
26 | pom.model.property.testClass = org.eclipse.ui.workbench.texteditor.tests.WorkbenchTextEditorTestSuite | |
27 | pom.model.property.tycho.surefire.useUIHarness = true | |
28 | pom.model.property.tycho.surefire.useUIThread = true |
0 | <?xml version="1.0" encoding="UTF-8"?> | |
1 | <!-- | |
2 | Copyright (c) 2012, 2019 Eclipse Foundation and others. | |
3 | All rights reserved. This program and the accompanying materials | |
4 | are made available under the terms of the Eclipse Distribution License v1.0 | |
5 | which accompanies this distribution, and is available at | |
6 | http://www.eclipse.org/org/documents/edl-v10.php | |
7 | ||
8 | Contributors: | |
9 | Igor Fedorenko - initial implementation | |
10 | --> | |
11 | <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |
12 | <modelVersion>4.0.0</modelVersion> | |
13 | <parent> | |
14 | <artifactId>text-tests-pom</artifactId> | |
15 | <groupId>org.eclipse.platform</groupId> | |
16 | <version>4.25.0-SNAPSHOT</version> | |
17 | <relativePath>../tests-pom/</relativePath> | |
18 | </parent> | |
19 | <artifactId>org.eclipse.ui.workbench.texteditor.tests</artifactId> | |
20 | <version>3.13.100-SNAPSHOT</version> | |
21 | <packaging>eclipse-test-plugin</packaging> | |
22 | <properties> | |
23 | <testClass>org.eclipse.ui.workbench.texteditor.tests.WorkbenchTextEditorTestSuite</testClass> | |
24 | </properties> | |
25 | <build> | |
26 | <plugins> | |
27 | <plugin> | |
28 | <groupId>org.eclipse.tycho</groupId> | |
29 | <artifactId>tycho-surefire-plugin</artifactId> | |
30 | <version>${tycho.version}</version> | |
31 | <configuration> | |
32 | <useUIHarness>true</useUIHarness> | |
33 | <useUIThread>true</useUIThread> | |
34 | </configuration> | |
35 | </plugin> | |
36 | </plugins> | |
37 | </build> | |
38 | </project> |
14 | 14 | <parent> |
15 | 15 | <groupId>org.eclipse</groupId> |
16 | 16 | <artifactId>eclipse-platform-parent</artifactId> |
17 | <version>4.25.0-SNAPSHOT</version> | |
17 | <version>4.26.0-SNAPSHOT</version> | |
18 | 18 | <relativePath>../eclipse-platform-parent</relativePath> |
19 | 19 | </parent> |
20 | 20 |
0 | <?xml version="1.0" encoding="UTF-8"?> | |
1 | <!-- | |
2 | Copyright (c) 2013 Eclipse Foundation and others. | |
3 | All rights reserved. This program and the accompanying materials | |
4 | are made available under the terms of the Eclipse Distribution License v1.0 | |
5 | which accompanies this distribution, and is available at | |
6 | http://www.eclipse.org/org/documents/edl-v10.php | |
7 | ||
8 | Contributors: | |
9 | IBM Corporation - initial API and implementation | |
10 | --> | |
11 | <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |
12 | <modelVersion>4.0.0</modelVersion> | |
13 | <parent> | |
14 | <artifactId>eclipse.platform.text</artifactId> | |
15 | <groupId>org.eclipse.platform</groupId> | |
16 | <version>4.25.0-SNAPSHOT</version> | |
17 | </parent> | |
18 | <artifactId>text-tests-pom</artifactId> | |
19 | <packaging>pom</packaging> | |
20 | <properties> | |
21 | <code.ignoredWarnings>${tests.ignoredWarnings}</code.ignoredWarnings> | |
22 | </properties> | |
23 | </project> |