mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-21 21:52:10 +02:00
Bug 540373: Post code-cleanup for DSF examples
The DSF Examples contains some commented out source that is enabled via a script so this commit cleans that up for new formatting rules. Change-Id: I82c5e195cc3746415c659b2c0fc72b8118cdc56c
This commit is contained in:
parent
37ed2c406d
commit
f869a3f247
10 changed files with 65 additions and 65 deletions
|
@ -87,7 +87,7 @@ org.eclipse.jdt.core.compiler.problem.missingSerialVersion=ignore
|
||||||
org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
|
org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
|
||||||
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
|
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
|
||||||
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
|
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
|
||||||
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning
|
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
|
||||||
org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
|
org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
|
||||||
org.eclipse.jdt.core.compiler.problem.nonnullTypeVariableFromLegacyInvocation=warning
|
org.eclipse.jdt.core.compiler.problem.nonnullTypeVariableFromLegacyInvocation=warning
|
||||||
org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
|
org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
|
||||||
|
|
|
@ -87,7 +87,7 @@ org.eclipse.jdt.core.compiler.problem.missingSerialVersion=ignore
|
||||||
org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
|
org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
|
||||||
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
|
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
|
||||||
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
|
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
|
||||||
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning
|
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
|
||||||
org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
|
org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
|
||||||
org.eclipse.jdt.core.compiler.problem.nonnullTypeVariableFromLegacyInvocation=warning
|
org.eclipse.jdt.core.compiler.problem.nonnullTypeVariableFromLegacyInvocation=warning
|
||||||
org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
|
org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
|
||||||
|
|
|
@ -87,7 +87,7 @@ org.eclipse.jdt.core.compiler.problem.missingSerialVersion=ignore
|
||||||
org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
|
org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
|
||||||
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
|
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
|
||||||
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
|
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
|
||||||
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning
|
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
|
||||||
org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
|
org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
|
||||||
org.eclipse.jdt.core.compiler.problem.nonnullTypeVariableFromLegacyInvocation=warning
|
org.eclipse.jdt.core.compiler.problem.nonnullTypeVariableFromLegacyInvocation=warning
|
||||||
org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
|
org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
|
||||||
|
|
|
@ -87,7 +87,7 @@ org.eclipse.jdt.core.compiler.problem.missingSerialVersion=ignore
|
||||||
org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
|
org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
|
||||||
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
|
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
|
||||||
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
|
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
|
||||||
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning
|
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
|
||||||
org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
|
org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
|
||||||
org.eclipse.jdt.core.compiler.problem.nonnullTypeVariableFromLegacyInvocation=warning
|
org.eclipse.jdt.core.compiler.problem.nonnullTypeVariableFromLegacyInvocation=warning
|
||||||
org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
|
org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
|
||||||
|
|
|
@ -157,9 +157,9 @@ public class PreProcessor extends Task {
|
||||||
}
|
}
|
||||||
String contents = null;
|
String contents = null;
|
||||||
if (fileName.endsWith(".java")) {
|
if (fileName.endsWith(".java")) {
|
||||||
contents = preProcessFile(srcFile, "//#");
|
contents = preProcessFile(srcFile);
|
||||||
} else if (fileName.equals("plugin.xml")) {
|
} else if (fileName.equals("plugin.xml")) {
|
||||||
contents = preProcessFile(srcFile, null);
|
contents = preProcessFile(srcFile);
|
||||||
}
|
}
|
||||||
if (contents == null) {
|
if (contents == null) {
|
||||||
// no change, just copy file
|
// no change, just copy file
|
||||||
|
@ -186,10 +186,9 @@ public class PreProcessor extends Task {
|
||||||
* Preprocesses a file
|
* Preprocesses a file
|
||||||
*
|
*
|
||||||
* @param srcFile the file to process
|
* @param srcFile the file to process
|
||||||
* @param strip chars to stip off lines in a true condition, or <code>null</code>
|
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public String preProcessFile(File srcFile, String strip) {
|
public String preProcessFile(File srcFile) {
|
||||||
try (BufferedReader reader = new BufferedReader(new FileReader(srcFile))) {
|
try (BufferedReader reader = new BufferedReader(new FileReader(srcFile))) {
|
||||||
StringBuilder buffer = new StringBuilder();
|
StringBuilder buffer = new StringBuilder();
|
||||||
String line = reader.readLine();
|
String line = reader.readLine();
|
||||||
|
@ -262,10 +261,8 @@ public class PreProcessor extends Task {
|
||||||
}
|
}
|
||||||
if (!commandLine) {
|
if (!commandLine) {
|
||||||
if (state == STATE_OUTSIDE_CONDITION || state == STATE_TRUE_CONDITION) {
|
if (state == STATE_OUTSIDE_CONDITION || state == STATE_TRUE_CONDITION) {
|
||||||
if (state == STATE_TRUE_CONDITION && strip != null) {
|
if (state == STATE_TRUE_CONDITION) {
|
||||||
if (line.startsWith(strip)) {
|
line = line.replaceFirst("^(\t*)//#", "$1");
|
||||||
line = line.substring(strip.length());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
buffer.append(line);
|
buffer.append(line);
|
||||||
buffer.append("\n");
|
buffer.append("\n");
|
||||||
|
@ -288,8 +285,7 @@ public class PreProcessor extends Task {
|
||||||
PreProcessor processor = new PreProcessor();
|
PreProcessor processor = new PreProcessor();
|
||||||
processor.setSymbols("ex2");
|
processor.setSymbols("ex2");
|
||||||
String string = processor.preProcessFile(new File(
|
String string = processor.preProcessFile(new File(
|
||||||
"c:\\eclipse3.1\\dev\\example.debug.core\\src\\example\\debug\\core\\launcher\\PDALaunchDelegate.java"),
|
"c:\\eclipse3.1\\dev\\example.debug.core\\src\\example\\debug\\core\\launcher\\PDALaunchDelegate.java"));
|
||||||
"//#");
|
|
||||||
//String string = processor.preProcessFile(new File("c:\\eclipse3.1\\dev\\example.debug.core\\plugin.xml"), null);
|
//String string = processor.preProcessFile(new File("c:\\eclipse3.1\\dev\\example.debug.core\\plugin.xml"), null);
|
||||||
System.out.println(string);
|
System.out.println(string);
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,7 +67,7 @@ public class DataGeneratorWithExecutor implements IDataGenerator {
|
||||||
// TODO Exercise 4 - Add an annotationindicating allowed concurrency access
|
// TODO Exercise 4 - Add an annotationindicating allowed concurrency access
|
||||||
// Hint: Request and its subclasses have all their fields declared as final.
|
// Hint: Request and its subclasses have all their fields declared as final.
|
||||||
//#else
|
//#else
|
||||||
//# @Immutable
|
//#@Immutable
|
||||||
//#endif
|
//#endif
|
||||||
abstract class Request {
|
abstract class Request {
|
||||||
final RequestMonitor fRequestMonitor;
|
final RequestMonitor fRequestMonitor;
|
||||||
|
@ -93,7 +93,7 @@ public class DataGeneratorWithExecutor implements IDataGenerator {
|
||||||
// TODO Exercise 4 - Add an annotation (ThreadSafe/ConfinedToDsfExecutor)
|
// TODO Exercise 4 - Add an annotation (ThreadSafe/ConfinedToDsfExecutor)
|
||||||
// indicating allowed thread access to this class/method/member
|
// indicating allowed thread access to this class/method/member
|
||||||
//#else
|
//#else
|
||||||
//# @Immutable
|
//#@Immutable
|
||||||
//#endif
|
//#endif
|
||||||
class CountRequest extends Request {
|
class CountRequest extends Request {
|
||||||
CountRequest(DataRequestMonitor<Integer> rm) {
|
CountRequest(DataRequestMonitor<Integer> rm) {
|
||||||
|
@ -105,7 +105,7 @@ public class DataGeneratorWithExecutor implements IDataGenerator {
|
||||||
// TODO Exercise 4 - Add an annotation (ThreadSafe/ConfinedToDsfExecutor)
|
// TODO Exercise 4 - Add an annotation (ThreadSafe/ConfinedToDsfExecutor)
|
||||||
// indicating allowed thread access to this class/method/member
|
// indicating allowed thread access to this class/method/member
|
||||||
//#else
|
//#else
|
||||||
//# @Immutable
|
//#@Immutable
|
||||||
//#endif
|
//#endif
|
||||||
class ItemRequest extends Request {
|
class ItemRequest extends Request {
|
||||||
final int fIndex;
|
final int fIndex;
|
||||||
|
@ -134,7 +134,7 @@ public class DataGeneratorWithExecutor implements IDataGenerator {
|
||||||
// TODO Exercise 4 - Add an annotation (ThreadSafe/ConfinedToDsfExecutor)
|
// TODO Exercise 4 - Add an annotation (ThreadSafe/ConfinedToDsfExecutor)
|
||||||
// indicating allowed thread access to this class/method/member
|
// indicating allowed thread access to this class/method/member
|
||||||
//#else
|
//#else
|
||||||
//# @ConfinedToDsfExecutor("fExecutor")
|
//#@ConfinedToDsfExecutor("fExecutor")
|
||||||
//#endif
|
//#endif
|
||||||
private List<Request> fQueue = new LinkedList<Request>();
|
private List<Request> fQueue = new LinkedList<Request>();
|
||||||
|
|
||||||
|
@ -144,7 +144,7 @@ public class DataGeneratorWithExecutor implements IDataGenerator {
|
||||||
// TODO Exercise 4 - Add an annotation (ThreadSafe/ConfinedToDsfExecutor)
|
// TODO Exercise 4 - Add an annotation (ThreadSafe/ConfinedToDsfExecutor)
|
||||||
// indicating allowed thread access to this class/method/member
|
// indicating allowed thread access to this class/method/member
|
||||||
//#else
|
//#else
|
||||||
//# @ConfinedToDsfExecutor("fExecutor")
|
//#@ConfinedToDsfExecutor("fExecutor")
|
||||||
//#endif
|
//#endif
|
||||||
private List<Listener> fListeners = new LinkedList<Listener>();
|
private List<Listener> fListeners = new LinkedList<Listener>();
|
||||||
|
|
||||||
|
@ -153,7 +153,7 @@ public class DataGeneratorWithExecutor implements IDataGenerator {
|
||||||
// TODO Exercise 4 - Add an annotation (ThreadSafe/ConfinedToDsfExecutor)
|
// TODO Exercise 4 - Add an annotation (ThreadSafe/ConfinedToDsfExecutor)
|
||||||
// indicating allowed thread access to this class/method/member
|
// indicating allowed thread access to this class/method/member
|
||||||
//#else
|
//#else
|
||||||
//# @ConfinedToDsfExecutor("fExecutor")
|
//#@ConfinedToDsfExecutor("fExecutor")
|
||||||
//#endif
|
//#endif
|
||||||
private int fCount = MIN_COUNT;
|
private int fCount = MIN_COUNT;
|
||||||
|
|
||||||
|
@ -162,7 +162,7 @@ public class DataGeneratorWithExecutor implements IDataGenerator {
|
||||||
// TODO Exercise 4 - Add an annotation (ThreadSafe/ConfinedToDsfExecutor)
|
// TODO Exercise 4 - Add an annotation (ThreadSafe/ConfinedToDsfExecutor)
|
||||||
// indicating allowed thread access to this class/method/member
|
// indicating allowed thread access to this class/method/member
|
||||||
//#else
|
//#else
|
||||||
//# @ConfinedToDsfExecutor("fExecutor")
|
//#@ConfinedToDsfExecutor("fExecutor")
|
||||||
//#endif
|
//#endif
|
||||||
private int fCountResetTrigger = 0;
|
private int fCountResetTrigger = 0;
|
||||||
|
|
||||||
|
@ -171,7 +171,7 @@ public class DataGeneratorWithExecutor implements IDataGenerator {
|
||||||
// TODO Exercise 4 - Add an annotation (ThreadSafe/ConfinedToDsfExecutor)
|
// TODO Exercise 4 - Add an annotation (ThreadSafe/ConfinedToDsfExecutor)
|
||||||
// indicating allowed thread access to this class/method/member
|
// indicating allowed thread access to this class/method/member
|
||||||
//#else
|
//#else
|
||||||
//# @ConfinedToDsfExecutor("fExecutor")
|
//#@ConfinedToDsfExecutor("fExecutor")
|
||||||
//#endif
|
//#endif
|
||||||
private Map<Integer, Integer> fChangedValues = new HashMap<Integer, Integer>();
|
private Map<Integer, Integer> fChangedValues = new HashMap<Integer, Integer>();
|
||||||
|
|
||||||
|
@ -306,7 +306,7 @@ public class DataGeneratorWithExecutor implements IDataGenerator {
|
||||||
// TODO Exercise 4 - Add an annotation (ThreadSafe/ConfinedToDsfExecutor)
|
// TODO Exercise 4 - Add an annotation (ThreadSafe/ConfinedToDsfExecutor)
|
||||||
// indicating allowed thread access to this class/method/member
|
// indicating allowed thread access to this class/method/member
|
||||||
//#else
|
//#else
|
||||||
//# @ConfinedToDsfExecutor("fExecutor")
|
//#@ConfinedToDsfExecutor("fExecutor")
|
||||||
//#endif
|
//#endif
|
||||||
private void serviceQueue() {
|
private void serviceQueue() {
|
||||||
fExecutor.schedule(new DsfRunnable() {
|
fExecutor.schedule(new DsfRunnable() {
|
||||||
|
@ -321,7 +321,7 @@ public class DataGeneratorWithExecutor implements IDataGenerator {
|
||||||
// TODO Exercise 4 - Add an annotation (ThreadSafe/ConfinedToDsfExecutor)
|
// TODO Exercise 4 - Add an annotation (ThreadSafe/ConfinedToDsfExecutor)
|
||||||
// indicating allowed thread access to this class/method/member
|
// indicating allowed thread access to this class/method/member
|
||||||
//#else
|
//#else
|
||||||
//# @ConfinedToDsfExecutor("fExecutor")
|
//#@ConfinedToDsfExecutor("fExecutor")
|
||||||
//#endif
|
//#endif
|
||||||
private void doServiceQueue() {
|
private void doServiceQueue() {
|
||||||
//#ifdef exercises
|
//#ifdef exercises
|
||||||
|
@ -331,15 +331,15 @@ public class DataGeneratorWithExecutor implements IDataGenerator {
|
||||||
// thread. This method can safely iterate and modify fQueue without
|
// thread. This method can safely iterate and modify fQueue without
|
||||||
// risk of race conditions or concurrent modification exceptions.
|
// risk of race conditions or concurrent modification exceptions.
|
||||||
//#else
|
//#else
|
||||||
//# for (Iterator<Request> requestItr = fQueue.iterator(); requestItr.hasNext();) {
|
//#for (Iterator<Request> requestItr = fQueue.iterator(); requestItr.hasNext();) {
|
||||||
//# Request request = requestItr.next();
|
//# Request request = requestItr.next();
|
||||||
//# if (request.fRequestMonitor.isCanceled()) {
|
//# if (request.fRequestMonitor.isCanceled()) {
|
||||||
//# request.fRequestMonitor.setStatus(
|
//# request.fRequestMonitor.setStatus(
|
||||||
//# new Status(IStatus.CANCEL, DsfExamplesPlugin.PLUGIN_ID, "Request canceled"));
|
//# new Status(IStatus.CANCEL, DsfExamplesPlugin.PLUGIN_ID, "Request canceled"));
|
||||||
//# request.fRequestMonitor.done();
|
//# request.fRequestMonitor.done();
|
||||||
//# requestItr.remove();
|
//# requestItr.remove();
|
||||||
//# }
|
//# }
|
||||||
//# }
|
//#}
|
||||||
//#endif
|
//#endif
|
||||||
|
|
||||||
while (fQueue.size() != 0) {
|
while (fQueue.size() != 0) {
|
||||||
|
@ -359,7 +359,7 @@ public class DataGeneratorWithExecutor implements IDataGenerator {
|
||||||
// TODO Exercise 4 - Add an annotation (ThreadSafe/ConfinedToDsfExecutor)
|
// TODO Exercise 4 - Add an annotation (ThreadSafe/ConfinedToDsfExecutor)
|
||||||
// indicating allowed thread access to this class/method/member
|
// indicating allowed thread access to this class/method/member
|
||||||
//#else
|
//#else
|
||||||
//# @ConfinedToDsfExecutor("fExecutor")
|
//#@ConfinedToDsfExecutor("fExecutor")
|
||||||
//#endif
|
//#endif
|
||||||
private void processCountRequest(CountRequest request) {
|
private void processCountRequest(CountRequest request) {
|
||||||
@SuppressWarnings("unchecked") // Suppress warning about lost type info.
|
@SuppressWarnings("unchecked") // Suppress warning about lost type info.
|
||||||
|
@ -373,7 +373,7 @@ public class DataGeneratorWithExecutor implements IDataGenerator {
|
||||||
// TODO Exercise 4 - Add an annotation (ThreadSafe/ConfinedToDsfExecutor)
|
// TODO Exercise 4 - Add an annotation (ThreadSafe/ConfinedToDsfExecutor)
|
||||||
// indicating allowed thread access to this class/method/member
|
// indicating allowed thread access to this class/method/member
|
||||||
//#else
|
//#else
|
||||||
//# @ConfinedToDsfExecutor("fExecutor")
|
//#@ConfinedToDsfExecutor("fExecutor")
|
||||||
//#endif
|
//#endif
|
||||||
private void processItemRequest(ItemRequest request) {
|
private void processItemRequest(ItemRequest request) {
|
||||||
@SuppressWarnings("unchecked") // Suppress warning about lost type info.
|
@SuppressWarnings("unchecked") // Suppress warning about lost type info.
|
||||||
|
@ -394,7 +394,7 @@ public class DataGeneratorWithExecutor implements IDataGenerator {
|
||||||
// TODO Exercise 4 - Add an annotation (ThreadSafe/ConfinedToDsfExecutor)
|
// TODO Exercise 4 - Add an annotation (ThreadSafe/ConfinedToDsfExecutor)
|
||||||
// indicating allowed thread access to this class/method/member
|
// indicating allowed thread access to this class/method/member
|
||||||
//#else
|
//#else
|
||||||
//# @ConfinedToDsfExecutor("fExecutor")
|
//#@ConfinedToDsfExecutor("fExecutor")
|
||||||
//#endif
|
//#endif
|
||||||
private void randomChanges() {
|
private void randomChanges() {
|
||||||
// Once every number of changes, reset the count, the rest of the
|
// Once every number of changes, reset the count, the rest of the
|
||||||
|
@ -413,7 +413,7 @@ public class DataGeneratorWithExecutor implements IDataGenerator {
|
||||||
// TODO Exercise 4 - Add an annotation (ThreadSafe/ConfinedToDsfExecutor)
|
// TODO Exercise 4 - Add an annotation (ThreadSafe/ConfinedToDsfExecutor)
|
||||||
// indicating allowed thread access to this class/method/member
|
// indicating allowed thread access to this class/method/member
|
||||||
//#else
|
//#else
|
||||||
//# @ConfinedToDsfExecutor("fExecutor")
|
//#@ConfinedToDsfExecutor("fExecutor")
|
||||||
//#endif
|
//#endif
|
||||||
private void randomCountReset() {
|
private void randomCountReset() {
|
||||||
// Calculate the new count.
|
// Calculate the new count.
|
||||||
|
@ -436,7 +436,7 @@ public class DataGeneratorWithExecutor implements IDataGenerator {
|
||||||
// TODO Exercise 4 - Add an annotation (ThreadSafe/ConfinedToDsfExecutor)
|
// TODO Exercise 4 - Add an annotation (ThreadSafe/ConfinedToDsfExecutor)
|
||||||
// indicating allowed thread access to this class/method/member
|
// indicating allowed thread access to this class/method/member
|
||||||
//#else
|
//#else
|
||||||
//# @ConfinedToDsfExecutor("fExecutor")
|
//#@ConfinedToDsfExecutor("fExecutor")
|
||||||
//#endif
|
//#endif
|
||||||
private void randomDataChange() {
|
private void randomDataChange() {
|
||||||
// Calculate the indexes to change.
|
// Calculate the indexes to change.
|
||||||
|
|
|
@ -144,7 +144,7 @@ public class SyncDataViewer implements IStructuredContentProvider, IDataGenerato
|
||||||
//#ifdef exercises
|
//#ifdef exercises
|
||||||
// TODO Exercise 5 - Add a call to getElements() to force a deadlock.
|
// TODO Exercise 5 - Add a call to getElements() to force a deadlock.
|
||||||
//#else
|
//#else
|
||||||
//# getElements(null);
|
//#getElements(null);
|
||||||
//#endif
|
//#endif
|
||||||
|
|
||||||
// This method may be called on any thread, switch to the display
|
// This method may be called on any thread, switch to the display
|
||||||
|
@ -182,7 +182,7 @@ public class SyncDataViewer implements IStructuredContentProvider, IDataGenerato
|
||||||
// TODO Exercise 5 - Use the DataGeneratorWithExecutor() instead.
|
// TODO Exercise 5 - Use the DataGeneratorWithExecutor() instead.
|
||||||
final IDataGenerator generator = new DataGeneratorWithThread();
|
final IDataGenerator generator = new DataGeneratorWithThread();
|
||||||
//#else
|
//#else
|
||||||
//# final IDataGenerator generator = new DataGeneratorWithExecutor();
|
//#final IDataGenerator generator = new DataGeneratorWithExecutor();
|
||||||
//#endif
|
//#endif
|
||||||
|
|
||||||
// Create the content provider which will populate the viewer.
|
// Create the content provider which will populate the viewer.
|
||||||
|
|
|
@ -50,17 +50,17 @@ public class AsyncHelloWorld {
|
||||||
// completed.
|
// completed.
|
||||||
rm.done();
|
rm.done();
|
||||||
//#else
|
//#else
|
||||||
//# RequestMonitor rm2 = new RequestMonitor(ImmediateExecutor.getInstance(), rm);
|
//#RequestMonitor rm2 = new RequestMonitor(ImmediateExecutor.getInstance(), rm);
|
||||||
//# asyncHelloWorld2(rm2);
|
//#asyncHelloWorld2(rm2);
|
||||||
//#endif
|
//#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
//#ifdef exercises
|
//#ifdef exercises
|
||||||
// TODO: Exercise 1 - Add a second async. "Hello world 2" method.
|
// TODO: Exercise 1 - Add a second async. "Hello world 2" method.
|
||||||
//#else
|
//#else
|
||||||
//# static void asyncHelloWorld2(RequestMonitor rm) {
|
//#static void asyncHelloWorld2(RequestMonitor rm) {
|
||||||
//# System.out.println("Hello world 2");
|
//# System.out.println("Hello world 2");
|
||||||
//# rm.done();
|
//# rm.done();
|
||||||
//# }
|
//#}
|
||||||
//#endif
|
//#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,20 +64,20 @@ public class AsyncQuicksort {
|
||||||
asyncQuicksort(array, newPivot + 1, right, countingRm);
|
asyncQuicksort(array, newPivot + 1, right, countingRm);
|
||||||
countingRm.setDoneCount(2);
|
countingRm.setDoneCount(2);
|
||||||
//#else
|
//#else
|
||||||
//# asyncPartition(
|
//#asyncPartition(
|
||||||
//# array, left, right, pivot,
|
//# array, left, right, pivot,
|
||||||
//# new DataRequestMonitor<Integer>(fgExecutor, rm) {
|
//# new DataRequestMonitor<Integer>(fgExecutor, rm) {
|
||||||
//# @Override
|
//# @Override
|
||||||
//# protected void handleCompleted() {
|
//# protected void handleCompleted() {
|
||||||
//# int newPivot = getData();
|
//# int newPivot = getData();
|
||||||
//# printArray(array, left, right, newPivot);
|
//# printArray(array, left, right, newPivot);
|
||||||
//#
|
//#
|
||||||
//# CountingRequestMonitor countingRm = new CountingRequestMonitor(fgExecutor, rm);
|
//# CountingRequestMonitor countingRm = new CountingRequestMonitor(fgExecutor, rm);
|
||||||
//# asyncQuicksort(array, left, newPivot - 1, countingRm);
|
//# asyncQuicksort(array, left, newPivot - 1, countingRm);
|
||||||
//# asyncQuicksort(array, newPivot + 1, right, countingRm);
|
//# asyncQuicksort(array, newPivot + 1, right, countingRm);
|
||||||
//# countingRm.setDoneCount(2);
|
//# countingRm.setDoneCount(2);
|
||||||
//# }
|
//# }
|
||||||
//# });
|
//#});
|
||||||
//#endif
|
//#endif
|
||||||
} else {
|
} else {
|
||||||
rm.done();
|
rm.done();
|
||||||
|
@ -90,7 +90,7 @@ public class AsyncQuicksort {
|
||||||
// return value to the caller.
|
// return value to the caller.
|
||||||
static int partition(int[] array, int left, int right, int pivot)
|
static int partition(int[] array, int left, int right, int pivot)
|
||||||
//#else
|
//#else
|
||||||
//# static void asyncPartition(int[] array, int left, int right, int pivot, DataRequestMonitor<Integer> rm)
|
//#static void asyncPartition(int[] array, int left, int right, int pivot, DataRequestMonitor<Integer> rm)
|
||||||
//#endif
|
//#endif
|
||||||
{
|
{
|
||||||
int pivotValue = array[pivot];
|
int pivotValue = array[pivot];
|
||||||
|
@ -113,10 +113,10 @@ public class AsyncQuicksort {
|
||||||
// a request monitor.
|
// a request monitor.
|
||||||
return store;
|
return store;
|
||||||
//#else
|
//#else
|
||||||
//# // Java 5 automatically converts the int type of the store variable
|
//#// Java 5 automatically converts the int type of the store variable
|
||||||
//# // to an Integer object.
|
//#// to an Integer object.
|
||||||
//# rm.setData(store);
|
//#rm.setData(store);
|
||||||
//# rm.done();
|
//#rm.done();
|
||||||
//#endif
|
//#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -74,7 +74,11 @@ git ls-files -- \*\*/.project ':!core/org.eclipse.cdt.core/.project' | while re
|
||||||
sed -i \
|
sed -i \
|
||||||
'-es@compilers.p.not-externalized-att=1@compilers.p.not-externalized-att=2@' \
|
'-es@compilers.p.not-externalized-att=1@compilers.p.not-externalized-att=2@' \
|
||||||
$d/.settings/org.eclipse.pde.prefs
|
$d/.settings/org.eclipse.pde.prefs
|
||||||
|
fi
|
||||||
|
if echo $i | grep 'org.eclipse.cdt.examples.dsf' > /dev/null; then
|
||||||
|
sed -i \
|
||||||
|
'-es@org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning@org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore@' \
|
||||||
|
$d/.settings/org.eclipse.jdt.core.prefs
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
Loading…
Add table
Reference in a new issue