mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Bug 540373: Format some Java files that were missed
Some files which has other cleanups applied meant they needed to be reformatted again. e.g. the removing of type parameters shortened some lines of code that meant the wrapping changed. Change-Id: I68ca09567b9530cc2a085c33923642b6de2ec77b
This commit is contained in:
parent
ff75ae80fa
commit
3caea240a3
80 changed files with 2326 additions and 2518 deletions
|
@ -45,8 +45,7 @@ public final class PathInfo {
|
|||
fQuoteIncludePaths = quoteIncludePaths != null && quoteIncludePaths.length != 0
|
||||
? (IPath[]) quoteIncludePaths.clone()
|
||||
: EMPTY_PATH_ARRAY;
|
||||
fSymbols = symbols != null && symbols.size() != 0 ? getInternedHashMap(symbols)
|
||||
: new HashMap<>(0);
|
||||
fSymbols = symbols != null && symbols.size() != 0 ? getInternedHashMap(symbols) : new HashMap<>(0);
|
||||
fIncludeFiles = includeFiles != null && includeFiles.length != 0 ? (IPath[]) includeFiles.clone()
|
||||
: EMPTY_PATH_ARRAY;
|
||||
fMacroFiles = macroFiles != null && macroFiles.length != 0 ? (IPath[]) macroFiles.clone() : EMPTY_PATH_ARRAY;
|
||||
|
|
|
@ -339,8 +339,7 @@ public class DiscoveredPathManager implements IDiscoveredPathManager, IResourceC
|
|||
PerFileDiscoveredPathContainer container = new PerFileDiscoveredPathContainer(project);
|
||||
CoreModel.setPathEntryContainer(new ICProject[] { cProject }, container, null);
|
||||
if (changedResources != null) {
|
||||
List<PathEntryContainerChanged> changeDelta = new ArrayList<>(
|
||||
changedResources.size());
|
||||
List<PathEntryContainerChanged> changeDelta = new ArrayList<>(changedResources.size());
|
||||
for (IResource resource : changedResources) {
|
||||
IPath path = resource.getFullPath();
|
||||
changeDelta.add(
|
||||
|
|
|
@ -338,8 +338,7 @@ public class PerProjectSICollector implements IScannerInfoCollector3, IScannerIn
|
|||
LinkedHashMap<String, SymbolEntry> persistedSymbols = discPathInfo.getSymbolMap();
|
||||
|
||||
// Step 3. Merge scanner config from steps 1 and 2
|
||||
LinkedHashMap<String, SymbolEntry> candidateSymbols = new LinkedHashMap<>(
|
||||
persistedSymbols);
|
||||
LinkedHashMap<String, SymbolEntry> candidateSymbols = new LinkedHashMap<>(persistedSymbols);
|
||||
addedSymbols |= ScannerConfigUtil.scAddSymbolEntryMap2SymbolEntryMap(candidateSymbols,
|
||||
sumDiscoveredSymbols);
|
||||
|
||||
|
|
|
@ -58,8 +58,7 @@ public class Preconditions extends TestCase {
|
|||
IContentType contentTypeC = manager.getContentType(CCorePlugin.CONTENT_TYPE_CSOURCE);
|
||||
fileExts.addAll(Arrays.asList(contentTypeC.getFileSpecs(IContentType.FILE_EXTENSION_SPEC)));
|
||||
|
||||
Set<String> expectedExts = new TreeSet<>(
|
||||
Arrays.asList(new String[] { "C", "c", "c++", "cc", "cpp", "cxx" }));
|
||||
Set<String> expectedExts = new TreeSet<>(Arrays.asList(new String[] { "C", "c", "c++", "cc", "cpp", "cxx" }));
|
||||
assertEquals("Precodition FAILED - Content Types do not match expected defaults.", expectedExts.toString(),
|
||||
fileExts.toString());
|
||||
}
|
||||
|
|
|
@ -2163,8 +2163,7 @@ public class ManagedBuildManager extends AbstractCExtension {
|
|||
// Call the start up config extensions. These may rely on the standard elements
|
||||
// having already been loaded so we wait to call them from here.
|
||||
if (startUpConfigElements != null) {
|
||||
buildDefStartupList = new ArrayList<>(
|
||||
startUpConfigElements.size());
|
||||
buildDefStartupList = new ArrayList<>(startUpConfigElements.size());
|
||||
|
||||
for (IManagedConfigElement startUpConfigElement : startUpConfigElements) {
|
||||
IManagedBuildDefinitionsStartup customConfigLoader;
|
||||
|
|
|
@ -1466,8 +1466,7 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
|
|||
ICSettingEntry[] libs = CDataUtil.resolveEntries(unresolved, des);
|
||||
if (libs.length > 0) {
|
||||
for (ICExternalSetting setting : des.getExternalSettings()) {
|
||||
Set<ICSettingEntry> entries = new LinkedHashSet<>(
|
||||
Arrays.asList(setting.getEntries()));
|
||||
Set<ICSettingEntry> entries = new LinkedHashSet<>(Arrays.asList(setting.getEntries()));
|
||||
for (ICSettingEntry lib : libs) {
|
||||
if (entries.contains(lib)) {
|
||||
entries.remove(lib);
|
||||
|
|
|
@ -91,8 +91,7 @@ public class HeadlessBuilderExternalSettingsProvider extends CExternalSettingPro
|
|||
if (desc == null)
|
||||
continue;
|
||||
for (ICConfigurationDescription cfg : desc.getConfigurations()) {
|
||||
ArrayList<String> extSettingIds = new ArrayList<>(
|
||||
Arrays.asList(cfg.getExternalSettingsProviderIds()));
|
||||
ArrayList<String> extSettingIds = new ArrayList<>(Arrays.asList(cfg.getExternalSettingsProviderIds()));
|
||||
for (Iterator<String> it = extSettingIds.iterator(); it.hasNext();)
|
||||
if (ID.equals(it.next()))
|
||||
it.remove();
|
||||
|
|
|
@ -296,8 +296,7 @@ public class Option extends BuildObject implements IOption, IBuildPropertiesRest
|
|||
case UNDEF_MACRO_FILES:
|
||||
if (option.value != null) {
|
||||
@SuppressWarnings("unchecked")
|
||||
ArrayList<OptionStringValue> list = new ArrayList<>(
|
||||
(ArrayList<OptionStringValue>) option.value);
|
||||
ArrayList<OptionStringValue> list = new ArrayList<>((ArrayList<OptionStringValue>) option.value);
|
||||
value = list;
|
||||
}
|
||||
if (option.defaultValue != null) {
|
||||
|
|
|
@ -254,8 +254,7 @@ public class BuildEntryStorage extends AbstractEntryStorage {
|
|||
} else {
|
||||
// If resolved, add each resolved entry as a separate UserEntryInfo
|
||||
boolean isMultiple = rVes.length > 1;
|
||||
List<UserEntryInfo> sequense = isMultiple ? new ArrayList<>(rVes.length)
|
||||
: null;
|
||||
List<UserEntryInfo> sequense = isMultiple ? new ArrayList<>(rVes.length) : null;
|
||||
for (OptionStringValue rVe : rVes) {
|
||||
ICLanguageSettingEntry entry = createUserEntry(option, rVe, flags, subst);
|
||||
entryList.add(new UserEntryInfo(entry, ve, rVe, sequense));
|
||||
|
|
|
@ -113,8 +113,7 @@ public class PathComparator implements Comparator<IPath> {
|
|||
//all children
|
||||
SortedMap<IPath, PerTypeSetStorage<IRealBuildObjectAssociation>> children = getChildPathMap(map, path, false,
|
||||
false);
|
||||
SortedMap<IPath, PerTypeSetStorage<IRealBuildObjectAssociation>> result = new TreeMap<>(
|
||||
INSTANCE);
|
||||
SortedMap<IPath, PerTypeSetStorage<IRealBuildObjectAssociation>> result = new TreeMap<>(INSTANCE);
|
||||
for (Iterator<Map.Entry<IPath, PerTypeSetStorage<IRealBuildObjectAssociation>>> iter = children.entrySet()
|
||||
.iterator(); iter.hasNext(); iter = children.entrySet().iterator()) {
|
||||
Map.Entry<IPath, PerTypeSetStorage<IRealBuildObjectAssociation>> entry = iter.next();
|
||||
|
|
|
@ -213,8 +213,7 @@ public class TcModificationUtil {
|
|||
int[] types = new int[] { IRealBuildObjectAssociation.OBJECT_TOOLCHAIN,
|
||||
IRealBuildObjectAssociation.OBJECT_BUILDER, IRealBuildObjectAssociation.OBJECT_TOOL, };
|
||||
|
||||
TreeMap<IPath, PerTypeSetStorage<IRealBuildObjectAssociation>> result = new TreeMap<>(
|
||||
PathComparator.INSTANCE);
|
||||
TreeMap<IPath, PerTypeSetStorage<IRealBuildObjectAssociation>> result = new TreeMap<>(PathComparator.INSTANCE);
|
||||
@SuppressWarnings("unchecked")
|
||||
TreeMap<IPath, PerTypeSetStorage<IRealBuildObjectAssociation>> clone = (TreeMap<IPath, PerTypeSetStorage<IRealBuildObjectAssociation>>) initialMap
|
||||
.clone();
|
||||
|
@ -572,8 +571,7 @@ public class TcModificationUtil {
|
|||
public static TreeMap<IPath, PerTypeSetStorage<IRealBuildObjectAssociation>> createPathMap(
|
||||
PerTypeMapStorage<IRealBuildObjectAssociation, Set<IPath>> storage) {
|
||||
int[] types = ObjectTypeBasedStorage.getSupportedObjectTypes();
|
||||
TreeMap<IPath, PerTypeSetStorage<IRealBuildObjectAssociation>> result = new TreeMap<>(
|
||||
PathComparator.INSTANCE);
|
||||
TreeMap<IPath, PerTypeSetStorage<IRealBuildObjectAssociation>> result = new TreeMap<>(PathComparator.INSTANCE);
|
||||
for (int i = 0; i < types.length; i++) {
|
||||
int type = types[i];
|
||||
Map<IRealBuildObjectAssociation, Set<IPath>> map = storage.getMap(type, false);
|
||||
|
|
|
@ -247,8 +247,7 @@ public abstract class ToolListModification implements IToolListModification {
|
|||
fOperations = new ModificationOperation[0];
|
||||
}
|
||||
} else {
|
||||
List<ModificationOperation> opList = new ArrayList<>(
|
||||
fCompatibleTools.size() + 1);
|
||||
List<ModificationOperation> opList = new ArrayList<>(fCompatibleTools.size() + 1);
|
||||
Set<Tool> keySet = fCompatibleTools.keySet();
|
||||
for (Tool tool : keySet) {
|
||||
if (tool == fRealTool)
|
||||
|
|
|
@ -183,8 +183,8 @@ public class CodanCorePlugin extends Plugin {
|
|||
if (bundle != null) {
|
||||
BundleContext context = bundle.getBundleContext();
|
||||
if (context != null) {
|
||||
ServiceTracker<DebugOptions, DebugOptions> tracker = new ServiceTracker<>(
|
||||
context, DebugOptions.class.getName(), null);
|
||||
ServiceTracker<DebugOptions, DebugOptions> tracker = new ServiceTracker<>(context,
|
||||
DebugOptions.class.getName(), null);
|
||||
try {
|
||||
tracker.open();
|
||||
debugOptions = tracker.getService();
|
||||
|
|
|
@ -534,16 +534,14 @@ public class LanguageSettingsListenersTests extends BaseTestCase {
|
|||
// add global provider which is not engaged
|
||||
ILanguageSettingsProvider provider = new MockListenerRegisterer(PROVIDER_CUSTOM_GLOBAL,
|
||||
PROVIDER_CUSTOM_GLOBAL_NAME);
|
||||
List<ILanguageSettingsProvider> providers = new ArrayList<>(
|
||||
workspaceProvidersOriginal);
|
||||
List<ILanguageSettingsProvider> providers = new ArrayList<>(workspaceProvidersOriginal);
|
||||
providers.add(provider);
|
||||
LanguageSettingsManager.setWorkspaceProviders(providers);
|
||||
assertEquals(0, MockListenerRegisterer.getCount(PROVIDER_CUSTOM_GLOBAL));
|
||||
}
|
||||
{
|
||||
// remove global provider and restore original list
|
||||
List<ILanguageSettingsProvider> providers = new ArrayList<>(
|
||||
workspaceProvidersOriginal);
|
||||
List<ILanguageSettingsProvider> providers = new ArrayList<>(workspaceProvidersOriginal);
|
||||
LanguageSettingsManager.setWorkspaceProviders(providers);
|
||||
assertEquals(0, MockListenerRegisterer.getCount(PROVIDER_CUSTOM_GLOBAL));
|
||||
}
|
||||
|
@ -601,8 +599,7 @@ public class LanguageSettingsListenersTests extends BaseTestCase {
|
|||
}
|
||||
{
|
||||
// remove global provider
|
||||
List<ILanguageSettingsProvider> providers = new ArrayList<>(
|
||||
workspaceProvidersOriginal);
|
||||
List<ILanguageSettingsProvider> providers = new ArrayList<>(workspaceProvidersOriginal);
|
||||
LanguageSettingsManager.setWorkspaceProviders(providers);
|
||||
assertEquals(0, MockListenerRegisterer.getCount(PROVIDER_CUSTOM_GLOBAL));
|
||||
}
|
||||
|
|
|
@ -598,8 +598,7 @@ public class CProjectDescriptionDeltaTests extends BaseTestCase {
|
|||
assertNotNull(cfgDescription);
|
||||
|
||||
// Modification SOURCE_ADDED
|
||||
List<ICSourceEntry> sourceEntries = new ArrayList<>(
|
||||
Arrays.asList(cfgDescription.getSourceEntries()));
|
||||
List<ICSourceEntry> sourceEntries = new ArrayList<>(Arrays.asList(cfgDescription.getSourceEntries()));
|
||||
ICSourceEntry testSourceEntry = new CSourceEntry(project.getFullPath().append("test_src"), null,
|
||||
ICSettingEntry.RESOLVED);
|
||||
sourceEntries.add(testSourceEntry);
|
||||
|
@ -648,8 +647,7 @@ public class CProjectDescriptionDeltaTests extends BaseTestCase {
|
|||
ICConfigurationDescription cfgDescription = prjDescription.getConfigurations()[0];
|
||||
assertNotNull(cfgDescription);
|
||||
|
||||
List<ICSourceEntry> sourceEntries = new ArrayList<>(
|
||||
Arrays.asList(cfgDescription.getSourceEntries()));
|
||||
List<ICSourceEntry> sourceEntries = new ArrayList<>(Arrays.asList(cfgDescription.getSourceEntries()));
|
||||
sourceEntries.add(testSourceEntry);
|
||||
cfgDescription.setSourceEntries(sourceEntries.toArray(new ICSourceEntry[0]));
|
||||
|
||||
|
|
|
@ -244,8 +244,7 @@ public class ProjectLanguageConfiguration {
|
|||
* @param file
|
||||
*/
|
||||
public void setFileMappings(IFile file, Map<String, String> mappings) {
|
||||
fFileConfigurationMappings.put(file.getProjectRelativePath().toPortableString(),
|
||||
new TreeMap<>(mappings));
|
||||
fFileConfigurationMappings.put(file.getProjectRelativePath().toPortableString(), new TreeMap<>(mappings));
|
||||
}
|
||||
|
||||
private Map<String, Map<String, String>> copyLanguageMappings(Map<String, Map<String, String>> mappings,
|
||||
|
|
|
@ -1208,8 +1208,7 @@ public class LanguageSettingsProvidersSerializer {
|
|||
String[] ids = ((ILanguageSettingsProvidersKeeper) cfgDescription)
|
||||
.getDefaultLanguageSettingsProvidersIds();
|
||||
if (ids != null) {
|
||||
List<ILanguageSettingsProvider> providers = new ArrayList<>(
|
||||
ids.length);
|
||||
List<ILanguageSettingsProvider> providers = new ArrayList<>(ids.length);
|
||||
for (String id : ids) {
|
||||
if (LanguageSettingsExtensionManager.isPreferShared(id)) {
|
||||
providers.add(LanguageSettingsManager.getWorkspaceProvider(id));
|
||||
|
|
|
@ -190,8 +190,7 @@ public class XmlProjectDescriptionStorage extends AbstractCProjectDescriptionSto
|
|||
|
||||
/** A soft reference to the read-only project description
|
||||
* Volatile provides a memory barrier in Java 5+ */
|
||||
private volatile Reference<ICProjectDescription> fProjectDescription = new SoftReference<>(
|
||||
null);
|
||||
private volatile Reference<ICProjectDescription> fProjectDescription = new SoftReference<>(null);
|
||||
/** The last modification stamp of the .cproject project description file */
|
||||
private volatile long projectModificaitonStamp = IResource.NULL_STAMP;
|
||||
|
||||
|
|
|
@ -153,8 +153,7 @@ public class ExternalExportProjectProvider extends AbstractExportProjectProvider
|
|||
content.createLink(new Path(location.getAbsolutePath()), IResource.NONE, null);
|
||||
|
||||
// Setup path entries
|
||||
List<IPathEntry> entries = new ArrayList<>(
|
||||
Arrays.asList(CoreModel.getRawPathEntries(cproject)));
|
||||
List<IPathEntry> entries = new ArrayList<>(Arrays.asList(CoreModel.getRawPathEntries(cproject)));
|
||||
|
||||
// pre-include files
|
||||
for (String path : includeFiles) {
|
||||
|
|
|
@ -152,8 +152,7 @@ public class Profiler {
|
|||
}
|
||||
|
||||
if (!profiler.counters.isEmpty()) {
|
||||
List<Map.Entry<String, int[]>> keyList = new ArrayList<>(
|
||||
profiler.counters.entrySet());
|
||||
List<Map.Entry<String, int[]>> keyList = new ArrayList<>(profiler.counters.entrySet());
|
||||
Comparator<Map.Entry<String, int[]>> c2 = new Comparator<Map.Entry<String, int[]>>() {
|
||||
@Override
|
||||
public int compare(Entry<String, int[]> o1, Entry<String, int[]> o2) {
|
||||
|
|
|
@ -256,8 +256,7 @@ public class UserDefinedEnvironmentSupplier extends StorableEnvironmentLoader
|
|||
|
||||
private IEnvironmentVariable[] combineVariables(IEnvironmentVariable[] oldVariables,
|
||||
IEnvironmentVariable[] newVariables) {
|
||||
Map<String, IEnvironmentVariable> vars = new HashMap<>(
|
||||
oldVariables.length + newVariables.length);
|
||||
Map<String, IEnvironmentVariable> vars = new HashMap<>(oldVariables.length + newVariables.length);
|
||||
for (IEnvironmentVariable variable : oldVariables)
|
||||
vars.put(variable.getName(), variable);
|
||||
for (IEnvironmentVariable variable : newVariables) {
|
||||
|
|
|
@ -131,8 +131,7 @@ public class FoldingTest extends FoldingTestBase {
|
|||
}
|
||||
|
||||
private void assertNoKeyCollisions() {
|
||||
ProjectionAnnotationModel model = fEditor
|
||||
.getAdapter(ProjectionAnnotationModel.class);
|
||||
ProjectionAnnotationModel model = fEditor.getAdapter(ProjectionAnnotationModel.class);
|
||||
assertNotNull(model);
|
||||
int annotations = 0;
|
||||
Set<Object> keys = new HashSet<>();
|
||||
|
|
|
@ -253,8 +253,7 @@ abstract public class FoldingTestBase extends BaseUITestCase {
|
|||
|
||||
protected PositionAndCollapsed[] getFoldingPositions() {
|
||||
List<PositionAndCollapsed> positionAndCollapseds = new ArrayList<>();
|
||||
ProjectionAnnotationModel model = fEditor
|
||||
.getAdapter(ProjectionAnnotationModel.class);
|
||||
ProjectionAnnotationModel model = fEditor.getAdapter(ProjectionAnnotationModel.class);
|
||||
assertNotNull(model);
|
||||
for (Iterator<Annotation> iter = model.getAnnotationIterator(); iter.hasNext();) {
|
||||
Annotation ann = iter.next();
|
||||
|
|
|
@ -1344,8 +1344,7 @@ public class CEditor extends TextEditor
|
|||
* AST reconciling listeners.
|
||||
* @since 4.0
|
||||
*/
|
||||
private final ListenerList<ICReconcilingListener> fReconcilingListeners = new ListenerList<>(
|
||||
ListenerList.IDENTITY);
|
||||
private final ListenerList<ICReconcilingListener> fReconcilingListeners = new ListenerList<>(ListenerList.IDENTITY);
|
||||
|
||||
/**
|
||||
* Semantic highlighting manager
|
||||
|
|
|
@ -57,8 +57,7 @@ class EclipsePreferencesAdapter implements IPreferenceStore {
|
|||
}
|
||||
|
||||
/** Listeners on on this adapter */
|
||||
private ListenerList<IPropertyChangeListener> fListeners = new ListenerList<>(
|
||||
ListenerList.IDENTITY);
|
||||
private ListenerList<IPropertyChangeListener> fListeners = new ListenerList<>(ListenerList.IDENTITY);
|
||||
|
||||
/** Listener on the node */
|
||||
private IEclipsePreferences.IPreferenceChangeListener fListener = new PreferenceChangeListener();
|
||||
|
|
|
@ -253,8 +253,7 @@ public class ProjectLanguageMappingWidget extends LanguageMappingWidget {
|
|||
}
|
||||
|
||||
if (fChild != null) {
|
||||
Set<String> overrides = new HashSet<>(
|
||||
createWorkspaceContentTypeFilter(fConfigurationContentTypeMappings));
|
||||
Set<String> overrides = new HashSet<>(createWorkspaceContentTypeFilter(fConfigurationContentTypeMappings));
|
||||
fChild.setOverriddenContentTypes(overrides);
|
||||
fChild.refreshMappings();
|
||||
}
|
||||
|
|
|
@ -1190,8 +1190,7 @@ public class LanguageSettingsEntriesTab extends AbstractCPropertyTab {
|
|||
IResource rc = getResource();
|
||||
List<ILanguageSettingsProvider> oldProviders = ((ILanguageSettingsProvidersKeeper) cfgDescription)
|
||||
.getLanguageSettingProviders();
|
||||
List<ILanguageSettingsProvider> newProviders = new ArrayList<>(
|
||||
oldProviders.size());
|
||||
List<ILanguageSettingsProvider> newProviders = new ArrayList<>(oldProviders.size());
|
||||
|
||||
// clear entries for a given resource for all languages where applicable
|
||||
providers: for (ILanguageSettingsProvider provider : oldProviders) {
|
||||
|
|
|
@ -74,8 +74,7 @@ abstract class AbstractWorkingSetConfigsContribution extends CompoundContributio
|
|||
}
|
||||
|
||||
// sort the configurations by name
|
||||
List<IWorkingSetConfiguration> configs = new java.util.ArrayList<>(
|
||||
getWorkingSet().getConfigurations());
|
||||
List<IWorkingSetConfiguration> configs = new java.util.ArrayList<>(getWorkingSet().getConfigurations());
|
||||
Collections.sort(configs, configOrdering);
|
||||
|
||||
IContributionItem[] result = new IContributionItem[configs.size()];
|
||||
|
|
|
@ -210,8 +210,7 @@ public interface IWorkingSetProjectConfigurationFactory {
|
|||
// first pass to populate the map with immediate requireds
|
||||
IWorkspace ws = ResourcesPlugin.getWorkspace();
|
||||
for (IProjectNatureDescriptor next : ws.getNatureDescriptors()) {
|
||||
result.put(next.getNatureId(),
|
||||
new java.util.HashSet<>(Arrays.asList(next.getRequiredNatureIds())));
|
||||
result.put(next.getNatureId(), new java.util.HashSet<>(Arrays.asList(next.getRequiredNatureIds())));
|
||||
}
|
||||
|
||||
// now, iterate to add transitive requireds
|
||||
|
|
|
@ -181,8 +181,7 @@ public class WorkingSetConfiguration implements IWorkingSetConfiguration {
|
|||
public IStatus build(IProgressMonitor monitor) {
|
||||
MultiStatus result = new MultiStatus(CUIPlugin.PLUGIN_ID, 0, WorkingSetMessages.WSConfig_build_problems, null);
|
||||
|
||||
List<IWorkingSetProjectConfiguration> toBuild = new java.util.ArrayList<>(
|
||||
getProjectConfigurations().size());
|
||||
List<IWorkingSetProjectConfiguration> toBuild = new java.util.ArrayList<>(getProjectConfigurations().size());
|
||||
for (IWorkingSetProjectConfiguration next : getProjectConfigurations()) {
|
||||
IProject project = next.resolveProject();
|
||||
|
||||
|
|
|
@ -89,8 +89,7 @@ public class CHelpConfigurationPropertyPage extends PropertyPage implements IWor
|
|||
/* 0 */ CUIMessages.CHelpConfigurationPropertyPage_buttonLabels_CheckAll,
|
||||
/* 1 */ CUIMessages.CHelpConfigurationPropertyPage_buttonLabels_UncheckAll };
|
||||
|
||||
fCHelpBookList = new CheckedListDialogField<>(null, buttonLabels,
|
||||
new CHelpBookListLabelProvider());
|
||||
fCHelpBookList = new CheckedListDialogField<>(null, buttonLabels, new CHelpBookListLabelProvider());
|
||||
fCHelpBookList.setLabelText(CUIMessages.CHelpConfigurationPropertyPage_HelpBooks);
|
||||
fCHelpBookList.setCheckAllButtonIndex(0);
|
||||
fCHelpBookList.setUncheckAllButtonIndex(1);
|
||||
|
|
|
@ -81,8 +81,7 @@ public class TemplateClassWizard extends TemplatesChoiceWizard implements INewWi
|
|||
|
||||
@Override
|
||||
public Template[] getTemplates() {
|
||||
SortedSet<TemplateCore> templateList = new TreeSet<>(
|
||||
TemplateCore.TEMPLATE_ID_CASE_INSENSITIVE_COMPARATOR);
|
||||
SortedSet<TemplateCore> templateList = new TreeSet<>(TemplateCore.TEMPLATE_ID_CASE_INSENSITIVE_COMPARATOR);
|
||||
templateList.addAll(Arrays.asList(TemplateEngineUI.getDefault().getTemplates()));
|
||||
return templateList.toArray(new Template[templateList.size()]);
|
||||
}
|
||||
|
|
|
@ -100,7 +100,6 @@ public class TemplateInputDialog extends Dialog {
|
|||
setShellStyle(getShellStyle() | SWT.RESIZE);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void configureShell(Shell shell) {
|
||||
super.configureShell(shell);
|
||||
|
@ -108,7 +107,6 @@ public class TemplateInputDialog extends Dialog {
|
|||
display = shell.getDisplay();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected Control createDialogArea(Composite parent) {
|
||||
|
||||
|
@ -216,7 +214,6 @@ public class TemplateInputDialog extends Dialog {
|
|||
aText.addModifyListener(mListener);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void okPressed() {
|
||||
if (option == TemplatePreferencePage.OPTION_ADD) {
|
||||
|
|
|
@ -127,8 +127,8 @@ public class Trace {
|
|||
if (bundle != null) {
|
||||
BundleContext context = bundle.getBundleContext();
|
||||
if (context != null) {
|
||||
ServiceTracker<DebugOptions, DebugOptions> tracker = new ServiceTracker<>(
|
||||
context, DebugOptions.class.getName(), null);
|
||||
ServiceTracker<DebugOptions, DebugOptions> tracker = new ServiceTracker<>(context,
|
||||
DebugOptions.class.getName(), null);
|
||||
try {
|
||||
tracker.open();
|
||||
DebugOptions debugOptions = tracker.getService();
|
||||
|
|
|
@ -313,8 +313,7 @@ public class CSourceNotFoundEditor extends CommonSourceNotFoundEditor {
|
|||
|
||||
private void addSourceMappingToDirector(String missingPath, IPath newSourcePath,
|
||||
AbstractSourceLookupDirector director) throws CoreException {
|
||||
ArrayList<ISourceContainer> containerList = new ArrayList<>(
|
||||
Arrays.asList(director.getSourceContainers()));
|
||||
ArrayList<ISourceContainer> containerList = new ArrayList<>(Arrays.asList(director.getSourceContainers()));
|
||||
MappingSourceContainer foundMappings = null;
|
||||
for (ISourceContainer container : containerList) {
|
||||
if (container instanceof MappingSourceContainer) {
|
||||
|
|
|
@ -77,8 +77,7 @@ public class SourceFilesViewer extends BaseViewer {
|
|||
/** Tradeoff expensiveness of checking filesystem against likelihood
|
||||
* that files will be added/removed/changed in the given time period */
|
||||
static final long FILE_CHECK_DELTA = 30 * 1000;
|
||||
private static LRUCache<Object, TranslationUnitInfo> translationUnitInfoCache = new LRUCache<>(
|
||||
1024);
|
||||
private static LRUCache<Object, TranslationUnitInfo> translationUnitInfoCache = new LRUCache<>(1024);
|
||||
|
||||
public SourceFilesViewer(ExecutablesView view, Composite parent, int style) {
|
||||
super(view, parent, style);
|
||||
|
|
|
@ -662,8 +662,7 @@ public class GDBPatternMatchingExpressions extends AbstractDsfService implements
|
|||
// Not only does selecting the element jump back and forth between the duplicates,
|
||||
// but children of duplicated elements are not always right. Because of this, we
|
||||
// remove all duplicates here.
|
||||
LinkedHashSet<IExpressionDMContext> uniqueSubExprSet = new LinkedHashSet<>(
|
||||
subExprList);
|
||||
LinkedHashSet<IExpressionDMContext> uniqueSubExprSet = new LinkedHashSet<>(subExprList);
|
||||
subExprList.clear();
|
||||
subExprList.addAll(uniqueSubExprSet);
|
||||
|
||||
|
@ -776,8 +775,7 @@ public class GDBPatternMatchingExpressions extends AbstractDsfService implements
|
|||
matchArrays(exprDmc, new ImmediateDataRequestMonitor<List<IExpressionDMContext>>(rm) {
|
||||
@Override
|
||||
protected void handleSuccess() {
|
||||
final List<IExpressionDMContext> exprList = getData() != null ? getData()
|
||||
: new ArrayList<>();
|
||||
final List<IExpressionDMContext> exprList = getData() != null ? getData() : new ArrayList<>();
|
||||
matchLocals(exprDmc, new ImmediateDataRequestMonitor<List<IExpressionDMContext>>(rm) {
|
||||
@Override
|
||||
protected void handleSuccess() {
|
||||
|
@ -865,8 +863,7 @@ public class GDBPatternMatchingExpressions extends AbstractDsfService implements
|
|||
final CountingRequestMonitor varNameCRM = new CountingRequestMonitor(getExecutor(), rm) {
|
||||
@Override
|
||||
public void handleSuccess() {
|
||||
ArrayList<IExpressionDMContext> matches = new ArrayList<>(
|
||||
localsDMData.length);
|
||||
ArrayList<IExpressionDMContext> matches = new ArrayList<>(localsDMData.length);
|
||||
|
||||
String fullExpr = globDmc.getExpression().trim();
|
||||
if (fullExpr.startsWith(GLOB_EXPRESSION_PREFIX)) {
|
||||
|
|
|
@ -2595,8 +2595,7 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService
|
|||
Set<IExecutionDMContext> specifiedExedDmcSet = new HashSet<>(Arrays.asList(contexts));
|
||||
|
||||
// A list that ignores threads for which the process is also present
|
||||
List<IExecutionDMContext> execDmcForOperationList = new ArrayList<>(
|
||||
specifiedExedDmcSet.size());
|
||||
List<IExecutionDMContext> execDmcForOperationList = new ArrayList<>(specifiedExedDmcSet.size());
|
||||
|
||||
// Check for the case of a process selected along with some of its threads
|
||||
for (IExecutionDMContext execDmc : specifiedExedDmcSet) {
|
||||
|
|
|
@ -170,8 +170,7 @@ public class SyncUtil {
|
|||
|
||||
public static MIStoppedEvent step(final IExecutionDMContext dmc, final StepType stepType, boolean reverse,
|
||||
int massagedTimeout) throws Throwable {
|
||||
final ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<>(fSession,
|
||||
MIStoppedEvent.class);
|
||||
final ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<>(fSession, MIStoppedEvent.class);
|
||||
|
||||
if (!reverse) {
|
||||
fRunControl.getExecutor().submit(new Runnable() {
|
||||
|
@ -280,8 +279,7 @@ public class SyncUtil {
|
|||
|
||||
private static MIStoppedEvent resumeUntilStopped(final IExecutionDMContext dmc, int massagedTimeout)
|
||||
throws Throwable {
|
||||
final ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<>(fSession,
|
||||
MIStoppedEvent.class);
|
||||
final ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<>(fSession, MIStoppedEvent.class);
|
||||
|
||||
fRunControl.getExecutor().submit(new Runnable() {
|
||||
@Override
|
||||
|
@ -308,8 +306,7 @@ public class SyncUtil {
|
|||
}
|
||||
|
||||
public static MIRunningEvent resume(final IExecutionDMContext dmc, int massagedTimeout) throws Throwable {
|
||||
final ServiceEventWaitor<MIRunningEvent> eventWaitor = new ServiceEventWaitor<>(fSession,
|
||||
MIRunningEvent.class);
|
||||
final ServiceEventWaitor<MIRunningEvent> eventWaitor = new ServiceEventWaitor<>(fSession, MIRunningEvent.class);
|
||||
|
||||
fRunControl.getExecutor().submit(new Runnable() {
|
||||
@Override
|
||||
|
@ -378,8 +375,7 @@ public class SyncUtil {
|
|||
// if there is a sleep in the code between the resume and the time
|
||||
// it stops; this will give us plenty of time to call this method.
|
||||
public static MIStoppedEvent waitForStop(int timeout) throws Throwable {
|
||||
final ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<>(fSession,
|
||||
MIStoppedEvent.class);
|
||||
final ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<>(fSession, MIStoppedEvent.class);
|
||||
|
||||
// Wait for the execution to suspend
|
||||
return eventWaitor.waitForEvent(TestsPlugin.massageTimeout(timeout));
|
||||
|
@ -778,8 +774,7 @@ public class SyncUtil {
|
|||
}
|
||||
|
||||
// Now wait for the stopped event of the restart
|
||||
final ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<>(fSession,
|
||||
MIStoppedEvent.class);
|
||||
final ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<>(fSession, MIStoppedEvent.class);
|
||||
|
||||
// Perform the restart
|
||||
Query<IContainerDMContext> query2 = new Query<IContainerDMContext>() {
|
||||
|
|
|
@ -97,8 +97,8 @@ public class CommandTimeoutTest extends BaseParametrizedTestCase {
|
|||
doLaunch();
|
||||
|
||||
final DsfSession session = getGDBLaunch().getSession();
|
||||
ServiceEventWaitor<ICommandControlShutdownDMEvent> shutdownEventWaitor = new ServiceEventWaitor<>(
|
||||
session, ICommandControlShutdownDMEvent.class);
|
||||
ServiceEventWaitor<ICommandControlShutdownDMEvent> shutdownEventWaitor = new ServiceEventWaitor<>(session,
|
||||
ICommandControlShutdownDMEvent.class);
|
||||
|
||||
// Send the command that will timeout
|
||||
Query<MIInfo> query = new Query<MIInfo>() {
|
||||
|
|
|
@ -714,8 +714,7 @@ public class LaunchConfigurationAndRestartTest extends BaseParametrizedTestCase
|
|||
|
||||
// Now step backwards to make sure reverse was enabled
|
||||
|
||||
final ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<>(fSession,
|
||||
MIStoppedEvent.class);
|
||||
final ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<>(fSession, MIStoppedEvent.class);
|
||||
|
||||
final int REVERSE_NUM_STEPS = 2;
|
||||
final IExecutionDMContext execDmc = stoppedEvent.getDMContext();
|
||||
|
@ -780,8 +779,7 @@ public class LaunchConfigurationAndRestartTest extends BaseParametrizedTestCase
|
|||
frame.getFunction().equals("stopAtOther"));
|
||||
|
||||
// Now step backwards all the way to the start to make sure reverse was enabled from the very start
|
||||
final ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<>(fSession,
|
||||
MIStoppedEvent.class);
|
||||
final ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<>(fSession, MIStoppedEvent.class);
|
||||
|
||||
final int REVERSE_NUM_STEPS = 3;
|
||||
Query<MIInfo> query2 = new Query<MIInfo>() {
|
||||
|
@ -854,8 +852,7 @@ public class LaunchConfigurationAndRestartTest extends BaseParametrizedTestCase
|
|||
frame.getFunction().equals("main") && frame.getLine() == LAST_LINE_IN_MAIN);
|
||||
|
||||
// Now step backwards all the way to the start to make sure reverse was enabled from the very start
|
||||
final ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<>(fSession,
|
||||
MIStoppedEvent.class);
|
||||
final ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<>(fSession, MIStoppedEvent.class);
|
||||
|
||||
final int REVERSE_NUM_STEPS = 3;
|
||||
Query<MIInfo> query2 = new Query<MIInfo>() {
|
||||
|
|
|
@ -1302,8 +1302,7 @@ public class MICatchpointsTest extends BaseParametrizedTestCase {
|
|||
assertEquals("Unexpected number of breakpoint-added events", 1, getBreakpointEventCount(BP_ADDED));
|
||||
|
||||
// Ensure the breakpoint service sees what we expect
|
||||
List<IBreakpointDMContext> bkptsAfter = new LinkedList<>(
|
||||
Arrays.asList(getBreakpoints(fBreakpointsDmc)));
|
||||
List<IBreakpointDMContext> bkptsAfter = new LinkedList<>(Arrays.asList(getBreakpoints(fBreakpointsDmc)));
|
||||
assertEquals("Breakpoints service reports unexpected number of breakpoints", bkptsBefore.length + 1,
|
||||
bkptsAfter.size());
|
||||
|
||||
|
@ -1361,8 +1360,7 @@ public class MICatchpointsTest extends BaseParametrizedTestCase {
|
|||
// Ensure the breakpoint service sees what we expect. Ask the breakpoint
|
||||
// service for the list of breakpoint against and make sure it differs
|
||||
// only by the newly added one
|
||||
List<IBreakpointDMContext> bkptsAfter = new LinkedList<>(
|
||||
Arrays.asList(getBreakpoints(fBreakpointsDmc)));
|
||||
List<IBreakpointDMContext> bkptsAfter = new LinkedList<>(Arrays.asList(getBreakpoints(fBreakpointsDmc)));
|
||||
assertEquals("Breakpoints service reports unexpected number of breakpoints", bkptsBefore.length + 1,
|
||||
bkptsAfter.size());
|
||||
ListIterator<IBreakpointDMContext> iter = bkptsAfter.listIterator();
|
||||
|
|
|
@ -224,8 +224,8 @@ public class MIModifiedServicesTest extends BaseParametrizedTestCase {
|
|||
|
||||
private void resumeContainerContextExe() throws InterruptedException, ExecutionException, TimeoutException {
|
||||
|
||||
final ServiceEventWaitor<IResumedDMEvent> resumedWaitor = new ServiceEventWaitor<>(
|
||||
getGDBLaunch().getSession(), IResumedDMEvent.class);
|
||||
final ServiceEventWaitor<IResumedDMEvent> resumedWaitor = new ServiceEventWaitor<>(getGDBLaunch().getSession(),
|
||||
IResumedDMEvent.class);
|
||||
|
||||
Query<Void> query = new Query<Void>() {
|
||||
@Override
|
||||
|
|
|
@ -413,8 +413,8 @@ public class MIRegistersTest extends BaseParametrizedTestCase {
|
|||
*/
|
||||
private List<IRegistersChangedDMEvent> writeRegisterWaitNotication(final IRegisterDMContext registerDmc,
|
||||
final String regValue, final String formatId) throws Throwable {
|
||||
ServiceEventWaitor<IRegistersChangedDMEvent> eventWaitor = new ServiceEventWaitor<>(
|
||||
fSession, IRegistersChangedDMEvent.class);
|
||||
ServiceEventWaitor<IRegistersChangedDMEvent> eventWaitor = new ServiceEventWaitor<>(fSession,
|
||||
IRegistersChangedDMEvent.class);
|
||||
|
||||
writeRegister(registerDmc, regValue, formatId);
|
||||
|
||||
|
|
|
@ -372,8 +372,7 @@ public class MIRunControlTargetAvailableTest extends BaseParametrizedTestCase {
|
|||
// Wait up to 3 second for the target to suspend. Should happen within two seconds.
|
||||
suspendedEventWaitor.waitForEvent(TestsPlugin.massageTimeout(3000));
|
||||
|
||||
suspendedEventWaitor = new ServiceEventWaitor<>(getGDBLaunch().getSession(),
|
||||
ISuspendedDMEvent.class);
|
||||
suspendedEventWaitor = new ServiceEventWaitor<>(getGDBLaunch().getSession(), ISuspendedDMEvent.class);
|
||||
|
||||
SyncUtil.resume();
|
||||
|
||||
|
@ -575,8 +574,7 @@ public class MIRunControlTargetAvailableTest extends BaseParametrizedTestCase {
|
|||
suspendedEventWaitor.waitForEvent(TestsPlugin.massageTimeout(3000));
|
||||
|
||||
// Now resume the target and check that we stop at all the breakpoints.
|
||||
suspendedEventWaitor = new ServiceEventWaitor<>(getGDBLaunch().getSession(),
|
||||
ISuspendedDMEvent.class);
|
||||
suspendedEventWaitor = new ServiceEventWaitor<>(getGDBLaunch().getSession(), ISuspendedDMEvent.class);
|
||||
|
||||
SyncUtil.resume();
|
||||
}
|
||||
|
@ -707,8 +705,7 @@ public class MIRunControlTargetAvailableTest extends BaseParametrizedTestCase {
|
|||
suspendedEventWaitor.waitForEvent(TestsPlugin.massageTimeout(3000));
|
||||
|
||||
// Now resume the target and check that we stop at all the breakpoints.
|
||||
suspendedEventWaitor = new ServiceEventWaitor<>(getGDBLaunch().getSession(),
|
||||
ISuspendedDMEvent.class);
|
||||
suspendedEventWaitor = new ServiceEventWaitor<>(getGDBLaunch().getSession(), ISuspendedDMEvent.class);
|
||||
|
||||
SyncUtil.resume();
|
||||
}
|
||||
|
@ -835,8 +832,7 @@ public class MIRunControlTargetAvailableTest extends BaseParametrizedTestCase {
|
|||
suspendedEventWaitor.waitForEvent(TestsPlugin.massageTimeout(3000));
|
||||
|
||||
// Now resume the target and check that we stop at all the breakpoints.
|
||||
suspendedEventWaitor = new ServiceEventWaitor<>(getGDBLaunch().getSession(),
|
||||
ISuspendedDMEvent.class);
|
||||
suspendedEventWaitor = new ServiceEventWaitor<>(getGDBLaunch().getSession(), ISuspendedDMEvent.class);
|
||||
|
||||
SyncUtil.resume();
|
||||
}
|
||||
|
|
|
@ -580,8 +580,8 @@ public class MIRunControlTest extends BaseParametrizedTestCase {
|
|||
//TestsPlugin.debug("handleCompleted over");
|
||||
}
|
||||
};
|
||||
final ServiceEventWaitor<IResumedDMEvent> eventWaitor = new ServiceEventWaitor<>(
|
||||
getGDBLaunch().getSession(), IResumedDMEvent.class);
|
||||
final ServiceEventWaitor<IResumedDMEvent> eventWaitor = new ServiceEventWaitor<>(getGDBLaunch().getSession(),
|
||||
IResumedDMEvent.class);
|
||||
|
||||
final IContainerDMContext containerDmc = SyncUtil.getContainerContext();
|
||||
|
||||
|
@ -629,8 +629,8 @@ public class MIRunControlTest extends BaseParametrizedTestCase {
|
|||
}
|
||||
};
|
||||
|
||||
final ServiceEventWaitor<IResumedDMEvent> eventWaitor = new ServiceEventWaitor<>(
|
||||
getGDBLaunch().getSession(), IResumedDMEvent.class);
|
||||
final ServiceEventWaitor<IResumedDMEvent> eventWaitor = new ServiceEventWaitor<>(getGDBLaunch().getSession(),
|
||||
IResumedDMEvent.class);
|
||||
|
||||
fRunCtrl.getExecutor().submit(new Runnable() {
|
||||
@Override
|
||||
|
|
|
@ -215,8 +215,8 @@ public class OperationsWhileTargetIsRunningTest extends BaseParametrizedTestCase
|
|||
// then we terminate the process, and confirm that there are no more processes
|
||||
SyncUtil.resume();
|
||||
|
||||
ServiceEventWaitor<IExitedDMEvent> exitedEventWaitor = new ServiceEventWaitor<>(
|
||||
getGDBLaunch().getSession(), IExitedDMEvent.class);
|
||||
ServiceEventWaitor<IExitedDMEvent> exitedEventWaitor = new ServiceEventWaitor<>(getGDBLaunch().getSession(),
|
||||
IExitedDMEvent.class);
|
||||
|
||||
Query<Object> query = new Query<Object>() {
|
||||
@Override
|
||||
|
@ -297,8 +297,8 @@ public class OperationsWhileTargetIsRunningTest extends BaseParametrizedTestCase
|
|||
// then we detach the process, and confirm that we are not longer running
|
||||
SyncUtil.resume();
|
||||
|
||||
ServiceEventWaitor<IExitedDMEvent> exitedEventWaitor = new ServiceEventWaitor<>(
|
||||
getGDBLaunch().getSession(), IExitedDMEvent.class);
|
||||
ServiceEventWaitor<IExitedDMEvent> exitedEventWaitor = new ServiceEventWaitor<>(getGDBLaunch().getSession(),
|
||||
IExitedDMEvent.class);
|
||||
|
||||
Query<Object> query = new Query<Object>() {
|
||||
@Override
|
||||
|
|
|
@ -353,8 +353,7 @@ public class SourceLookupTest extends BaseParametrizedTestCase {
|
|||
protected void addSourceContainer(AbstractSourceLookupDirector director, ISourceContainer container)
|
||||
throws CoreException {
|
||||
|
||||
ArrayList<ISourceContainer> containerList = new ArrayList<>(
|
||||
Arrays.asList(director.getSourceContainers()));
|
||||
ArrayList<ISourceContainer> containerList = new ArrayList<>(Arrays.asList(director.getSourceContainers()));
|
||||
container.init(director);
|
||||
containerList.add(container);
|
||||
director.setSourceContainers(containerList.toArray(new ISourceContainer[containerList.size()]));
|
||||
|
|
|
@ -186,8 +186,7 @@ public class StepIntoSelectionTest extends BaseParametrizedTestCase {
|
|||
*/
|
||||
private ISuspendedDMEvent triggerStepIntoSelection(final IExecutionDMContext exeContext, final String sourceName,
|
||||
final int targetLine, final IFunctionDeclaration function, final boolean skipBreakPoints) throws Throwable {
|
||||
ServiceEventWaitor<ISuspendedDMEvent> eventWaitor = new ServiceEventWaitor<>(fSession,
|
||||
ISuspendedDMEvent.class);
|
||||
ServiceEventWaitor<ISuspendedDMEvent> eventWaitor = new ServiceEventWaitor<>(fSession, ISuspendedDMEvent.class);
|
||||
|
||||
Query<Object> query = new Query<Object>() {
|
||||
@Override
|
||||
|
@ -207,8 +206,7 @@ public class StepIntoSelectionTest extends BaseParametrizedTestCase {
|
|||
*/
|
||||
private ISuspendedDMEvent triggerRunToLine(final IExecutionDMContext exeContext, final String sourceName,
|
||||
final int targetLine, final boolean skipBreakPoints) throws Throwable {
|
||||
ServiceEventWaitor<ISuspendedDMEvent> eventWaitor = new ServiceEventWaitor<>(fSession,
|
||||
ISuspendedDMEvent.class);
|
||||
ServiceEventWaitor<ISuspendedDMEvent> eventWaitor = new ServiceEventWaitor<>(fSession, ISuspendedDMEvent.class);
|
||||
|
||||
Query<Object> query = new Query<Object>() {
|
||||
@Override
|
||||
|
|
|
@ -353,8 +353,8 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
|
|||
// Run program until both threads are stopped
|
||||
SyncUtil.addBreakpoint("firstBreakpoint", false);
|
||||
|
||||
final ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<>(
|
||||
fMultiRun.getSession(), MIStoppedEvent.class);
|
||||
final ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<>(fMultiRun.getSession(),
|
||||
MIStoppedEvent.class);
|
||||
|
||||
SyncUtil.resumeAll();
|
||||
eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
|
||||
|
@ -463,8 +463,8 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
|
|||
// Run program until both threads are stopped
|
||||
SyncUtil.addBreakpoint("firstBreakpoint", false);
|
||||
|
||||
final ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<>(
|
||||
fMultiRun.getSession(), MIStoppedEvent.class);
|
||||
final ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<>(fMultiRun.getSession(),
|
||||
MIStoppedEvent.class);
|
||||
|
||||
SyncUtil.resumeAll();
|
||||
eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
|
||||
|
@ -577,8 +577,8 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
|
|||
// Run program until both threads are stopped
|
||||
SyncUtil.addBreakpoint("firstBreakpoint", false);
|
||||
|
||||
final ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<>(
|
||||
fMultiRun.getSession(), MIStoppedEvent.class);
|
||||
final ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<>(fMultiRun.getSession(),
|
||||
MIStoppedEvent.class);
|
||||
|
||||
SyncUtil.resumeAll();
|
||||
eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
|
||||
|
@ -696,8 +696,8 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
|
|||
final IMIExecutionDMContext[] threads = SyncUtil.getExecutionContexts();
|
||||
assertTrue("Expected a single thread but got " + threads.length, threads.length == 1);
|
||||
|
||||
final ServiceEventWaitor<MIRunningEvent> eventWaitor = new ServiceEventWaitor<>(
|
||||
fMultiRun.getSession(), MIRunningEvent.class);
|
||||
final ServiceEventWaitor<MIRunningEvent> eventWaitor = new ServiceEventWaitor<>(fMultiRun.getSession(),
|
||||
MIRunningEvent.class);
|
||||
|
||||
runAsyncCall(new AsyncRunnable<Object>() {
|
||||
@Override
|
||||
|
@ -767,8 +767,8 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
|
|||
// Run program until both threads are stopped
|
||||
SyncUtil.addBreakpoint("firstBreakpoint", false);
|
||||
|
||||
final ServiceEventWaitor<MIStoppedEvent> eventWaitorStopped = new ServiceEventWaitor<>(
|
||||
fMultiRun.getSession(), MIStoppedEvent.class);
|
||||
final ServiceEventWaitor<MIStoppedEvent> eventWaitorStopped = new ServiceEventWaitor<>(fMultiRun.getSession(),
|
||||
MIStoppedEvent.class);
|
||||
|
||||
SyncUtil.resumeAll();
|
||||
eventWaitorStopped.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
|
||||
|
@ -777,8 +777,8 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
|
|||
final IMIExecutionDMContext[] threads = SyncUtil.getExecutionContexts();
|
||||
assertTrue("Expected two threads but got " + threads.length, threads.length == 2);
|
||||
|
||||
final ServiceEventWaitor<MIRunningEvent> eventWaitorRunning = new ServiceEventWaitor<>(
|
||||
fMultiRun.getSession(), MIRunningEvent.class);
|
||||
final ServiceEventWaitor<MIRunningEvent> eventWaitorRunning = new ServiceEventWaitor<>(fMultiRun.getSession(),
|
||||
MIRunningEvent.class);
|
||||
|
||||
runAsyncCall(new AsyncRunnable<Object>() {
|
||||
@Override
|
||||
|
@ -819,8 +819,8 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
|
|||
// Run program until both threads are stopped
|
||||
SyncUtil.addBreakpoint("firstBreakpoint", false);
|
||||
|
||||
final ServiceEventWaitor<MIStoppedEvent> eventWaitorStopped = new ServiceEventWaitor<>(
|
||||
fMultiRun.getSession(), MIStoppedEvent.class);
|
||||
final ServiceEventWaitor<MIStoppedEvent> eventWaitorStopped = new ServiceEventWaitor<>(fMultiRun.getSession(),
|
||||
MIStoppedEvent.class);
|
||||
|
||||
SyncUtil.resumeAll();
|
||||
eventWaitorStopped.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
|
||||
|
@ -829,8 +829,8 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
|
|||
final IMIExecutionDMContext[] threads = SyncUtil.getExecutionContexts();
|
||||
assertTrue("Expected two threads but got " + threads.length, threads.length == 2);
|
||||
|
||||
final ServiceEventWaitor<MIRunningEvent> eventWaitorRunning = new ServiceEventWaitor<>(
|
||||
fMultiRun.getSession(), MIRunningEvent.class);
|
||||
final ServiceEventWaitor<MIRunningEvent> eventWaitorRunning = new ServiceEventWaitor<>(fMultiRun.getSession(),
|
||||
MIRunningEvent.class);
|
||||
|
||||
runAsyncCall(new AsyncRunnable<Object>() {
|
||||
@Override
|
||||
|
@ -862,8 +862,8 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
|
|||
// Run program until both threads are stopped
|
||||
SyncUtil.addBreakpoint("firstBreakpoint", false);
|
||||
|
||||
final ServiceEventWaitor<MIStoppedEvent> eventWaitorStopped = new ServiceEventWaitor<>(
|
||||
fMultiRun.getSession(), MIStoppedEvent.class);
|
||||
final ServiceEventWaitor<MIStoppedEvent> eventWaitorStopped = new ServiceEventWaitor<>(fMultiRun.getSession(),
|
||||
MIStoppedEvent.class);
|
||||
|
||||
SyncUtil.resumeAll();
|
||||
eventWaitorStopped.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
|
||||
|
@ -876,8 +876,8 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
|
|||
final IMIExecutionDMContext[] threads = SyncUtil.getExecutionContexts();
|
||||
assertTrue("Expected two threads but got " + threads.length, threads.length == 2);
|
||||
|
||||
final ServiceEventWaitor<MIRunningEvent> eventWaitorRunning = new ServiceEventWaitor<>(
|
||||
fMultiRun.getSession(), MIRunningEvent.class);
|
||||
final ServiceEventWaitor<MIRunningEvent> eventWaitorRunning = new ServiceEventWaitor<>(fMultiRun.getSession(),
|
||||
MIRunningEvent.class);
|
||||
|
||||
// No error should be thrown, the call should ignore running threads
|
||||
runAsyncCall(new AsyncRunnable<Object>() {
|
||||
|
@ -910,8 +910,8 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
|
|||
// Run program until both threads are stopped
|
||||
SyncUtil.addBreakpoint("firstBreakpoint", false);
|
||||
|
||||
final ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<>(
|
||||
fMultiRun.getSession(), MIStoppedEvent.class);
|
||||
final ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<>(fMultiRun.getSession(),
|
||||
MIStoppedEvent.class);
|
||||
|
||||
SyncUtil.resumeAll();
|
||||
eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
|
||||
|
@ -927,8 +927,8 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
|
|||
final IMIExecutionDMContext[] threads = SyncUtil.getExecutionContexts();
|
||||
assertTrue("Expected two threads but got " + threads.length, threads.length == 2);
|
||||
|
||||
final ServiceEventWaitor<MIRunningEvent> eventWaitorRunning = new ServiceEventWaitor<>(
|
||||
fMultiRun.getSession(), MIRunningEvent.class);
|
||||
final ServiceEventWaitor<MIRunningEvent> eventWaitorRunning = new ServiceEventWaitor<>(fMultiRun.getSession(),
|
||||
MIRunningEvent.class);
|
||||
|
||||
// No error should be thrown, the call should ignore running threads
|
||||
runAsyncCall(new AsyncRunnable<Object>() {
|
||||
|
@ -1000,8 +1000,8 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
|
|||
});
|
||||
assertFalse("expected no threads to be suspended, but found some", result);
|
||||
|
||||
final ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<>(
|
||||
fMultiRun.getSession(), MIStoppedEvent.class);
|
||||
final ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<>(fMultiRun.getSession(),
|
||||
MIStoppedEvent.class);
|
||||
|
||||
runAsyncCall(new AsyncRunnable<Object>() {
|
||||
@Override
|
||||
|
@ -1031,8 +1031,8 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
|
|||
// Run program until both threads are stopped
|
||||
SyncUtil.addBreakpoint("firstBreakpoint", false);
|
||||
|
||||
final ServiceEventWaitor<MIStoppedEvent> eventWaitorStopped = new ServiceEventWaitor<>(
|
||||
fMultiRun.getSession(), MIStoppedEvent.class);
|
||||
final ServiceEventWaitor<MIStoppedEvent> eventWaitorStopped = new ServiceEventWaitor<>(fMultiRun.getSession(),
|
||||
MIStoppedEvent.class);
|
||||
|
||||
SyncUtil.resumeAll();
|
||||
eventWaitorStopped.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
|
||||
|
@ -1069,8 +1069,8 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
|
|||
// Run program until both threads are stopped
|
||||
SyncUtil.addBreakpoint("firstBreakpoint", false);
|
||||
|
||||
final ServiceEventWaitor<MIStoppedEvent> eventWaitorStopped = new ServiceEventWaitor<>(
|
||||
fMultiRun.getSession(), MIStoppedEvent.class);
|
||||
final ServiceEventWaitor<MIStoppedEvent> eventWaitorStopped = new ServiceEventWaitor<>(fMultiRun.getSession(),
|
||||
MIStoppedEvent.class);
|
||||
|
||||
SyncUtil.resumeAll();
|
||||
eventWaitorStopped.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
|
||||
|
@ -1113,8 +1113,8 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
|
|||
// Run program until both threads are stopped
|
||||
SyncUtil.addBreakpoint("firstBreakpoint", false);
|
||||
|
||||
final ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<>(
|
||||
fMultiRun.getSession(), MIStoppedEvent.class);
|
||||
final ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<>(fMultiRun.getSession(),
|
||||
MIStoppedEvent.class);
|
||||
|
||||
SyncUtil.resumeAll();
|
||||
eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
|
||||
|
@ -1169,8 +1169,8 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
|
|||
// Run program until both threads are stopped
|
||||
SyncUtil.addBreakpoint("firstBreakpoint", false);
|
||||
|
||||
final ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<>(
|
||||
fMultiRun.getSession(), MIStoppedEvent.class);
|
||||
final ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<>(fMultiRun.getSession(),
|
||||
MIStoppedEvent.class);
|
||||
|
||||
SyncUtil.resumeAll();
|
||||
eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
|
||||
|
@ -1444,8 +1444,8 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
|
|||
// Run program until both threads are stopped
|
||||
SyncUtil.addBreakpoint("firstBreakpoint", false);
|
||||
|
||||
final ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<>(
|
||||
fMultiRun.getSession(), MIStoppedEvent.class);
|
||||
final ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<>(fMultiRun.getSession(),
|
||||
MIStoppedEvent.class);
|
||||
|
||||
SyncUtil.resumeAll();
|
||||
eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
|
||||
|
@ -1553,8 +1553,8 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
|
|||
// Run program until both threads are stopped
|
||||
SyncUtil.addBreakpoint("firstBreakpoint", false);
|
||||
|
||||
final ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<>(
|
||||
fMultiRun.getSession(), MIStoppedEvent.class);
|
||||
final ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<>(fMultiRun.getSession(),
|
||||
MIStoppedEvent.class);
|
||||
|
||||
SyncUtil.resumeAll();
|
||||
eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
|
||||
|
@ -1666,8 +1666,8 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
|
|||
// Run program until both threads are stopped
|
||||
SyncUtil.addBreakpoint("firstBreakpoint", false);
|
||||
|
||||
final ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<>(
|
||||
fMultiRun.getSession(), MIStoppedEvent.class);
|
||||
final ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<>(fMultiRun.getSession(),
|
||||
MIStoppedEvent.class);
|
||||
|
||||
SyncUtil.resumeAll();
|
||||
eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
|
||||
|
@ -1996,8 +1996,8 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
|
|||
// Run program until both threads are stopped
|
||||
SyncUtil.addBreakpoint("firstBreakpoint", false);
|
||||
|
||||
final ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<>(
|
||||
fMultiRun.getSession(), MIStoppedEvent.class);
|
||||
final ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<>(fMultiRun.getSession(),
|
||||
MIStoppedEvent.class);
|
||||
|
||||
SyncUtil.resumeAll();
|
||||
eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
|
||||
|
@ -2109,8 +2109,8 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
|
|||
// Run program until both threads are stopped
|
||||
SyncUtil.addBreakpoint("firstBreakpoint", false);
|
||||
|
||||
final ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<>(
|
||||
fMultiRun.getSession(), MIStoppedEvent.class);
|
||||
final ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<>(fMultiRun.getSession(),
|
||||
MIStoppedEvent.class);
|
||||
|
||||
SyncUtil.resumeAll();
|
||||
eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
|
||||
|
@ -2227,8 +2227,8 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
|
|||
// Run program until both threads are stopped
|
||||
SyncUtil.addBreakpoint("firstBreakpoint", false);
|
||||
|
||||
final ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<>(
|
||||
fMultiRun.getSession(), MIStoppedEvent.class);
|
||||
final ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<>(fMultiRun.getSession(),
|
||||
MIStoppedEvent.class);
|
||||
|
||||
SyncUtil.resumeAll();
|
||||
eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
|
||||
|
@ -2345,8 +2345,8 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
|
|||
// Run program until both threads are stopped
|
||||
SyncUtil.addBreakpoint("firstBreakpoint", false);
|
||||
|
||||
final ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<>(
|
||||
fMultiRun.getSession(), MIStoppedEvent.class);
|
||||
final ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<>(fMultiRun.getSession(),
|
||||
MIStoppedEvent.class);
|
||||
|
||||
SyncUtil.resumeAll();
|
||||
eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
|
||||
|
@ -2471,8 +2471,8 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
|
|||
// Run program until both threads are stopped
|
||||
SyncUtil.addBreakpoint("firstBreakpoint", false);
|
||||
|
||||
final ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<>(
|
||||
fMultiRun.getSession(), MIStoppedEvent.class);
|
||||
final ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<>(fMultiRun.getSession(),
|
||||
MIStoppedEvent.class);
|
||||
|
||||
SyncUtil.resumeAll();
|
||||
eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
|
||||
|
@ -2585,8 +2585,8 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
|
|||
// Run program until both threads are stopped
|
||||
SyncUtil.addBreakpoint("firstBreakpoint", false);
|
||||
|
||||
final ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<>(
|
||||
fMultiRun.getSession(), MIStoppedEvent.class);
|
||||
final ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<>(fMultiRun.getSession(),
|
||||
MIStoppedEvent.class);
|
||||
|
||||
SyncUtil.resumeAll();
|
||||
eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
|
||||
|
@ -2703,8 +2703,8 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
|
|||
// Run program until both threads are stopped
|
||||
SyncUtil.addBreakpoint("firstBreakpoint", false);
|
||||
|
||||
final ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<>(
|
||||
fMultiRun.getSession(), MIStoppedEvent.class);
|
||||
final ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<>(fMultiRun.getSession(),
|
||||
MIStoppedEvent.class);
|
||||
|
||||
SyncUtil.resumeAll();
|
||||
eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
|
||||
|
@ -2824,8 +2824,8 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
|
|||
public void testResumeProcessOneThreadStopped() throws Throwable {
|
||||
final IExecutionDMContext[] processes = new IExecutionDMContext[] { SyncUtil.getContainerContext() };
|
||||
|
||||
final ServiceEventWaitor<MIRunningEvent> eventWaitor = new ServiceEventWaitor<>(
|
||||
fMultiRun.getSession(), MIRunningEvent.class);
|
||||
final ServiceEventWaitor<MIRunningEvent> eventWaitor = new ServiceEventWaitor<>(fMultiRun.getSession(),
|
||||
MIRunningEvent.class);
|
||||
|
||||
runAsyncCall(new AsyncRunnable<Object>() {
|
||||
@Override
|
||||
|
@ -2894,8 +2894,8 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
|
|||
// Run program until both threads are stopped
|
||||
SyncUtil.addBreakpoint("firstBreakpoint", false);
|
||||
|
||||
final ServiceEventWaitor<MIStoppedEvent> eventWaitorStopped = new ServiceEventWaitor<>(
|
||||
fMultiRun.getSession(), MIStoppedEvent.class);
|
||||
final ServiceEventWaitor<MIStoppedEvent> eventWaitorStopped = new ServiceEventWaitor<>(fMultiRun.getSession(),
|
||||
MIStoppedEvent.class);
|
||||
|
||||
SyncUtil.resumeAll();
|
||||
eventWaitorStopped.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
|
||||
|
@ -2903,8 +2903,8 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
|
|||
|
||||
final IExecutionDMContext[] processes = new IExecutionDMContext[] { SyncUtil.getContainerContext() };
|
||||
|
||||
final ServiceEventWaitor<MIRunningEvent> eventWaitorRunning = new ServiceEventWaitor<>(
|
||||
fMultiRun.getSession(), MIRunningEvent.class);
|
||||
final ServiceEventWaitor<MIRunningEvent> eventWaitorRunning = new ServiceEventWaitor<>(fMultiRun.getSession(),
|
||||
MIRunningEvent.class);
|
||||
|
||||
runAsyncCall(new AsyncRunnable<Object>() {
|
||||
@Override
|
||||
|
@ -2936,8 +2936,8 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
|
|||
// Run program until both threads are stopped
|
||||
SyncUtil.addBreakpoint("firstBreakpoint", false);
|
||||
|
||||
final ServiceEventWaitor<MIStoppedEvent> eventWaitorStopped = new ServiceEventWaitor<>(
|
||||
fMultiRun.getSession(), MIStoppedEvent.class);
|
||||
final ServiceEventWaitor<MIStoppedEvent> eventWaitorStopped = new ServiceEventWaitor<>(fMultiRun.getSession(),
|
||||
MIStoppedEvent.class);
|
||||
|
||||
SyncUtil.resumeAll();
|
||||
eventWaitorStopped.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
|
||||
|
@ -2949,8 +2949,8 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
|
|||
|
||||
final IExecutionDMContext[] processes = new IExecutionDMContext[] { SyncUtil.getContainerContext() };
|
||||
|
||||
final ServiceEventWaitor<MIRunningEvent> eventWaitorRunning = new ServiceEventWaitor<>(
|
||||
fMultiRun.getSession(), MIRunningEvent.class);
|
||||
final ServiceEventWaitor<MIRunningEvent> eventWaitorRunning = new ServiceEventWaitor<>(fMultiRun.getSession(),
|
||||
MIRunningEvent.class);
|
||||
|
||||
// No error should be thrown, the call should ignore running threads
|
||||
runAsyncCall(new AsyncRunnable<Object>() {
|
||||
|
@ -2983,8 +2983,8 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
|
|||
// Run program until both threads are stopped
|
||||
SyncUtil.addBreakpoint("firstBreakpoint", false);
|
||||
|
||||
final ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<>(
|
||||
fMultiRun.getSession(), MIStoppedEvent.class);
|
||||
final ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<>(fMultiRun.getSession(),
|
||||
MIStoppedEvent.class);
|
||||
|
||||
SyncUtil.resumeAll();
|
||||
eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
|
||||
|
@ -2999,8 +2999,8 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
|
|||
|
||||
final IExecutionDMContext[] processes = new IExecutionDMContext[] { SyncUtil.getContainerContext() };
|
||||
|
||||
final ServiceEventWaitor<MIRunningEvent> eventWaitorRunning = new ServiceEventWaitor<>(
|
||||
fMultiRun.getSession(), MIRunningEvent.class);
|
||||
final ServiceEventWaitor<MIRunningEvent> eventWaitorRunning = new ServiceEventWaitor<>(fMultiRun.getSession(),
|
||||
MIRunningEvent.class);
|
||||
|
||||
// No error should be thrown, the call should ignore running threads
|
||||
runAsyncCall(new AsyncRunnable<Object>() {
|
||||
|
@ -3082,8 +3082,8 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
|
|||
});
|
||||
assertFalse("expected no process to be suspended, but found some", result);
|
||||
|
||||
final ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<>(
|
||||
fMultiRun.getSession(), MIStoppedEvent.class);
|
||||
final ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<>(fMultiRun.getSession(),
|
||||
MIStoppedEvent.class);
|
||||
|
||||
runAsyncCall(new AsyncRunnable<Object>() {
|
||||
@Override
|
||||
|
@ -3113,8 +3113,8 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
|
|||
// Run program until both threads are stopped
|
||||
SyncUtil.addBreakpoint("firstBreakpoint", false);
|
||||
|
||||
final ServiceEventWaitor<MIStoppedEvent> eventWaitorStopped = new ServiceEventWaitor<>(
|
||||
fMultiRun.getSession(), MIStoppedEvent.class);
|
||||
final ServiceEventWaitor<MIStoppedEvent> eventWaitorStopped = new ServiceEventWaitor<>(fMultiRun.getSession(),
|
||||
MIStoppedEvent.class);
|
||||
|
||||
SyncUtil.resumeAll();
|
||||
eventWaitorStopped.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
|
||||
|
@ -3162,8 +3162,8 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
|
|||
// Run program until both threads are stopped
|
||||
SyncUtil.addBreakpoint("firstBreakpoint", false);
|
||||
|
||||
final ServiceEventWaitor<MIStoppedEvent> eventWaitorStopped = new ServiceEventWaitor<>(
|
||||
fMultiRun.getSession(), MIStoppedEvent.class);
|
||||
final ServiceEventWaitor<MIStoppedEvent> eventWaitorStopped = new ServiceEventWaitor<>(fMultiRun.getSession(),
|
||||
MIStoppedEvent.class);
|
||||
|
||||
SyncUtil.resumeAll();
|
||||
eventWaitorStopped.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
|
||||
|
@ -3217,8 +3217,8 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
|
|||
// Run program until both threads are stopped
|
||||
SyncUtil.addBreakpoint("firstBreakpoint", false);
|
||||
|
||||
final ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<>(
|
||||
fMultiRun.getSession(), MIStoppedEvent.class);
|
||||
final ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<>(fMultiRun.getSession(),
|
||||
MIStoppedEvent.class);
|
||||
|
||||
SyncUtil.resumeAll();
|
||||
eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
|
||||
|
@ -3302,8 +3302,8 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
|
|||
final IExecutionDMContext[] execDmcs = new IExecutionDMContext[] { SyncUtil.getContainerContext(),
|
||||
SyncUtil.getExecutionContext(0) };
|
||||
|
||||
final ServiceEventWaitor<MIRunningEvent> eventWaitor = new ServiceEventWaitor<>(
|
||||
fMultiRun.getSession(), MIRunningEvent.class);
|
||||
final ServiceEventWaitor<MIRunningEvent> eventWaitor = new ServiceEventWaitor<>(fMultiRun.getSession(),
|
||||
MIRunningEvent.class);
|
||||
|
||||
runAsyncCall(new AsyncRunnable<Object>() {
|
||||
@Override
|
||||
|
@ -3347,8 +3347,8 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
|
|||
});
|
||||
assertFalse("expected no contexts to be suspended, but found some", result);
|
||||
|
||||
final ServiceEventWaitor<MIRunningEvent> eventWaitor = new ServiceEventWaitor<>(
|
||||
fMultiRun.getSession(), MIRunningEvent.class);
|
||||
final ServiceEventWaitor<MIRunningEvent> eventWaitor = new ServiceEventWaitor<>(fMultiRun.getSession(),
|
||||
MIRunningEvent.class);
|
||||
|
||||
// No error should be thrown, the call should ignore running processes
|
||||
runAsyncCall(new AsyncRunnable<Object>() {
|
||||
|
@ -3381,8 +3381,8 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
|
|||
// Run program until both threads are stopped
|
||||
SyncUtil.addBreakpoint("firstBreakpoint", false);
|
||||
|
||||
final ServiceEventWaitor<MIStoppedEvent> eventWaitorStopped = new ServiceEventWaitor<>(
|
||||
fMultiRun.getSession(), MIStoppedEvent.class);
|
||||
final ServiceEventWaitor<MIStoppedEvent> eventWaitorStopped = new ServiceEventWaitor<>(fMultiRun.getSession(),
|
||||
MIStoppedEvent.class);
|
||||
|
||||
SyncUtil.resumeAll();
|
||||
eventWaitorStopped.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
|
||||
|
@ -3391,8 +3391,8 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
|
|||
final IExecutionDMContext[] execDmcs = new IExecutionDMContext[] { SyncUtil.getContainerContext(),
|
||||
SyncUtil.getExecutionContext(0) };
|
||||
|
||||
final ServiceEventWaitor<MIRunningEvent> eventWaitorRunning = new ServiceEventWaitor<>(
|
||||
fMultiRun.getSession(), MIRunningEvent.class);
|
||||
final ServiceEventWaitor<MIRunningEvent> eventWaitorRunning = new ServiceEventWaitor<>(fMultiRun.getSession(),
|
||||
MIRunningEvent.class);
|
||||
|
||||
runAsyncCall(new AsyncRunnable<Object>() {
|
||||
@Override
|
||||
|
@ -3427,8 +3427,8 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
|
|||
// Run program until both threads are stopped
|
||||
SyncUtil.addBreakpoint("firstBreakpoint", false);
|
||||
|
||||
final ServiceEventWaitor<MIStoppedEvent> eventWaitorStopped = new ServiceEventWaitor<>(
|
||||
fMultiRun.getSession(), MIStoppedEvent.class);
|
||||
final ServiceEventWaitor<MIStoppedEvent> eventWaitorStopped = new ServiceEventWaitor<>(fMultiRun.getSession(),
|
||||
MIStoppedEvent.class);
|
||||
|
||||
SyncUtil.resumeAll();
|
||||
eventWaitorStopped.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
|
||||
|
@ -3441,8 +3441,8 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
|
|||
final IExecutionDMContext[] execDmcs = new IExecutionDMContext[] { SyncUtil.getContainerContext(),
|
||||
SyncUtil.getExecutionContext(0) };
|
||||
|
||||
final ServiceEventWaitor<MIRunningEvent> eventWaitorRunning = new ServiceEventWaitor<>(
|
||||
fMultiRun.getSession(), MIRunningEvent.class);
|
||||
final ServiceEventWaitor<MIRunningEvent> eventWaitorRunning = new ServiceEventWaitor<>(fMultiRun.getSession(),
|
||||
MIRunningEvent.class);
|
||||
|
||||
// No error should be thrown, the call should ignore running threads
|
||||
runAsyncCall(new AsyncRunnable<Object>() {
|
||||
|
@ -3477,8 +3477,8 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
|
|||
// Run program until both threads are stopped
|
||||
SyncUtil.addBreakpoint("firstBreakpoint", false);
|
||||
|
||||
final ServiceEventWaitor<MIStoppedEvent> eventWaitorStopped = new ServiceEventWaitor<>(
|
||||
fMultiRun.getSession(), MIStoppedEvent.class);
|
||||
final ServiceEventWaitor<MIStoppedEvent> eventWaitorStopped = new ServiceEventWaitor<>(fMultiRun.getSession(),
|
||||
MIStoppedEvent.class);
|
||||
|
||||
SyncUtil.resumeAll();
|
||||
eventWaitorStopped.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
|
||||
|
@ -3491,8 +3491,8 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
|
|||
final IExecutionDMContext[] execDmcs = new IExecutionDMContext[] { SyncUtil.getContainerContext(),
|
||||
SyncUtil.getExecutionContext(1) };
|
||||
|
||||
final ServiceEventWaitor<MIRunningEvent> eventWaitorRunning = new ServiceEventWaitor<>(
|
||||
fMultiRun.getSession(), MIRunningEvent.class);
|
||||
final ServiceEventWaitor<MIRunningEvent> eventWaitorRunning = new ServiceEventWaitor<>(fMultiRun.getSession(),
|
||||
MIRunningEvent.class);
|
||||
|
||||
// No error should be thrown, the call should ignore running threads
|
||||
runAsyncCall(new AsyncRunnable<Object>() {
|
||||
|
@ -3526,8 +3526,8 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
|
|||
// Run program until both threads are stopped
|
||||
SyncUtil.addBreakpoint("firstBreakpoint", false);
|
||||
|
||||
final ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<>(
|
||||
fMultiRun.getSession(), MIStoppedEvent.class);
|
||||
final ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<>(fMultiRun.getSession(),
|
||||
MIStoppedEvent.class);
|
||||
|
||||
SyncUtil.resumeAll();
|
||||
eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
|
||||
|
@ -3543,8 +3543,8 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
|
|||
final IExecutionDMContext[] execDmcs = new IExecutionDMContext[] { SyncUtil.getContainerContext(),
|
||||
SyncUtil.getExecutionContext(0) };
|
||||
|
||||
final ServiceEventWaitor<MIRunningEvent> eventWaitorRunning = new ServiceEventWaitor<>(
|
||||
fMultiRun.getSession(), MIRunningEvent.class);
|
||||
final ServiceEventWaitor<MIRunningEvent> eventWaitorRunning = new ServiceEventWaitor<>(fMultiRun.getSession(),
|
||||
MIRunningEvent.class);
|
||||
|
||||
// No error should be thrown, the call should ignore running threads
|
||||
runAsyncCall(new AsyncRunnable<Object>() {
|
||||
|
@ -3650,8 +3650,8 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
|
|||
});
|
||||
assertFalse("expected no process to be suspended, but found some", result);
|
||||
|
||||
final ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<>(
|
||||
fMultiRun.getSession(), MIStoppedEvent.class);
|
||||
final ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<>(fMultiRun.getSession(),
|
||||
MIStoppedEvent.class);
|
||||
|
||||
runAsyncCall(new AsyncRunnable<Object>() {
|
||||
@Override
|
||||
|
@ -3682,8 +3682,8 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
|
|||
// Run program until both threads are stopped
|
||||
SyncUtil.addBreakpoint("firstBreakpoint", false);
|
||||
|
||||
final ServiceEventWaitor<MIStoppedEvent> eventWaitorStopped = new ServiceEventWaitor<>(
|
||||
fMultiRun.getSession(), MIStoppedEvent.class);
|
||||
final ServiceEventWaitor<MIStoppedEvent> eventWaitorStopped = new ServiceEventWaitor<>(fMultiRun.getSession(),
|
||||
MIStoppedEvent.class);
|
||||
|
||||
SyncUtil.resumeAll();
|
||||
eventWaitorStopped.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
|
||||
|
@ -3733,8 +3733,8 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
|
|||
// Run program until both threads are stopped
|
||||
SyncUtil.addBreakpoint("firstBreakpoint", false);
|
||||
|
||||
final ServiceEventWaitor<MIStoppedEvent> eventWaitorStopped = new ServiceEventWaitor<>(
|
||||
fMultiRun.getSession(), MIStoppedEvent.class);
|
||||
final ServiceEventWaitor<MIStoppedEvent> eventWaitorStopped = new ServiceEventWaitor<>(fMultiRun.getSession(),
|
||||
MIStoppedEvent.class);
|
||||
|
||||
SyncUtil.resumeAll();
|
||||
eventWaitorStopped.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
|
||||
|
@ -3790,8 +3790,8 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
|
|||
// Run program until both threads are stopped
|
||||
SyncUtil.addBreakpoint("firstBreakpoint", false);
|
||||
|
||||
final ServiceEventWaitor<MIStoppedEvent> eventWaitorStopped = new ServiceEventWaitor<>(
|
||||
fMultiRun.getSession(), MIStoppedEvent.class);
|
||||
final ServiceEventWaitor<MIStoppedEvent> eventWaitorStopped = new ServiceEventWaitor<>(fMultiRun.getSession(),
|
||||
MIStoppedEvent.class);
|
||||
|
||||
SyncUtil.resumeAll();
|
||||
eventWaitorStopped.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
|
||||
|
@ -3847,8 +3847,8 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
|
|||
// Run program until both threads are stopped
|
||||
SyncUtil.addBreakpoint("firstBreakpoint", false);
|
||||
|
||||
final ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<>(
|
||||
fMultiRun.getSession(), MIStoppedEvent.class);
|
||||
final ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<>(fMultiRun.getSession(),
|
||||
MIStoppedEvent.class);
|
||||
|
||||
SyncUtil.resumeAll();
|
||||
eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
|
||||
|
@ -3937,8 +3937,8 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
|
|||
// Run program until both threads are stopped
|
||||
SyncUtil.addBreakpoint("firstBreakpoint", false);
|
||||
|
||||
final ServiceEventWaitor<MIStoppedEvent> eventWaitorStopped = new ServiceEventWaitor<>(
|
||||
fMultiRun.getSession(), MIStoppedEvent.class);
|
||||
final ServiceEventWaitor<MIStoppedEvent> eventWaitorStopped = new ServiceEventWaitor<>(fMultiRun.getSession(),
|
||||
MIStoppedEvent.class);
|
||||
|
||||
SyncUtil.resumeAll();
|
||||
eventWaitorStopped.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
|
||||
|
@ -3947,8 +3947,8 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
|
|||
final IExecutionDMContext[] execDmcs = new IExecutionDMContext[] { SyncUtil.getContainerContext(),
|
||||
SyncUtil.getExecutionContext(0), SyncUtil.getExecutionContext(1) };
|
||||
|
||||
final ServiceEventWaitor<MIRunningEvent> eventWaitorRunning = new ServiceEventWaitor<>(
|
||||
fMultiRun.getSession(), MIRunningEvent.class);
|
||||
final ServiceEventWaitor<MIRunningEvent> eventWaitorRunning = new ServiceEventWaitor<>(fMultiRun.getSession(),
|
||||
MIRunningEvent.class);
|
||||
|
||||
runAsyncCall(new AsyncRunnable<Object>() {
|
||||
@Override
|
||||
|
@ -3983,8 +3983,8 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
|
|||
// Run program until both threads are stopped
|
||||
SyncUtil.addBreakpoint("firstBreakpoint", false);
|
||||
|
||||
final ServiceEventWaitor<MIStoppedEvent> eventWaitorStopped = new ServiceEventWaitor<>(
|
||||
fMultiRun.getSession(), MIStoppedEvent.class);
|
||||
final ServiceEventWaitor<MIStoppedEvent> eventWaitorStopped = new ServiceEventWaitor<>(fMultiRun.getSession(),
|
||||
MIStoppedEvent.class);
|
||||
|
||||
SyncUtil.resumeAll();
|
||||
eventWaitorStopped.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
|
||||
|
@ -3997,8 +3997,8 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
|
|||
final IExecutionDMContext[] execDmcs = new IExecutionDMContext[] { SyncUtil.getContainerContext(),
|
||||
SyncUtil.getExecutionContext(0), SyncUtil.getExecutionContext(1) };
|
||||
|
||||
final ServiceEventWaitor<MIRunningEvent> eventWaitorRunning = new ServiceEventWaitor<>(
|
||||
fMultiRun.getSession(), MIRunningEvent.class);
|
||||
final ServiceEventWaitor<MIRunningEvent> eventWaitorRunning = new ServiceEventWaitor<>(fMultiRun.getSession(),
|
||||
MIRunningEvent.class);
|
||||
|
||||
// No error should be thrown, the call should ignore running threads
|
||||
runAsyncCall(new AsyncRunnable<Object>() {
|
||||
|
@ -4032,8 +4032,8 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
|
|||
// Run program until both threads are stopped
|
||||
SyncUtil.addBreakpoint("firstBreakpoint", false);
|
||||
|
||||
final ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<>(
|
||||
fMultiRun.getSession(), MIStoppedEvent.class);
|
||||
final ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<>(fMultiRun.getSession(),
|
||||
MIStoppedEvent.class);
|
||||
|
||||
SyncUtil.resumeAll();
|
||||
eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
|
||||
|
@ -4049,8 +4049,8 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
|
|||
final IExecutionDMContext[] execDmcs = new IExecutionDMContext[] { SyncUtil.getContainerContext(),
|
||||
SyncUtil.getExecutionContext(0), SyncUtil.getExecutionContext(1) };
|
||||
|
||||
final ServiceEventWaitor<MIRunningEvent> eventWaitorRunning = new ServiceEventWaitor<>(
|
||||
fMultiRun.getSession(), MIRunningEvent.class);
|
||||
final ServiceEventWaitor<MIRunningEvent> eventWaitorRunning = new ServiceEventWaitor<>(fMultiRun.getSession(),
|
||||
MIRunningEvent.class);
|
||||
|
||||
// No error should be thrown, the call should ignore running threads
|
||||
runAsyncCall(new AsyncRunnable<Object>() {
|
||||
|
@ -4086,8 +4086,8 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
|
|||
// Run program until both threads are stopped
|
||||
SyncUtil.addBreakpoint("firstBreakpoint", false);
|
||||
|
||||
final ServiceEventWaitor<MIStoppedEvent> eventWaitorStopped = new ServiceEventWaitor<>(
|
||||
fMultiRun.getSession(), MIStoppedEvent.class);
|
||||
final ServiceEventWaitor<MIStoppedEvent> eventWaitorStopped = new ServiceEventWaitor<>(fMultiRun.getSession(),
|
||||
MIStoppedEvent.class);
|
||||
|
||||
SyncUtil.resumeAll();
|
||||
eventWaitorStopped.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
|
||||
|
@ -4137,8 +4137,8 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
|
|||
// Run program until both threads are stopped
|
||||
SyncUtil.addBreakpoint("firstBreakpoint", false);
|
||||
|
||||
final ServiceEventWaitor<MIStoppedEvent> eventWaitorStopped = new ServiceEventWaitor<>(
|
||||
fMultiRun.getSession(), MIStoppedEvent.class);
|
||||
final ServiceEventWaitor<MIStoppedEvent> eventWaitorStopped = new ServiceEventWaitor<>(fMultiRun.getSession(),
|
||||
MIStoppedEvent.class);
|
||||
|
||||
SyncUtil.resumeAll();
|
||||
eventWaitorStopped.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
|
||||
|
@ -4194,8 +4194,8 @@ public class GDBMultiNonStopRunControlTest extends BaseParametrizedTestCase {
|
|||
// Run program until both threads are stopped
|
||||
SyncUtil.addBreakpoint("firstBreakpoint", false);
|
||||
|
||||
final ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<>(
|
||||
fMultiRun.getSession(), MIStoppedEvent.class);
|
||||
final ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<>(fMultiRun.getSession(),
|
||||
MIStoppedEvent.class);
|
||||
|
||||
SyncUtil.resumeAll();
|
||||
eventWaitor.waitForEvent(TestsPlugin.massageTimeout(2000)); // Wait for first thread to stop
|
||||
|
|
|
@ -157,8 +157,8 @@ public class ThreadStackFrameSyncTest extends BaseParametrizedTestCase {
|
|||
*/
|
||||
@Test
|
||||
public void testChangingCurrentThreadCLINotification() throws Throwable {
|
||||
ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<>(
|
||||
fMultiRunControl.getSession(), MIStoppedEvent.class);
|
||||
ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<>(fMultiRunControl.getSession(),
|
||||
MIStoppedEvent.class);
|
||||
|
||||
// add a breakpoint in main
|
||||
SyncUtil.addBreakpoint(SOURCE_NAME + ":" + getLineForTag("LINE_MAIN_ALL_THREADS_STARTED"), false);
|
||||
|
@ -193,8 +193,8 @@ public class ThreadStackFrameSyncTest extends BaseParametrizedTestCase {
|
|||
*/
|
||||
@Test
|
||||
public void testChangingCurrentFrameCLINotification() throws Throwable {
|
||||
ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<>(
|
||||
fMultiRunControl.getSession(), MIStoppedEvent.class);
|
||||
ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<>(fMultiRunControl.getSession(),
|
||||
MIStoppedEvent.class);
|
||||
|
||||
// add a breakpoint in main
|
||||
SyncUtil.addBreakpoint(SOURCE_NAME + ":" + getLineForTag("LINE_MAIN_ALL_THREADS_STARTED"), false);
|
||||
|
@ -229,8 +229,8 @@ public class ThreadStackFrameSyncTest extends BaseParametrizedTestCase {
|
|||
*/
|
||||
@Test
|
||||
public void testGdbSyncServiceCanSwitchGDBThread() throws Throwable {
|
||||
ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<>(
|
||||
fMultiRunControl.getSession(), MIStoppedEvent.class);
|
||||
ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<>(fMultiRunControl.getSession(),
|
||||
MIStoppedEvent.class);
|
||||
|
||||
// add a breakpoint in main
|
||||
SyncUtil.addBreakpoint(SOURCE_NAME + ":" + getLineForTag("LINE_MAIN_ALL_THREADS_STARTED"), false);
|
||||
|
@ -270,8 +270,8 @@ public class ThreadStackFrameSyncTest extends BaseParametrizedTestCase {
|
|||
*/
|
||||
@Test
|
||||
public void testGdbSyncServiceCanSwitchGDBStackFrame() throws Throwable {
|
||||
ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<>(
|
||||
fMultiRunControl.getSession(), MIStoppedEvent.class);
|
||||
ServiceEventWaitor<MIStoppedEvent> eventWaitor = new ServiceEventWaitor<>(fMultiRunControl.getSession(),
|
||||
MIStoppedEvent.class);
|
||||
|
||||
// add a breakpoint in main
|
||||
SyncUtil.addBreakpoint(SOURCE_NAME + ":" + getLineForTag("LINE_MAIN_ALL_THREADS_STARTED"), false);
|
||||
|
|
|
@ -202,8 +202,7 @@ class DisassemblyColumnSupport implements IColumnSupport {
|
|||
*/
|
||||
@Override
|
||||
public void dispose() {
|
||||
for (Iterator<IContributedRulerColumn> iter = new ArrayList<>(fColumns).iterator(); iter
|
||||
.hasNext();)
|
||||
for (Iterator<IContributedRulerColumn> iter = new ArrayList<>(fColumns).iterator(); iter.hasNext();)
|
||||
removeColumn(getRuler(), iter.next());
|
||||
fColumns.clear();
|
||||
}
|
||||
|
|
|
@ -55,8 +55,7 @@ public class BreakpointVMNode extends AbstractBreakpointVMNode
|
|||
|
||||
@Override
|
||||
public void update(ILabelUpdate[] updates) {
|
||||
Map<IElementLabelProvider, List<ILabelUpdate>> delegatesMap = new HashMap<>(
|
||||
1, 1);
|
||||
Map<IElementLabelProvider, List<ILabelUpdate>> delegatesMap = new HashMap<>(1, 1);
|
||||
|
||||
for (final ILabelUpdate update : updates) {
|
||||
final IBreakpoint bp = ((BreakpointVMContext) update.getElement()).getBreakpoint();
|
||||
|
@ -164,8 +163,7 @@ public class BreakpointVMNode extends AbstractBreakpointVMNode
|
|||
|
||||
@Override
|
||||
public void encodeElements(IElementMementoRequest[] updates) {
|
||||
Map<IElementMementoProvider, List<IElementMementoRequest>> delegatesMap = new HashMap<>(
|
||||
1, 1);
|
||||
Map<IElementMementoProvider, List<IElementMementoRequest>> delegatesMap = new HashMap<>(1, 1);
|
||||
|
||||
for (final IElementMementoRequest update : updates) {
|
||||
final IBreakpoint bp = ((BreakpointVMContext) update.getElement()).getBreakpoint();
|
||||
|
@ -241,8 +239,7 @@ public class BreakpointVMNode extends AbstractBreakpointVMNode
|
|||
|
||||
@Override
|
||||
public void compareElements(IElementCompareRequest[] updates) {
|
||||
Map<IElementMementoProvider, List<IElementCompareRequest>> delegatesMap = new HashMap<>(
|
||||
1, 1);
|
||||
Map<IElementMementoProvider, List<IElementCompareRequest>> delegatesMap = new HashMap<>(1, 1);
|
||||
|
||||
for (final IElementCompareRequest update : updates) {
|
||||
final IBreakpoint bp = ((BreakpointVMContext) update.getElement()).getBreakpoint();
|
||||
|
|
|
@ -144,8 +144,7 @@ public class BreakpointVMProvider extends AbstractVMProvider {
|
|||
}
|
||||
}
|
||||
|
||||
List<BreakpointOrganizerVMContext> vmcs = new ArrayList<>(
|
||||
bpsLists.size());
|
||||
List<BreakpointOrganizerVMContext> vmcs = new ArrayList<>(bpsLists.size());
|
||||
for (Map.Entry<IAdaptable, List<IBreakpoint>> entry : bpsLists.entrySet()) {
|
||||
List<IBreakpoint> bpsList = entry.getValue();
|
||||
IBreakpoint[] bpsArray = bpsList.toArray(new IBreakpoint[bpsList.size()]);
|
||||
|
|
|
@ -424,10 +424,8 @@ public class FormattedValueRetriever {
|
|||
final Map<IPropertiesUpdate, String[]> availableFormatsMap,
|
||||
final Map<IPropertiesUpdate, String> elementFormatMap, final RequestMonitor rm) {
|
||||
final List<IPropertiesUpdate> outstandingUpdates = new ArrayList<>(updates.length);
|
||||
final Map<IPropertiesUpdate, List<String>> requestedFormatsMap = new HashMap<>(
|
||||
updates.length * 4 / 3);
|
||||
final Map<IPropertiesUpdate, String> activeFormatsMap = new HashMap<>(
|
||||
updates.length * 4 / 3);
|
||||
final Map<IPropertiesUpdate, List<String>> requestedFormatsMap = new HashMap<>(updates.length * 4 / 3);
|
||||
final Map<IPropertiesUpdate, String> activeFormatsMap = new HashMap<>(updates.length * 4 / 3);
|
||||
|
||||
for (final IPropertiesUpdate update : updates) {
|
||||
String preferredFormat = FormattedValueVMUtil.getPreferredFormat(update.getPresentationContext());
|
||||
|
|
|
@ -203,8 +203,7 @@ public class BreakpointsMediator extends AbstractDsfService implements IBreakpoi
|
|||
|
||||
// We have to make a copy of the fPlatformBPs keys because uninstallBreakpoints()
|
||||
// modifies the map as it walks through it.
|
||||
List<IBreakpointsTargetDMContext> platformBPKeysCopy = new ArrayList<>(
|
||||
fPlatformBPs.size());
|
||||
List<IBreakpointsTargetDMContext> platformBPKeysCopy = new ArrayList<>(fPlatformBPs.size());
|
||||
platformBPKeysCopy.addAll(0, fPlatformBPs.keySet());
|
||||
for (IBreakpointsTargetDMContext dmc : platformBPKeysCopy) {
|
||||
stopTrackingBreakpoints(dmc, countingRm);
|
||||
|
@ -567,8 +566,7 @@ public class BreakpointsMediator extends AbstractDsfService implements IBreakpoi
|
|||
}
|
||||
|
||||
// Get the list of corresponding back-end breakpoints
|
||||
final List<IBreakpointDMContext> oldBpContexts = new ArrayList<>(
|
||||
breakpointIDs.get(breakpoint));
|
||||
final List<IBreakpointDMContext> oldBpContexts = new ArrayList<>(breakpointIDs.get(breakpoint));
|
||||
|
||||
// Calculate the list of attributes maps that have not changed.
|
||||
// Immediately add these to the list of new breakpoint contexts,
|
||||
|
|
|
@ -319,8 +319,7 @@ public class BreakpointsMediator2 extends AbstractDsfService implements IBreakpo
|
|||
|
||||
// We have to make a copy of the fPlatformBPs keys because uninstallBreakpoints()
|
||||
// modifies the map as it walks through it.
|
||||
List<IBreakpointsTargetDMContext> platformBPKeysCopy = new ArrayList<>(
|
||||
fPlatformBPs.size());
|
||||
List<IBreakpointsTargetDMContext> platformBPKeysCopy = new ArrayList<>(fPlatformBPs.size());
|
||||
platformBPKeysCopy.addAll(0, fPlatformBPs.keySet());
|
||||
for (IBreakpointsTargetDMContext dmc : platformBPKeysCopy) {
|
||||
stopTrackingBreakpoints(dmc, countingRm);
|
||||
|
@ -527,8 +526,7 @@ public class BreakpointsMediator2 extends AbstractDsfService implements IBreakpo
|
|||
targetBPsAttempted.add(new TargetBP(attrsList.get(i)));
|
||||
}
|
||||
|
||||
final ArrayList<ITargetBreakpointInfo> targetBPsInstalled = new ArrayList<>(
|
||||
attrsList.size());
|
||||
final ArrayList<ITargetBreakpointInfo> targetBPsInstalled = new ArrayList<>(attrsList.size());
|
||||
|
||||
// Update the breakpoint status when all back-end breakpoints have been installed
|
||||
final CountingRequestMonitor installRM = new CountingRequestMonitor(getExecutor(), rm) {
|
||||
|
|
|
@ -287,8 +287,7 @@ public class CommandCache implements ICommandListener {
|
|||
* them to point to the new super command.
|
||||
*/
|
||||
|
||||
for (CommandInfo waitingEntry : new ArrayList<>(
|
||||
fPendingQWaitingForCoalescedCompletion)) {
|
||||
for (CommandInfo waitingEntry : new ArrayList<>(fPendingQWaitingForCoalescedCompletion)) {
|
||||
|
||||
if (waitingEntry.getCoalescedCmd() == currentUnsentEntry) {
|
||||
/*
|
||||
|
@ -469,8 +468,7 @@ public class CommandCache implements ICommandListener {
|
|||
* we create a new result from the coalesced command for it.
|
||||
*/
|
||||
|
||||
for (CommandInfo waitingEntry : new ArrayList<>(
|
||||
fPendingQWaitingForCoalescedCompletion)) {
|
||||
for (CommandInfo waitingEntry : new ArrayList<>(fPendingQWaitingForCoalescedCompletion)) {
|
||||
|
||||
if (waitingEntry.getCoalescedCmd() == finalCachedCmd) {
|
||||
|
||||
|
|
|
@ -485,8 +485,7 @@ public class DsfSession {
|
|||
Dictionary<String, ?> serviceProperties = (Dictionary<String, ?>) _serviceProperties;
|
||||
|
||||
// Build a list of listeners;
|
||||
SortedMap<ListenerEntry, List<Method>> listeners = new TreeMap<>(
|
||||
new Comparator<ListenerEntry>() {
|
||||
SortedMap<ListenerEntry, List<Method>> listeners = new TreeMap<>(new Comparator<ListenerEntry>() {
|
||||
@Override
|
||||
public int compare(ListenerEntry o1, ListenerEntry o2) {
|
||||
if (o1.fListener == o2.fListener) {
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
//#ifdef exercises
|
||||
package org.eclipse.cdt.examples.dsf.dataviewer;
|
||||
//#else
|
||||
|
||||
//#package org.eclipse.cdt.examples.dsf.dataviewer.answers;
|
||||
//#endif
|
||||
|
||||
|
@ -46,9 +47,7 @@ import org.eclipse.core.runtime.CoreException;
|
|||
* invalidate their caches.
|
||||
* </p>
|
||||
*/
|
||||
public class ACPMSumDataGenerator
|
||||
implements IDataGenerator, IDataGenerator.Listener
|
||||
{
|
||||
public class ACPMSumDataGenerator implements IDataGenerator, IDataGenerator.Listener {
|
||||
|
||||
/**
|
||||
* DSF executor used to serialize data access within this data generator.
|
||||
|
@ -66,19 +65,15 @@ public class ACPMSumDataGenerator
|
|||
*/
|
||||
final private List<Listener> fListeners = new LinkedList<Listener>();
|
||||
|
||||
public ACPMSumDataGenerator(DsfExecutor executor,
|
||||
IDataGenerator[] generators)
|
||||
{
|
||||
public ACPMSumDataGenerator(DsfExecutor executor, IDataGenerator[] generators) {
|
||||
fExecutor = executor;
|
||||
|
||||
// Create wrappers for data generators and add ourselves as listener
|
||||
// to their events.
|
||||
fDataGeneratorCMs = new DataGeneratorCacheManager[generators.length];
|
||||
ImmediateInDsfExecutor immediateExecutor =
|
||||
new ImmediateInDsfExecutor(fExecutor);
|
||||
ImmediateInDsfExecutor immediateExecutor = new ImmediateInDsfExecutor(fExecutor);
|
||||
for (int i = 0; i < generators.length; i++) {
|
||||
fDataGeneratorCMs[i] = new DataGeneratorCacheManager(
|
||||
immediateExecutor, generators[i]);
|
||||
fDataGeneratorCMs[i] = new DataGeneratorCacheManager(immediateExecutor, generators[i]);
|
||||
generators[i].addListener(this);
|
||||
}
|
||||
}
|
||||
|
@ -87,23 +82,19 @@ public class ACPMSumDataGenerator
|
|||
public void getCount(final DataRequestMonitor<Integer> rm) {
|
||||
// Artificially delay the retrieval of the sum data to simulate
|
||||
// real processing time.
|
||||
fExecutor.schedule( new Runnable() {
|
||||
fExecutor.schedule(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
// Create the transaction here to put all the ugly
|
||||
// code in one place.
|
||||
new Transaction<Integer>() {
|
||||
@Override
|
||||
protected Integer process()
|
||||
throws Transaction.InvalidCacheException,
|
||||
CoreException
|
||||
{
|
||||
protected Integer process() throws Transaction.InvalidCacheException, CoreException {
|
||||
return processCount(this);
|
||||
}
|
||||
}.request(rm);
|
||||
}
|
||||
},
|
||||
PROCESSING_DELAY, TimeUnit.MILLISECONDS);
|
||||
}, PROCESSING_DELAY, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -114,11 +105,9 @@ public class ACPMSumDataGenerator
|
|||
* @throws CoreException See {@link Transaction#process}
|
||||
*/
|
||||
private Integer processCount(Transaction<Integer> transaction)
|
||||
throws Transaction.InvalidCacheException, CoreException
|
||||
{
|
||||
throws Transaction.InvalidCacheException, CoreException {
|
||||
// Assemble all needed count caches into a collection.
|
||||
List<ICache<Integer>> countCaches =
|
||||
new ArrayList<ICache<Integer>>(fDataGeneratorCMs.length);
|
||||
List<ICache<Integer>> countCaches = new ArrayList<ICache<Integer>>(fDataGeneratorCMs.length);
|
||||
for (DataGeneratorCacheManager dataGeneratorCM : fDataGeneratorCMs) {
|
||||
countCaches.add(dataGeneratorCM.getCount());
|
||||
}
|
||||
|
@ -135,24 +124,19 @@ public class ACPMSumDataGenerator
|
|||
}
|
||||
|
||||
@Override
|
||||
public void getValue(final int index, final DataRequestMonitor<Integer> rm)
|
||||
{
|
||||
public void getValue(final int index, final DataRequestMonitor<Integer> rm) {
|
||||
// Add a processing delay.
|
||||
fExecutor.schedule( new Runnable() {
|
||||
fExecutor.schedule(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
new Transaction<Integer>() {
|
||||
@Override
|
||||
protected Integer process()
|
||||
throws Transaction.InvalidCacheException,
|
||||
CoreException
|
||||
{
|
||||
protected Integer process() throws Transaction.InvalidCacheException, CoreException {
|
||||
return processValue(this, index);
|
||||
}
|
||||
}.request(rm);
|
||||
}
|
||||
},
|
||||
PROCESSING_DELAY, TimeUnit.MILLISECONDS);
|
||||
}, PROCESSING_DELAY, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -164,10 +148,8 @@ public class ACPMSumDataGenerator
|
|||
* @throws CoreException See {@link Transaction#process}
|
||||
*/
|
||||
private Integer processValue(Transaction<Integer> transaction, int index)
|
||||
throws Transaction.InvalidCacheException, CoreException
|
||||
{
|
||||
List<ICache<Integer>> valueCaches =
|
||||
new ArrayList<ICache<Integer>>(fDataGeneratorCMs.length);
|
||||
throws Transaction.InvalidCacheException, CoreException {
|
||||
List<ICache<Integer>> valueCaches = new ArrayList<ICache<Integer>>(fDataGeneratorCMs.length);
|
||||
for (DataGeneratorCacheManager dataGeneratorCM : fDataGeneratorCMs) {
|
||||
valueCaches.add(dataGeneratorCM.getValue(index));
|
||||
}
|
||||
|
@ -196,33 +178,35 @@ public class ACPMSumDataGenerator
|
|||
public void addListener(final Listener listener) {
|
||||
// Must access fListeners on executor thread.
|
||||
try {
|
||||
fExecutor.execute( new DsfRunnable() {
|
||||
fExecutor.execute(new DsfRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
fListeners.add(listener);
|
||||
}
|
||||
});
|
||||
} catch (RejectedExecutionException e) {}
|
||||
} catch (RejectedExecutionException e) {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeListener(final Listener listener) {
|
||||
// Must access fListeners on executor thread.
|
||||
try {
|
||||
fExecutor.execute( new DsfRunnable() {
|
||||
fExecutor.execute(new DsfRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
fListeners.remove(listener);
|
||||
}
|
||||
});
|
||||
} catch (RejectedExecutionException e) {}
|
||||
} catch (RejectedExecutionException e) {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void countChanged() {
|
||||
// Must access fListeners on executor thread.
|
||||
try {
|
||||
fExecutor.execute( new DsfRunnable() {
|
||||
fExecutor.execute(new DsfRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
for (Listener listener : fListeners) {
|
||||
|
@ -230,21 +214,23 @@ public class ACPMSumDataGenerator
|
|||
}
|
||||
}
|
||||
});
|
||||
} catch (RejectedExecutionException e) {}
|
||||
} catch (RejectedExecutionException e) {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void valuesChanged(final Set<Integer> changed) {
|
||||
// Must access fListeners on executor thread.
|
||||
try {
|
||||
fExecutor.execute( new DsfRunnable() {
|
||||
fExecutor.execute(new DsfRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
for (Object listener : fListeners) {
|
||||
((Listener)listener).valuesChanged(changed);
|
||||
((Listener) listener).valuesChanged(changed);
|
||||
}
|
||||
}
|
||||
});
|
||||
} catch (RejectedExecutionException e) {}
|
||||
} catch (RejectedExecutionException e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
//#ifdef exercises
|
||||
package org.eclipse.cdt.examples.dsf.dataviewer;
|
||||
//#else
|
||||
|
||||
//#package org.eclipse.cdt.examples.dsf.dataviewer.answers;
|
||||
//#endif
|
||||
|
||||
|
@ -62,8 +63,7 @@ import org.eclipse.swt.widgets.Table;
|
|||
* </p>
|
||||
*/
|
||||
@ConfinedToDsfExecutor("fDisplayExecutor")
|
||||
public class ACPMSumDataViewer implements ILazyContentProvider
|
||||
{
|
||||
public class ACPMSumDataViewer implements ILazyContentProvider {
|
||||
/** View update frequency interval. */
|
||||
final private static int UPDATE_INTERVAL = 10000;
|
||||
|
||||
|
@ -81,19 +81,15 @@ public class ACPMSumDataViewer implements ILazyContentProvider
|
|||
final private DataGeneratorCacheManager fSumGeneratorCM;
|
||||
|
||||
// Fields used in request cancellation logic.
|
||||
private List<ValueRequestMonitor> fItemDataRequestMonitors =
|
||||
new LinkedList<ValueRequestMonitor>();
|
||||
private List<ValueRequestMonitor> fItemDataRequestMonitors = new LinkedList<ValueRequestMonitor>();
|
||||
private Set<Integer> fIndexesToCancel = new HashSet<Integer>();
|
||||
private int fCancelCallsPending = 0;
|
||||
private Future<?> fRefreshFuture;
|
||||
|
||||
public ACPMSumDataViewer(TableViewer viewer,
|
||||
ImmediateInDsfExecutor dataExecutor, IDataGenerator[] generators,
|
||||
IDataGenerator sumGenerator)
|
||||
{
|
||||
public ACPMSumDataViewer(TableViewer viewer, ImmediateInDsfExecutor dataExecutor, IDataGenerator[] generators,
|
||||
IDataGenerator sumGenerator) {
|
||||
fViewer = viewer;
|
||||
fDisplayExecutor = DisplayDsfExecutor.getDisplayDsfExecutor(
|
||||
fViewer.getTable().getDisplay());
|
||||
fDisplayExecutor = DisplayDsfExecutor.getDisplayDsfExecutor(fViewer.getTable().getDisplay());
|
||||
fDataExecutor = dataExecutor;
|
||||
|
||||
// Create wrappers for data generators. Don't need to register as
|
||||
|
@ -101,21 +97,17 @@ public class ACPMSumDataViewer implements ILazyContentProvider
|
|||
// are already registered for them.
|
||||
fDataGeneratorCMs = new DataGeneratorCacheManager[generators.length];
|
||||
for (int i = 0; i < generators.length; i++) {
|
||||
fDataGeneratorCMs[i] =
|
||||
new DataGeneratorCacheManager(fDataExecutor, generators[i]);
|
||||
fDataGeneratorCMs[i] = new DataGeneratorCacheManager(fDataExecutor, generators[i]);
|
||||
}
|
||||
fSumGeneratorCM =
|
||||
new DataGeneratorCacheManager(fDataExecutor, sumGenerator);
|
||||
fSumGeneratorCM = new DataGeneratorCacheManager(fDataExecutor, sumGenerator);
|
||||
|
||||
// Schedule a task to refresh the viewer periodically.
|
||||
fRefreshFuture = fDisplayExecutor.scheduleAtFixedRate(
|
||||
new Runnable() {
|
||||
fRefreshFuture = fDisplayExecutor.scheduleAtFixedRate(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
queryItemCount();
|
||||
}
|
||||
},
|
||||
UPDATE_INTERVAL, UPDATE_INTERVAL, TimeUnit.MILLISECONDS);
|
||||
}, UPDATE_INTERVAL, UPDATE_INTERVAL, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -129,9 +121,7 @@ public class ACPMSumDataViewer implements ILazyContentProvider
|
|||
@Override
|
||||
protected void execute(DataRequestMonitor<Object> rm) {
|
||||
fSumGeneratorCM.dispose();
|
||||
for (DataGeneratorCacheManager dataGeneratorCM :
|
||||
fDataGeneratorCMs)
|
||||
{
|
||||
for (DataGeneratorCacheManager dataGeneratorCM : fDataGeneratorCMs) {
|
||||
dataGeneratorCM.dispose();
|
||||
}
|
||||
rm.setData(new Object());
|
||||
|
@ -141,9 +131,9 @@ public class ACPMSumDataViewer implements ILazyContentProvider
|
|||
fDataExecutor.execute(disposeCacheManagersQuery);
|
||||
try {
|
||||
disposeCacheManagersQuery.get();
|
||||
} catch (InterruptedException e) {
|
||||
} catch (ExecutionException e) {
|
||||
}
|
||||
catch (InterruptedException e) {}
|
||||
catch (ExecutionException e) {}
|
||||
|
||||
// Cancel any outstanding data requests.
|
||||
for (ValueRequestMonitor rm : fItemDataRequestMonitors) {
|
||||
|
@ -170,11 +160,12 @@ public class ACPMSumDataViewer implements ILazyContentProvider
|
|||
// Invoke a cancel task with a delay. The delay allows multiple cancel
|
||||
// calls to be combined together improving performance of the viewer.
|
||||
fCancelCallsPending++;
|
||||
fDisplayExecutor.execute(
|
||||
new Runnable() { @Override
|
||||
fDisplayExecutor.execute(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
cancelStaleRequests(topIdx, botIdx);
|
||||
}});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -186,9 +177,7 @@ public class ACPMSumDataViewer implements ILazyContentProvider
|
|||
private int getVisibleItemCount(int top) {
|
||||
Table table = fViewer.getTable();
|
||||
int itemCount = table.getItemCount();
|
||||
return Math.min(
|
||||
(table.getBounds().height / table.getItemHeight()) + 2,
|
||||
itemCount - top);
|
||||
return Math.min((table.getBounds().height / table.getItemHeight()) + 2, itemCount - top);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -198,15 +187,15 @@ public class ACPMSumDataViewer implements ILazyContentProvider
|
|||
private void queryItemCount() {
|
||||
// Create the request monitor to collect the count. This request
|
||||
// monitor will be completed by the following transaction.
|
||||
final DataRequestMonitor<Integer> rm =
|
||||
new DataRequestMonitor<Integer>(fDisplayExecutor, null)
|
||||
{
|
||||
final DataRequestMonitor<Integer> rm = new DataRequestMonitor<Integer>(fDisplayExecutor, null) {
|
||||
@Override
|
||||
protected void handleSuccess() {
|
||||
setCountToViewer(getData());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void handleRejectedExecutionException() {} // Shutting down, ignore.
|
||||
protected void handleRejectedExecutionException() {
|
||||
} // Shutting down, ignore.
|
||||
};
|
||||
|
||||
// Use a transaction, even with a single cache. This will ensure that
|
||||
|
@ -217,9 +206,7 @@ public class ACPMSumDataViewer implements ILazyContentProvider
|
|||
public void run() {
|
||||
new Transaction<Integer>() {
|
||||
@Override
|
||||
protected Integer process()
|
||||
throws Transaction.InvalidCacheException, CoreException
|
||||
{
|
||||
protected Integer process() throws Transaction.InvalidCacheException, CoreException {
|
||||
return processCount(this);
|
||||
}
|
||||
}.request(rm);
|
||||
|
@ -235,8 +222,7 @@ public class ACPMSumDataViewer implements ILazyContentProvider
|
|||
* @throws CoreException See {@link Transaction#process}
|
||||
*/
|
||||
private Integer processCount(Transaction<Integer> transaction)
|
||||
throws Transaction.InvalidCacheException, CoreException
|
||||
{
|
||||
throws Transaction.InvalidCacheException, CoreException {
|
||||
ICache<Integer> countCache = fSumGeneratorCM.getCount();
|
||||
transaction.validate(countCache);
|
||||
return countCache.getData();
|
||||
|
@ -269,6 +255,7 @@ public class ACPMSumDataViewer implements ILazyContentProvider
|
|||
setValueToViewer(index, getData());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void handleRejectedExecutionException() {
|
||||
// Shutting down, ignore.
|
||||
|
@ -287,9 +274,7 @@ public class ACPMSumDataViewer implements ILazyContentProvider
|
|||
public void run() {
|
||||
new Transaction<String>() {
|
||||
@Override
|
||||
protected String process()
|
||||
throws Transaction.InvalidCacheException, CoreException
|
||||
{
|
||||
protected String process() throws Transaction.InvalidCacheException, CoreException {
|
||||
return processValue(this, index);
|
||||
}
|
||||
}.request(rm);
|
||||
|
@ -319,10 +304,8 @@ public class ACPMSumDataViewer implements ILazyContentProvider
|
|||
* @throws CoreException See {@link Transaction#process}
|
||||
*/
|
||||
private String processValue(Transaction<String> transaction, int index)
|
||||
throws Transaction.InvalidCacheException, CoreException
|
||||
{
|
||||
List<ICache<Integer>> valueCaches =
|
||||
new ArrayList<ICache<Integer>>(fDataGeneratorCMs.length);
|
||||
throws Transaction.InvalidCacheException, CoreException {
|
||||
List<ICache<Integer>> valueCaches = new ArrayList<ICache<Integer>>(fDataGeneratorCMs.length);
|
||||
for (DataGeneratorCacheManager dataGeneratorCM : fDataGeneratorCMs) {
|
||||
valueCaches.add(dataGeneratorCM.getValue(index));
|
||||
}
|
||||
|
@ -338,7 +321,8 @@ public class ACPMSumDataViewer implements ILazyContentProvider
|
|||
StringBuilder result = new StringBuilder();
|
||||
int calcSum = 0;
|
||||
for (ICache<Integer> valueCache : valueCaches) {
|
||||
if (result.length() != 0) result.append(" + ");
|
||||
if (result.length() != 0)
|
||||
result.append(" + ");
|
||||
result.append(valueCache.getData());
|
||||
calcSum += valueCache.getData();
|
||||
}
|
||||
|
@ -388,9 +372,7 @@ public class ACPMSumDataViewer implements ILazyContentProvider
|
|||
|
||||
// Go through the outstanding requests and cancel any that
|
||||
// are not visible anymore.
|
||||
for (Iterator<ValueRequestMonitor> itr =
|
||||
fItemDataRequestMonitors.iterator(); itr.hasNext();)
|
||||
{
|
||||
for (Iterator<ValueRequestMonitor> itr = fItemDataRequestMonitors.iterator(); itr.hasNext();) {
|
||||
ValueRequestMonitor item = itr.next();
|
||||
if (item.fIndex < topIdx || item.fIndex > botIdx) {
|
||||
// Set the item to canceled status, so that the data provider
|
||||
|
@ -436,8 +418,7 @@ public class ACPMSumDataViewer implements ILazyContentProvider
|
|||
Font font = new Font(display, "Courier", 10, SWT.NORMAL);
|
||||
|
||||
// Create the table viewer.
|
||||
TableViewer tableViewer =
|
||||
new TableViewer(shell, SWT.BORDER | SWT.VIRTUAL);
|
||||
TableViewer tableViewer = new TableViewer(shell, SWT.BORDER | SWT.VIRTUAL);
|
||||
tableViewer.getControl().setLayoutData(data);
|
||||
|
||||
DsfExecutor executor = new DefaultDsfExecutor("Example executor");
|
||||
|
@ -447,12 +428,10 @@ public class ACPMSumDataViewer implements ILazyContentProvider
|
|||
for (int i = 0; i < generators.length; i++) {
|
||||
generators[i] = new DataGeneratorWithExecutor(executor);
|
||||
}
|
||||
final IDataGenerator sumGenerator =
|
||||
new ACPMSumDataGenerator(executor, generators);
|
||||
final IDataGenerator sumGenerator = new ACPMSumDataGenerator(executor, generators);
|
||||
|
||||
// Create the content provider which will populate the viewer.
|
||||
ACPMSumDataViewer contentProvider = new ACPMSumDataViewer(
|
||||
tableViewer, new ImmediateInDsfExecutor(executor),
|
||||
ACPMSumDataViewer contentProvider = new ACPMSumDataViewer(tableViewer, new ImmediateInDsfExecutor(executor),
|
||||
generators, sumGenerator);
|
||||
tableViewer.setContentProvider(contentProvider);
|
||||
tableViewer.setInput(new Object());
|
||||
|
@ -470,8 +449,7 @@ public class ACPMSumDataViewer implements ILazyContentProvider
|
|||
Query<Object> shutdownQuery = new Query<Object>() {
|
||||
@Override
|
||||
protected void execute(DataRequestMonitor<Object> rm) {
|
||||
CountingRequestMonitor crm = new CountingRequestMonitor(
|
||||
ImmediateExecutor.getInstance(), rm);
|
||||
CountingRequestMonitor crm = new CountingRequestMonitor(ImmediateExecutor.getInstance(), rm);
|
||||
for (int i = 0; i < generators.length; i++) {
|
||||
generators[i].shutdown(crm);
|
||||
}
|
||||
|
@ -483,7 +461,8 @@ public class ACPMSumDataViewer implements ILazyContentProvider
|
|||
executor.execute(shutdownQuery);
|
||||
try {
|
||||
shutdownQuery.get();
|
||||
} catch (Exception e) {}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
|
||||
// Shut down the display.
|
||||
font.dispose();
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
//#ifdef exercises
|
||||
package org.eclipse.cdt.examples.dsf.dataviewer;
|
||||
//#else
|
||||
|
||||
//#package org.eclipse.cdt.examples.dsf.dataviewer.answers;
|
||||
//#endif
|
||||
|
||||
|
@ -57,9 +58,7 @@ import org.eclipse.swt.widgets.Table;
|
|||
* </p>
|
||||
*/
|
||||
@ConfinedToDsfExecutor("fDisplayExecutor")
|
||||
public class AsyncDataViewer
|
||||
implements ILazyContentProvider, IDataGenerator.Listener
|
||||
{
|
||||
public class AsyncDataViewer implements ILazyContentProvider, IDataGenerator.Listener {
|
||||
// Executor to use instead of Display.asyncExec().
|
||||
@ThreadSafe
|
||||
final private DsfExecutor fDisplayExecutor;
|
||||
|
@ -69,15 +68,13 @@ public class AsyncDataViewer
|
|||
final private IDataGenerator fDataGenerator;
|
||||
|
||||
// Fields used in request cancellation logic.
|
||||
private List<ValueDataRequestMonitor> fItemDataRequestMonitors =
|
||||
new LinkedList<ValueDataRequestMonitor>();
|
||||
private List<ValueDataRequestMonitor> fItemDataRequestMonitors = new LinkedList<ValueDataRequestMonitor>();
|
||||
private Set<Integer> fIndexesToCancel = new HashSet<Integer>();
|
||||
private int fCancelCallsPending = 0;
|
||||
|
||||
public AsyncDataViewer(TableViewer viewer, IDataGenerator generator) {
|
||||
fViewer = viewer;
|
||||
fDisplayExecutor = DisplayDsfExecutor.getDisplayDsfExecutor(
|
||||
fViewer.getTable().getDisplay());
|
||||
fDisplayExecutor = DisplayDsfExecutor.getDisplayDsfExecutor(fViewer.getTable().getDisplay());
|
||||
fDataGenerator = generator;
|
||||
fDataGenerator.addListener(this);
|
||||
}
|
||||
|
@ -105,12 +102,12 @@ public class AsyncDataViewer
|
|||
// Invoke a cancel task with a delay. The delay allows multiple cancel
|
||||
// calls to be combined together improving performance of the viewer.
|
||||
fCancelCallsPending++;
|
||||
fDisplayExecutor.schedule(
|
||||
new Runnable() { @Override
|
||||
fDisplayExecutor.schedule(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
cancelStaleRequests(topIdx, botIdx);
|
||||
}},
|
||||
1, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
}, 1, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -122,9 +119,7 @@ public class AsyncDataViewer
|
|||
private int getVisibleItemCount(int top) {
|
||||
Table table = fViewer.getTable();
|
||||
int itemCount = table.getItemCount();
|
||||
return Math.min(
|
||||
(table.getBounds().height / table.getItemHeight()) + 2,
|
||||
itemCount - top);
|
||||
return Math.min((table.getBounds().height / table.getItemHeight()) + 2, itemCount - top);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -140,7 +135,7 @@ public class AsyncDataViewer
|
|||
// trigger update requests for these indexes if they are
|
||||
// visible in the viewer.
|
||||
final TableViewer tableViewer = fViewer;
|
||||
fDisplayExecutor.execute( new Runnable() {
|
||||
fDisplayExecutor.execute(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (!fViewer.getTable().isDisposed()) {
|
||||
|
@ -148,7 +143,8 @@ public class AsyncDataViewer
|
|||
tableViewer.clear(index);
|
||||
}
|
||||
}
|
||||
}});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -175,7 +171,6 @@ public class AsyncDataViewer
|
|||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Retrieves value of an element at given index. When complete the value
|
||||
* is written to the viewer.
|
||||
|
@ -220,14 +215,12 @@ public class AsyncDataViewer
|
|||
fCancelCallsPending--;
|
||||
|
||||
// Must check again, in case disposed while re-dispatching.
|
||||
if (fDataGenerator == null || fViewer.getTable().isDisposed()) return;
|
||||
if (fDataGenerator == null || fViewer.getTable().isDisposed())
|
||||
return;
|
||||
|
||||
// Go through the outstanding requests and cancel any that
|
||||
// are not visible anymore.
|
||||
for (Iterator<ValueDataRequestMonitor> itr =
|
||||
fItemDataRequestMonitors.iterator();
|
||||
itr.hasNext();)
|
||||
{
|
||||
for (Iterator<ValueDataRequestMonitor> itr = fItemDataRequestMonitors.iterator(); itr.hasNext();) {
|
||||
ValueDataRequestMonitor item = itr.next();
|
||||
if (item.fIndex < topIdx || item.fIndex > botIdx) {
|
||||
// Set the item to canceled status, so that the data provider
|
||||
|
@ -259,7 +252,6 @@ public class AsyncDataViewer
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
// Create the shell to hold the viewer.
|
||||
Display display = new Display();
|
||||
|
@ -270,16 +262,14 @@ public class AsyncDataViewer
|
|||
Font font = new Font(display, "Courier", 10, SWT.NORMAL);
|
||||
|
||||
// Create the table viewer.
|
||||
TableViewer tableViewer =
|
||||
new TableViewer(shell, SWT.BORDER | SWT.VIRTUAL);
|
||||
TableViewer tableViewer = new TableViewer(shell, SWT.BORDER | SWT.VIRTUAL);
|
||||
tableViewer.getControl().setLayoutData(data);
|
||||
|
||||
// Create the data generator.
|
||||
final IDataGenerator generator = new DataGeneratorWithExecutor();
|
||||
|
||||
// Create the content provider which will populate the viewer.
|
||||
AsyncDataViewer contentProvider =
|
||||
new AsyncDataViewer(tableViewer, generator);
|
||||
AsyncDataViewer contentProvider = new AsyncDataViewer(tableViewer, generator);
|
||||
tableViewer.setContentProvider(contentProvider);
|
||||
tableViewer.setInput(new Object());
|
||||
|
||||
|
@ -302,7 +292,8 @@ public class AsyncDataViewer
|
|||
ImmediateExecutor.getInstance().execute(shutdownQuery);
|
||||
try {
|
||||
shutdownQuery.get();
|
||||
} catch (Exception e) {}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
|
||||
// Shut down the display.
|
||||
font.dispose();
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
//#ifdef exercises
|
||||
package org.eclipse.cdt.examples.dsf.dataviewer;
|
||||
//#else
|
||||
|
||||
//#package org.eclipse.cdt.examples.dsf.dataviewer.answers;
|
||||
//#endif
|
||||
|
||||
|
@ -48,9 +49,7 @@ public class AsyncSumDataGenerator implements IDataGenerator {
|
|||
*/
|
||||
final private IDataGenerator[] fDataGenerators;
|
||||
|
||||
public AsyncSumDataGenerator(DsfExecutor executor,
|
||||
IDataGenerator[] generators)
|
||||
{
|
||||
public AsyncSumDataGenerator(DsfExecutor executor, IDataGenerator[] generators) {
|
||||
fExecutor = executor;
|
||||
fDataGenerators = generators;
|
||||
}
|
||||
|
@ -59,13 +58,12 @@ public class AsyncSumDataGenerator implements IDataGenerator {
|
|||
public void getCount(final DataRequestMonitor<Integer> rm) {
|
||||
// Artificially delay the retrieval of the sum data to simulate
|
||||
// real processing time.
|
||||
fExecutor.schedule( new Runnable() {
|
||||
fExecutor.schedule(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
doGetCount(rm);
|
||||
}
|
||||
},
|
||||
PROCESSING_DELAY, TimeUnit.MILLISECONDS);
|
||||
}, PROCESSING_DELAY, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -77,9 +75,7 @@ public class AsyncSumDataGenerator implements IDataGenerator {
|
|||
final int[] counts = new int[fDataGenerators.length];
|
||||
|
||||
// Counting request monitor is called once all data is retrieved.
|
||||
final CountingRequestMonitor crm =
|
||||
new CountingRequestMonitor(fExecutor, rm)
|
||||
{
|
||||
final CountingRequestMonitor crm = new CountingRequestMonitor(fExecutor, rm) {
|
||||
@Override
|
||||
protected void handleSuccess() {
|
||||
// Pick the highest count value.
|
||||
|
@ -93,10 +89,7 @@ public class AsyncSumDataGenerator implements IDataGenerator {
|
|||
// Each call to data generator fills in one value in array.
|
||||
for (int i = 0; i < fDataGenerators.length; i++) {
|
||||
final int finalI = i;
|
||||
fDataGenerators[i].getCount(
|
||||
new DataRequestMonitor<Integer>(
|
||||
ImmediateExecutor.getInstance(), crm)
|
||||
{
|
||||
fDataGenerators[i].getCount(new DataRequestMonitor<Integer>(ImmediateExecutor.getInstance(), crm) {
|
||||
@Override
|
||||
protected void handleSuccess() {
|
||||
counts[finalI] = getData();
|
||||
|
@ -108,17 +101,15 @@ public class AsyncSumDataGenerator implements IDataGenerator {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void getValue(final int index, final DataRequestMonitor<Integer> rm)
|
||||
{
|
||||
public void getValue(final int index, final DataRequestMonitor<Integer> rm) {
|
||||
// Artificially delay the retrieval of the sum data to simulate
|
||||
// real processing time.
|
||||
fExecutor.schedule( new Runnable() {
|
||||
fExecutor.schedule(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
doGetValue(index, rm);
|
||||
}
|
||||
},
|
||||
PROCESSING_DELAY, TimeUnit.MILLISECONDS);
|
||||
}, PROCESSING_DELAY, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -130,9 +121,7 @@ public class AsyncSumDataGenerator implements IDataGenerator {
|
|||
final int[] values = new int[fDataGenerators.length];
|
||||
|
||||
// Counting request monitor is called once all data is retrieved.
|
||||
final CountingRequestMonitor crm =
|
||||
new CountingRequestMonitor(fExecutor, rm)
|
||||
{
|
||||
final CountingRequestMonitor crm = new CountingRequestMonitor(fExecutor, rm) {
|
||||
@Override
|
||||
protected void handleSuccess() {
|
||||
// Sum up values in array.
|
||||
|
@ -148,11 +137,7 @@ public class AsyncSumDataGenerator implements IDataGenerator {
|
|||
// Each call to data generator fills in one value in array.
|
||||
for (int i = 0; i < fDataGenerators.length; i++) {
|
||||
final int finalI = i;
|
||||
fDataGenerators[i].getValue(
|
||||
index,
|
||||
new DataRequestMonitor<Integer>(
|
||||
ImmediateExecutor.getInstance(), crm)
|
||||
{
|
||||
fDataGenerators[i].getValue(index, new DataRequestMonitor<Integer>(ImmediateExecutor.getInstance(), crm) {
|
||||
@Override
|
||||
protected void handleSuccess() {
|
||||
values[finalI] = getData();
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
//#ifdef exercises
|
||||
package org.eclipse.cdt.examples.dsf.dataviewer;
|
||||
//#else
|
||||
|
||||
//#package org.eclipse.cdt.examples.dsf.dataviewer.answers;
|
||||
//#endif
|
||||
|
||||
|
@ -65,8 +66,7 @@ import org.eclipse.swt.widgets.Table;
|
|||
* </p>
|
||||
*/
|
||||
@ConfinedToDsfExecutor("fDisplayExecutor")
|
||||
public class AsyncSumDataViewer implements ILazyContentProvider
|
||||
{
|
||||
public class AsyncSumDataViewer implements ILazyContentProvider {
|
||||
/** View update frequency interval. */
|
||||
final private static int UPDATE_INTERVAL = 10000;
|
||||
|
||||
|
@ -80,30 +80,24 @@ public class AsyncSumDataViewer implements ILazyContentProvider
|
|||
final private IDataGenerator fSumGenerator;
|
||||
|
||||
// Fields used in request cancellation logic.
|
||||
private List<ValueCountingRequestMonitor> fItemDataRequestMonitors =
|
||||
new LinkedList<ValueCountingRequestMonitor>();
|
||||
private List<ValueCountingRequestMonitor> fItemDataRequestMonitors = new LinkedList<ValueCountingRequestMonitor>();
|
||||
private Set<Integer> fIndexesToCancel = new HashSet<Integer>();
|
||||
private int fCancelCallsPending = 0;
|
||||
private Future<?> fRefreshFuture;
|
||||
|
||||
public AsyncSumDataViewer(TableViewer viewer,
|
||||
IDataGenerator[] generators, IDataGenerator sumGenerator)
|
||||
{
|
||||
public AsyncSumDataViewer(TableViewer viewer, IDataGenerator[] generators, IDataGenerator sumGenerator) {
|
||||
fViewer = viewer;
|
||||
fDisplayExecutor = DisplayDsfExecutor.getDisplayDsfExecutor(
|
||||
fViewer.getTable().getDisplay());
|
||||
fDisplayExecutor = DisplayDsfExecutor.getDisplayDsfExecutor(fViewer.getTable().getDisplay());
|
||||
fDataGenerators = generators;
|
||||
fSumGenerator = sumGenerator;
|
||||
|
||||
// Schedule a task to refresh the viewer periodically.
|
||||
fRefreshFuture = fDisplayExecutor.scheduleAtFixedRate(
|
||||
new Runnable() {
|
||||
fRefreshFuture = fDisplayExecutor.scheduleAtFixedRate(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
queryItemCount();
|
||||
}
|
||||
},
|
||||
UPDATE_INTERVAL, UPDATE_INTERVAL, TimeUnit.MILLISECONDS);
|
||||
}, UPDATE_INTERVAL, UPDATE_INTERVAL, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -136,11 +130,12 @@ public class AsyncSumDataViewer implements ILazyContentProvider
|
|||
// Invoke a cancel task with a delay. The delay allows multiple cancel
|
||||
// calls to be combined together improving performance of the viewer.
|
||||
fCancelCallsPending++;
|
||||
fDisplayExecutor.execute(
|
||||
new Runnable() { @Override
|
||||
fDisplayExecutor.execute(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
cancelStaleRequests(topIdx, botIdx);
|
||||
}});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -152,9 +147,7 @@ public class AsyncSumDataViewer implements ILazyContentProvider
|
|||
private int getVisibleItemCount(int top) {
|
||||
Table table = fViewer.getTable();
|
||||
int itemCount = table.getItemCount();
|
||||
return Math.min(
|
||||
(table.getBounds().height / table.getItemHeight()) + 2,
|
||||
itemCount - top);
|
||||
return Math.min((table.getBounds().height / table.getItemHeight()) + 2, itemCount - top);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -165,12 +158,12 @@ public class AsyncSumDataViewer implements ILazyContentProvider
|
|||
// generator is responsible for calculating the count based on
|
||||
// individual data providers' counts.
|
||||
fIndexesToCancel.clear();
|
||||
fSumGenerator.getCount(
|
||||
new DataRequestMonitor<Integer>(fDisplayExecutor, null) {
|
||||
fSumGenerator.getCount(new DataRequestMonitor<Integer>(fDisplayExecutor, null) {
|
||||
@Override
|
||||
protected void handleSuccess() {
|
||||
setCountToViewer(getData());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void handleRejectedExecutionException() {
|
||||
// Shutting down, ignore.
|
||||
|
@ -203,9 +196,7 @@ public class AsyncSumDataViewer implements ILazyContentProvider
|
|||
|
||||
// Counting request monitor is invoked when the required number of
|
||||
// value requests is completed.
|
||||
final ValueCountingRequestMonitor crm =
|
||||
new ValueCountingRequestMonitor(index)
|
||||
{
|
||||
final ValueCountingRequestMonitor crm = new ValueCountingRequestMonitor(index) {
|
||||
@Override
|
||||
protected void handleCompleted() {
|
||||
fItemDataRequestMonitors.remove(this);
|
||||
|
@ -216,7 +207,8 @@ public class AsyncSumDataViewer implements ILazyContentProvider
|
|||
StringBuilder result = new StringBuilder();
|
||||
int calcSum = 0;
|
||||
for (int value : values) {
|
||||
if (result.length() != 0) result.append(" + ");
|
||||
if (result.length() != 0)
|
||||
result.append(" + ");
|
||||
result.append(value);
|
||||
calcSum += value;
|
||||
}
|
||||
|
@ -233,14 +225,11 @@ public class AsyncSumDataViewer implements ILazyContentProvider
|
|||
// Request data from each data generator.
|
||||
for (int i = 0; i < fDataGenerators.length; i++) {
|
||||
final int finalI = i;
|
||||
fDataGenerators[i].getValue(
|
||||
index,
|
||||
fDataGenerators[i].getValue(index,
|
||||
// Use the display executor to construct the request monitor,
|
||||
// this will cause the handleCompleted() method to be
|
||||
// automatically called on the display thread.
|
||||
new DataRequestMonitor<Integer>(
|
||||
ImmediateExecutor.getInstance(), crm)
|
||||
{
|
||||
new DataRequestMonitor<Integer>(ImmediateExecutor.getInstance(), crm) {
|
||||
@Override
|
||||
protected void handleSuccess() {
|
||||
values[finalI] = getData();
|
||||
|
@ -250,11 +239,7 @@ public class AsyncSumDataViewer implements ILazyContentProvider
|
|||
}
|
||||
|
||||
// Separately request data from the sum data generator.
|
||||
fSumGenerator.getValue(
|
||||
index,
|
||||
new DataRequestMonitor<Integer>(
|
||||
ImmediateExecutor.getInstance(), crm)
|
||||
{
|
||||
fSumGenerator.getValue(index, new DataRequestMonitor<Integer>(ImmediateExecutor.getInstance(), crm) {
|
||||
@Override
|
||||
protected void handleSuccess() {
|
||||
sum[0] = getData();
|
||||
|
@ -309,13 +294,12 @@ public class AsyncSumDataViewer implements ILazyContentProvider
|
|||
fCancelCallsPending--;
|
||||
|
||||
// Must check again, in case disposed while re-dispatching.
|
||||
if (fDataGenerators == null || fViewer.getTable().isDisposed()) return;
|
||||
if (fDataGenerators == null || fViewer.getTable().isDisposed())
|
||||
return;
|
||||
|
||||
// Go through the outstanding requests and cancel any that
|
||||
// are not visible anymore.
|
||||
for (Iterator<ValueCountingRequestMonitor> itr =
|
||||
fItemDataRequestMonitors.iterator(); itr.hasNext();)
|
||||
{
|
||||
for (Iterator<ValueCountingRequestMonitor> itr = fItemDataRequestMonitors.iterator(); itr.hasNext();) {
|
||||
ValueCountingRequestMonitor item = itr.next();
|
||||
if (item.fIndex < topIdx || item.fIndex > botIdx) {
|
||||
// Set the item to canceled status, so that the data provider
|
||||
|
@ -361,8 +345,7 @@ public class AsyncSumDataViewer implements ILazyContentProvider
|
|||
Font font = new Font(display, "Courier", 10, SWT.NORMAL);
|
||||
|
||||
// Create the table viewer.
|
||||
TableViewer tableViewer =
|
||||
new TableViewer(shell, SWT.BORDER | SWT.VIRTUAL);
|
||||
TableViewer tableViewer = new TableViewer(shell, SWT.BORDER | SWT.VIRTUAL);
|
||||
tableViewer.getControl().setLayoutData(data);
|
||||
|
||||
// Single executor (and single thread) is used by all data generators,
|
||||
|
@ -374,12 +357,10 @@ public class AsyncSumDataViewer implements ILazyContentProvider
|
|||
for (int i = 0; i < generators.length; i++) {
|
||||
generators[i] = new DataGeneratorWithExecutor(executor);
|
||||
}
|
||||
final IDataGenerator sumGenerator =
|
||||
new AsyncSumDataGenerator(executor, generators);
|
||||
final IDataGenerator sumGenerator = new AsyncSumDataGenerator(executor, generators);
|
||||
|
||||
// Create the content provider which will populate the viewer.
|
||||
AsyncSumDataViewer contentProvider =
|
||||
new AsyncSumDataViewer(tableViewer, generators, sumGenerator);
|
||||
AsyncSumDataViewer contentProvider = new AsyncSumDataViewer(tableViewer, generators, sumGenerator);
|
||||
tableViewer.setContentProvider(contentProvider);
|
||||
tableViewer.setInput(new Object());
|
||||
|
||||
|
@ -396,8 +377,7 @@ public class AsyncSumDataViewer implements ILazyContentProvider
|
|||
Query<Object> shutdownQuery = new Query<Object>() {
|
||||
@Override
|
||||
protected void execute(DataRequestMonitor<Object> rm) {
|
||||
CountingRequestMonitor crm = new CountingRequestMonitor(
|
||||
ImmediateExecutor.getInstance(), rm);
|
||||
CountingRequestMonitor crm = new CountingRequestMonitor(ImmediateExecutor.getInstance(), rm);
|
||||
for (int i = 0; i < generators.length; i++) {
|
||||
generators[i].shutdown(crm);
|
||||
}
|
||||
|
@ -409,7 +389,8 @@ public class AsyncSumDataViewer implements ILazyContentProvider
|
|||
executor.execute(shutdownQuery);
|
||||
try {
|
||||
shutdownQuery.get();
|
||||
} catch (Exception e) {}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
|
||||
// Shut down the display.
|
||||
font.dispose();
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
//#ifdef exercises
|
||||
package org.eclipse.cdt.examples.dsf.dataviewer;
|
||||
//#else
|
||||
|
||||
//#package org.eclipse.cdt.examples.dsf.dataviewer.answers;
|
||||
//#endif
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
//#ifdef exercises
|
||||
package org.eclipse.cdt.examples.dsf.dataviewer;
|
||||
//#else
|
||||
|
||||
//#package org.eclipse.cdt.examples.dsf.dataviewer.answers;
|
||||
//#endif
|
||||
|
||||
|
@ -66,7 +67,7 @@ public class DataGeneratorWithExecutor implements IDataGenerator {
|
|||
// TODO Exercise 4 - Add an annotationindicating allowed concurrency access
|
||||
// Hint: Request and its subclasses have all their fields declared as final.
|
||||
//#else
|
||||
//# @Immutable
|
||||
//# @Immutable
|
||||
//#endif
|
||||
abstract class Request {
|
||||
final RequestMonitor fRequestMonitor;
|
||||
|
@ -92,7 +93,7 @@ public class DataGeneratorWithExecutor implements IDataGenerator {
|
|||
// TODO Exercise 4 - Add an annotation (ThreadSafe/ConfinedToDsfExecutor)
|
||||
// indicating allowed thread access to this class/method/member
|
||||
//#else
|
||||
//# @Immutable
|
||||
//# @Immutable
|
||||
//#endif
|
||||
class CountRequest extends Request {
|
||||
CountRequest(DataRequestMonitor<Integer> rm) {
|
||||
|
@ -104,10 +105,11 @@ public class DataGeneratorWithExecutor implements IDataGenerator {
|
|||
// TODO Exercise 4 - Add an annotation (ThreadSafe/ConfinedToDsfExecutor)
|
||||
// indicating allowed thread access to this class/method/member
|
||||
//#else
|
||||
//# @Immutable
|
||||
//# @Immutable
|
||||
//#endif
|
||||
class ItemRequest extends Request {
|
||||
final int fIndex;
|
||||
|
||||
ItemRequest(int index, DataRequestMonitor<Integer> rm) {
|
||||
super(rm);
|
||||
fIndex = index;
|
||||
|
@ -132,7 +134,7 @@ public class DataGeneratorWithExecutor implements IDataGenerator {
|
|||
// TODO Exercise 4 - Add an annotation (ThreadSafe/ConfinedToDsfExecutor)
|
||||
// indicating allowed thread access to this class/method/member
|
||||
//#else
|
||||
//# @ConfinedToDsfExecutor("fExecutor")
|
||||
//# @ConfinedToDsfExecutor("fExecutor")
|
||||
//#endif
|
||||
private List<Request> fQueue = new LinkedList<Request>();
|
||||
|
||||
|
@ -142,7 +144,7 @@ public class DataGeneratorWithExecutor implements IDataGenerator {
|
|||
// TODO Exercise 4 - Add an annotation (ThreadSafe/ConfinedToDsfExecutor)
|
||||
// indicating allowed thread access to this class/method/member
|
||||
//#else
|
||||
//# @ConfinedToDsfExecutor("fExecutor")
|
||||
//# @ConfinedToDsfExecutor("fExecutor")
|
||||
//#endif
|
||||
private List<Listener> fListeners = new LinkedList<Listener>();
|
||||
|
||||
|
@ -151,7 +153,7 @@ public class DataGeneratorWithExecutor implements IDataGenerator {
|
|||
// TODO Exercise 4 - Add an annotation (ThreadSafe/ConfinedToDsfExecutor)
|
||||
// indicating allowed thread access to this class/method/member
|
||||
//#else
|
||||
//# @ConfinedToDsfExecutor("fExecutor")
|
||||
//# @ConfinedToDsfExecutor("fExecutor")
|
||||
//#endif
|
||||
private int fCount = MIN_COUNT;
|
||||
|
||||
|
@ -160,7 +162,7 @@ public class DataGeneratorWithExecutor implements IDataGenerator {
|
|||
// TODO Exercise 4 - Add an annotation (ThreadSafe/ConfinedToDsfExecutor)
|
||||
// indicating allowed thread access to this class/method/member
|
||||
//#else
|
||||
//# @ConfinedToDsfExecutor("fExecutor")
|
||||
//# @ConfinedToDsfExecutor("fExecutor")
|
||||
//#endif
|
||||
private int fCountResetTrigger = 0;
|
||||
|
||||
|
@ -169,15 +171,15 @@ public class DataGeneratorWithExecutor implements IDataGenerator {
|
|||
// TODO Exercise 4 - Add an annotation (ThreadSafe/ConfinedToDsfExecutor)
|
||||
// indicating allowed thread access to this class/method/member
|
||||
//#else
|
||||
//# @ConfinedToDsfExecutor("fExecutor")
|
||||
//# @ConfinedToDsfExecutor("fExecutor")
|
||||
//#endif
|
||||
private Map<Integer, Integer> fChangedValues =
|
||||
new HashMap<Integer, Integer>();
|
||||
private Map<Integer, Integer> fChangedValues = new HashMap<Integer, Integer>();
|
||||
|
||||
public DataGeneratorWithExecutor() {
|
||||
// Create the executor
|
||||
this(new DefaultDsfExecutor("Supplier Executor"));
|
||||
}
|
||||
|
||||
//#ifdef exercises
|
||||
// TODO Exercise 4 - Add an annotation (ThreadSafe/ConfinedToDsfExecutor)
|
||||
// indicating allowed thread access to this class/method/member
|
||||
|
@ -187,15 +189,12 @@ public class DataGeneratorWithExecutor implements IDataGenerator {
|
|||
fExecutor = executor;
|
||||
final Random rand = new Random();
|
||||
// Schedule a runnable to make the random changes.
|
||||
fExecutor.scheduleAtFixedRate(
|
||||
new DsfRunnable() {
|
||||
fExecutor.scheduleAtFixedRate(new DsfRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
randomChanges();
|
||||
}
|
||||
},
|
||||
rand.nextInt(RANDOM_CHANGE_INTERVAL),
|
||||
RANDOM_CHANGE_INTERVAL, //Add a 10% variance to the interval.
|
||||
}, rand.nextInt(RANDOM_CHANGE_INTERVAL), RANDOM_CHANGE_INTERVAL, //Add a 10% variance to the interval.
|
||||
TimeUnit.MILLISECONDS);
|
||||
}
|
||||
|
||||
|
@ -206,14 +205,13 @@ public class DataGeneratorWithExecutor implements IDataGenerator {
|
|||
@Override
|
||||
public void shutdown(final RequestMonitor rm) {
|
||||
try {
|
||||
fExecutor.execute( new DsfRunnable() {
|
||||
fExecutor.execute(new DsfRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
// Empty the queue of requests and fail them.
|
||||
for (Request request : fQueue) {
|
||||
request.fRequestMonitor.setStatus(new Status(
|
||||
IStatus.ERROR, DsfExamplesPlugin.PLUGIN_ID,
|
||||
"Supplier shut down"));
|
||||
request.fRequestMonitor.setStatus(
|
||||
new Status(IStatus.ERROR, DsfExamplesPlugin.PLUGIN_ID, "Supplier shut down"));
|
||||
request.fRequestMonitor.done();
|
||||
}
|
||||
fQueue.clear();
|
||||
|
@ -224,8 +222,7 @@ public class DataGeneratorWithExecutor implements IDataGenerator {
|
|||
}
|
||||
});
|
||||
} catch (RejectedExecutionException e) {
|
||||
rm.setStatus(new Status(IStatus.ERROR, DsfExamplesPlugin.PLUGIN_ID,
|
||||
"Supplier shut down"));
|
||||
rm.setStatus(new Status(IStatus.ERROR, DsfExamplesPlugin.PLUGIN_ID, "Supplier shut down"));
|
||||
rm.done();
|
||||
}
|
||||
}
|
||||
|
@ -237,7 +234,7 @@ public class DataGeneratorWithExecutor implements IDataGenerator {
|
|||
@Override
|
||||
public void getCount(final DataRequestMonitor<Integer> rm) {
|
||||
try {
|
||||
fExecutor.execute( new DsfRunnable() {
|
||||
fExecutor.execute(new DsfRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
fQueue.add(new CountRequest(rm));
|
||||
|
@ -245,9 +242,7 @@ public class DataGeneratorWithExecutor implements IDataGenerator {
|
|||
}
|
||||
});
|
||||
} catch (RejectedExecutionException e) {
|
||||
rm.setStatus(new Status(
|
||||
IStatus.ERROR, DsfExamplesPlugin.PLUGIN_ID,
|
||||
"Supplier shut down"));
|
||||
rm.setStatus(new Status(IStatus.ERROR, DsfExamplesPlugin.PLUGIN_ID, "Supplier shut down"));
|
||||
rm.done();
|
||||
}
|
||||
}
|
||||
|
@ -259,7 +254,7 @@ public class DataGeneratorWithExecutor implements IDataGenerator {
|
|||
@Override
|
||||
public void getValue(final int index, final DataRequestMonitor<Integer> rm) {
|
||||
try {
|
||||
fExecutor.execute( new DsfRunnable() {
|
||||
fExecutor.execute(new DsfRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
fQueue.add(new ItemRequest(index, rm));
|
||||
|
@ -267,8 +262,7 @@ public class DataGeneratorWithExecutor implements IDataGenerator {
|
|||
}
|
||||
});
|
||||
} catch (RejectedExecutionException e) {
|
||||
rm.setStatus(new Status(IStatus.ERROR, DsfExamplesPlugin.PLUGIN_ID,
|
||||
"Supplier shut down"));
|
||||
rm.setStatus(new Status(IStatus.ERROR, DsfExamplesPlugin.PLUGIN_ID, "Supplier shut down"));
|
||||
rm.done();
|
||||
}
|
||||
}
|
||||
|
@ -280,13 +274,14 @@ public class DataGeneratorWithExecutor implements IDataGenerator {
|
|||
@Override
|
||||
public void addListener(final Listener listener) {
|
||||
try {
|
||||
fExecutor.execute( new DsfRunnable() {
|
||||
fExecutor.execute(new DsfRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
fListeners.add(listener);
|
||||
}
|
||||
});
|
||||
} catch (RejectedExecutionException e) {}
|
||||
} catch (RejectedExecutionException e) {
|
||||
}
|
||||
}
|
||||
|
||||
//#ifdef exercises
|
||||
|
@ -296,13 +291,14 @@ public class DataGeneratorWithExecutor implements IDataGenerator {
|
|||
@Override
|
||||
public void removeListener(final Listener listener) {
|
||||
try {
|
||||
fExecutor.execute( new DsfRunnable() {
|
||||
fExecutor.execute(new DsfRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
fListeners.remove(listener);
|
||||
}
|
||||
});
|
||||
} catch (RejectedExecutionException e) {}
|
||||
} catch (RejectedExecutionException e) {
|
||||
}
|
||||
}
|
||||
|
||||
// Main processing function of this generator.
|
||||
|
@ -310,24 +306,22 @@ public class DataGeneratorWithExecutor implements IDataGenerator {
|
|||
// TODO Exercise 4 - Add an annotation (ThreadSafe/ConfinedToDsfExecutor)
|
||||
// indicating allowed thread access to this class/method/member
|
||||
//#else
|
||||
//# @ConfinedToDsfExecutor("fExecutor")
|
||||
//# @ConfinedToDsfExecutor("fExecutor")
|
||||
//#endif
|
||||
private void serviceQueue() {
|
||||
fExecutor.schedule(
|
||||
new DsfRunnable() {
|
||||
fExecutor.schedule(new DsfRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
doServiceQueue();
|
||||
}
|
||||
},
|
||||
PROCESSING_DELAY, TimeUnit.MILLISECONDS);
|
||||
}, PROCESSING_DELAY, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
|
||||
//#ifdef exercises
|
||||
// TODO Exercise 4 - Add an annotation (ThreadSafe/ConfinedToDsfExecutor)
|
||||
// indicating allowed thread access to this class/method/member
|
||||
//#else
|
||||
//# @ConfinedToDsfExecutor("fExecutor")
|
||||
//# @ConfinedToDsfExecutor("fExecutor")
|
||||
//#endif
|
||||
private void doServiceQueue() {
|
||||
//#ifdef exercises
|
||||
|
@ -337,15 +331,15 @@ public class DataGeneratorWithExecutor implements IDataGenerator {
|
|||
// thread. This method can safely iterate and modify fQueue without
|
||||
// risk of race conditions or concurrent modification exceptions.
|
||||
//#else
|
||||
//# for (Iterator<Request> requestItr = fQueue.iterator(); requestItr.hasNext();) {
|
||||
//# Request request = requestItr.next();
|
||||
//# if (request.fRequestMonitor.isCanceled()) {
|
||||
//# request.fRequestMonitor.setStatus(
|
||||
//# new Status(IStatus.CANCEL, DsfExamplesPlugin.PLUGIN_ID, "Request canceled"));
|
||||
//# request.fRequestMonitor.done();
|
||||
//# requestItr.remove();
|
||||
//# }
|
||||
//# }
|
||||
//# for (Iterator<Request> requestItr = fQueue.iterator(); requestItr.hasNext();) {
|
||||
//# Request request = requestItr.next();
|
||||
//# if (request.fRequestMonitor.isCanceled()) {
|
||||
//# request.fRequestMonitor.setStatus(
|
||||
//# new Status(IStatus.CANCEL, DsfExamplesPlugin.PLUGIN_ID, "Request canceled"));
|
||||
//# request.fRequestMonitor.done();
|
||||
//# requestItr.remove();
|
||||
//# }
|
||||
//# }
|
||||
//#endif
|
||||
|
||||
while (fQueue.size() != 0) {
|
||||
|
@ -354,9 +348,9 @@ public class DataGeneratorWithExecutor implements IDataGenerator {
|
|||
// delay.
|
||||
Request request = fQueue.remove(0);
|
||||
if (request instanceof CountRequest) {
|
||||
processCountRequest((CountRequest)request);
|
||||
processCountRequest((CountRequest) request);
|
||||
} else if (request instanceof ItemRequest) {
|
||||
processItemRequest((ItemRequest)request);
|
||||
processItemRequest((ItemRequest) request);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -365,12 +359,11 @@ public class DataGeneratorWithExecutor implements IDataGenerator {
|
|||
// TODO Exercise 4 - Add an annotation (ThreadSafe/ConfinedToDsfExecutor)
|
||||
// indicating allowed thread access to this class/method/member
|
||||
//#else
|
||||
//# @ConfinedToDsfExecutor("fExecutor")
|
||||
//# @ConfinedToDsfExecutor("fExecutor")
|
||||
//#endif
|
||||
private void processCountRequest(CountRequest request) {
|
||||
@SuppressWarnings("unchecked") // Suppress warning about lost type info.
|
||||
DataRequestMonitor<Integer> rm =
|
||||
(DataRequestMonitor<Integer>)request.fRequestMonitor;
|
||||
DataRequestMonitor<Integer> rm = (DataRequestMonitor<Integer>) request.fRequestMonitor;
|
||||
|
||||
rm.setData(fCount);
|
||||
rm.done();
|
||||
|
@ -380,12 +373,11 @@ public class DataGeneratorWithExecutor implements IDataGenerator {
|
|||
// TODO Exercise 4 - Add an annotation (ThreadSafe/ConfinedToDsfExecutor)
|
||||
// indicating allowed thread access to this class/method/member
|
||||
//#else
|
||||
//# @ConfinedToDsfExecutor("fExecutor")
|
||||
//# @ConfinedToDsfExecutor("fExecutor")
|
||||
//#endif
|
||||
private void processItemRequest(ItemRequest request) {
|
||||
@SuppressWarnings("unchecked") // Suppress warning about lost type info.
|
||||
DataRequestMonitor<Integer> rm =
|
||||
(DataRequestMonitor<Integer>)request.fRequestMonitor;
|
||||
DataRequestMonitor<Integer> rm = (DataRequestMonitor<Integer>) request.fRequestMonitor;
|
||||
|
||||
if (fChangedValues.containsKey(request.fIndex)) {
|
||||
rm.setData(fChangedValues.get(request.fIndex));
|
||||
|
@ -402,12 +394,12 @@ public class DataGeneratorWithExecutor implements IDataGenerator {
|
|||
// TODO Exercise 4 - Add an annotation (ThreadSafe/ConfinedToDsfExecutor)
|
||||
// indicating allowed thread access to this class/method/member
|
||||
//#else
|
||||
//# @ConfinedToDsfExecutor("fExecutor")
|
||||
//# @ConfinedToDsfExecutor("fExecutor")
|
||||
//#endif
|
||||
private void randomChanges() {
|
||||
// Once every number of changes, reset the count, the rest of the
|
||||
// times just change certain values.
|
||||
if (++fCountResetTrigger % RANDOM_COUNT_CHANGE_INTERVALS == 0){
|
||||
if (++fCountResetTrigger % RANDOM_COUNT_CHANGE_INTERVALS == 0) {
|
||||
randomCountReset();
|
||||
} else {
|
||||
randomDataChange();
|
||||
|
@ -421,7 +413,7 @@ public class DataGeneratorWithExecutor implements IDataGenerator {
|
|||
// TODO Exercise 4 - Add an annotation (ThreadSafe/ConfinedToDsfExecutor)
|
||||
// indicating allowed thread access to this class/method/member
|
||||
//#else
|
||||
//# @ConfinedToDsfExecutor("fExecutor")
|
||||
//# @ConfinedToDsfExecutor("fExecutor")
|
||||
//#endif
|
||||
private void randomCountReset() {
|
||||
// Calculate the new count.
|
||||
|
@ -444,7 +436,7 @@ public class DataGeneratorWithExecutor implements IDataGenerator {
|
|||
// TODO Exercise 4 - Add an annotation (ThreadSafe/ConfinedToDsfExecutor)
|
||||
// indicating allowed thread access to this class/method/member
|
||||
//#else
|
||||
//# @ConfinedToDsfExecutor("fExecutor")
|
||||
//# @ConfinedToDsfExecutor("fExecutor")
|
||||
//#endif
|
||||
private void randomDataChange() {
|
||||
// Calculate the indexes to change.
|
||||
|
@ -461,8 +453,7 @@ public class DataGeneratorWithExecutor implements IDataGenerator {
|
|||
|
||||
// Notify listeners
|
||||
for (Object listener : fListeners) {
|
||||
((Listener)listener).valuesChanged(changed.keySet());
|
||||
((Listener) listener).valuesChanged(changed.keySet());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
//#ifdef exercises
|
||||
package org.eclipse.cdt.examples.dsf.dataviewer;
|
||||
//#else
|
||||
|
||||
//#package org.eclipse.cdt.examples.dsf.dataviewer.answers;
|
||||
//#endif
|
||||
|
||||
|
@ -44,9 +45,7 @@ import org.eclipse.cdt.examples.dsf.DsfExamplesPlugin;
|
|||
* synchronization.
|
||||
* </p>
|
||||
*/
|
||||
public class DataGeneratorWithThread extends Thread
|
||||
implements IDataGenerator
|
||||
{
|
||||
public class DataGeneratorWithThread extends Thread implements IDataGenerator {
|
||||
|
||||
// Request objects are used to serialize the interface calls into objects
|
||||
// which can then be pushed into a queue.
|
||||
|
@ -66,6 +65,7 @@ public class DataGeneratorWithThread extends Thread
|
|||
|
||||
class ItemRequest extends Request {
|
||||
final int fIndex;
|
||||
|
||||
ItemRequest(int index, DataRequestMonitor<Integer> rm) {
|
||||
super(rm);
|
||||
fIndex = index;
|
||||
|
@ -81,8 +81,7 @@ public class DataGeneratorWithThread extends Thread
|
|||
// Main request queue of the data generator. The getValue(), getCount(),
|
||||
// and shutdown() methods write into the queue, while the run() method
|
||||
// reads from it.
|
||||
private final BlockingQueue<Request> fQueue =
|
||||
new LinkedBlockingQueue<Request>();
|
||||
private final BlockingQueue<Request> fQueue = new LinkedBlockingQueue<Request>();
|
||||
|
||||
// ListenerList class provides thread safety.
|
||||
private ListenerList<Listener> fListeners = new ListenerList<>();
|
||||
|
@ -94,8 +93,7 @@ public class DataGeneratorWithThread extends Thread
|
|||
private int fCountResetTrigger = 0;
|
||||
|
||||
// Elements which were modified since the last reset.
|
||||
private Map<Integer, Integer> fChangedValues =
|
||||
Collections.synchronizedMap(new HashMap<Integer, Integer>());
|
||||
private Map<Integer, Integer> fChangedValues = Collections.synchronizedMap(new HashMap<Integer, Integer>());
|
||||
|
||||
// Used to determine when to make changes in data.
|
||||
private long fLastChangeTime = System.currentTimeMillis();
|
||||
|
@ -116,8 +114,7 @@ public class DataGeneratorWithThread extends Thread
|
|||
fQueue.add(new ShutdownRequest(rm));
|
||||
} else {
|
||||
//
|
||||
rm.setStatus(new Status(IStatus.ERROR, DsfExamplesPlugin.PLUGIN_ID,
|
||||
"Supplier shut down"));
|
||||
rm.setStatus(new Status(IStatus.ERROR, DsfExamplesPlugin.PLUGIN_ID, "Supplier shut down"));
|
||||
rm.done();
|
||||
}
|
||||
}
|
||||
|
@ -127,8 +124,7 @@ public class DataGeneratorWithThread extends Thread
|
|||
if (!fShutdown.get()) {
|
||||
fQueue.add(new CountRequest(rm));
|
||||
} else {
|
||||
rm.setStatus(new Status(IStatus.ERROR, DsfExamplesPlugin.PLUGIN_ID,
|
||||
"Supplier shut down"));
|
||||
rm.setStatus(new Status(IStatus.ERROR, DsfExamplesPlugin.PLUGIN_ID, "Supplier shut down"));
|
||||
rm.done();
|
||||
}
|
||||
}
|
||||
|
@ -138,8 +134,7 @@ public class DataGeneratorWithThread extends Thread
|
|||
if (!fShutdown.get()) {
|
||||
fQueue.add(new ItemRequest(index, rm));
|
||||
} else {
|
||||
rm.setStatus(new Status(IStatus.ERROR, DsfExamplesPlugin.PLUGIN_ID,
|
||||
"Supplier shut down"));
|
||||
rm.setStatus(new Status(IStatus.ERROR, DsfExamplesPlugin.PLUGIN_ID, "Supplier shut down"));
|
||||
rm.done();
|
||||
}
|
||||
}
|
||||
|
@ -157,7 +152,7 @@ public class DataGeneratorWithThread extends Thread
|
|||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
while(true) {
|
||||
while (true) {
|
||||
// Get the next request from the queue. The time-out
|
||||
// ensures that that the random changes get processed.
|
||||
final Request request = fQueue.poll(100, TimeUnit.MILLISECONDS);
|
||||
|
@ -167,9 +162,9 @@ public class DataGeneratorWithThread extends Thread
|
|||
// Simulate a processing delay.
|
||||
|
||||
if (request instanceof CountRequest) {
|
||||
processCountRequest((CountRequest)request);
|
||||
processCountRequest((CountRequest) request);
|
||||
} else if (request instanceof ItemRequest) {
|
||||
processItemRequest((ItemRequest)request);
|
||||
processItemRequest((ItemRequest) request);
|
||||
} else if (request instanceof ShutdownRequest) {
|
||||
// If shutting down, just break out of the while(true)
|
||||
// loop and thread will exit.
|
||||
|
@ -183,14 +178,13 @@ public class DataGeneratorWithThread extends Thread
|
|||
// Simulate data changes.
|
||||
randomChanges();
|
||||
}
|
||||
} catch (InterruptedException x) {
|
||||
}
|
||||
catch (InterruptedException x) {}
|
||||
}
|
||||
|
||||
private void processCountRequest(CountRequest request) {
|
||||
@SuppressWarnings("unchecked") // Suppress warning about lost type info.
|
||||
DataRequestMonitor<Integer> rm =
|
||||
(DataRequestMonitor<Integer>)request.fRequestMonitor;
|
||||
DataRequestMonitor<Integer> rm = (DataRequestMonitor<Integer>) request.fRequestMonitor;
|
||||
|
||||
rm.setData(fCount);
|
||||
rm.done();
|
||||
|
@ -198,8 +192,7 @@ public class DataGeneratorWithThread extends Thread
|
|||
|
||||
private void processItemRequest(ItemRequest request) {
|
||||
@SuppressWarnings("unchecked") // Suppress warning about lost type info.
|
||||
DataRequestMonitor<Integer> rm =
|
||||
(DataRequestMonitor<Integer>)request.fRequestMonitor;
|
||||
DataRequestMonitor<Integer> rm = (DataRequestMonitor<Integer>) request.fRequestMonitor;
|
||||
|
||||
if (fChangedValues.containsKey(request.fIndex)) {
|
||||
rm.setData(fChangedValues.get(request.fIndex));
|
||||
|
@ -209,12 +202,9 @@ public class DataGeneratorWithThread extends Thread
|
|||
rm.done();
|
||||
}
|
||||
|
||||
|
||||
private void randomChanges() {
|
||||
// Check if enough time is elapsed.
|
||||
if (System.currentTimeMillis() >
|
||||
fLastChangeTime + RANDOM_CHANGE_INTERVAL)
|
||||
{
|
||||
if (System.currentTimeMillis() > fLastChangeTime + RANDOM_CHANGE_INTERVAL) {
|
||||
fLastChangeTime = System.currentTimeMillis();
|
||||
|
||||
// Once every number of changes, reset the count, the rest of the
|
||||
|
@ -237,7 +227,7 @@ public class DataGeneratorWithThread extends Thread
|
|||
|
||||
// Notify listeners
|
||||
for (Object listener : fListeners.getListeners()) {
|
||||
((Listener)listener).countChanged();
|
||||
((Listener) listener).countChanged();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -256,9 +246,7 @@ public class DataGeneratorWithThread extends Thread
|
|||
|
||||
// Notify listeners
|
||||
for (Object listener : fListeners.getListeners()) {
|
||||
((Listener)listener).valuesChanged(changed.keySet());
|
||||
((Listener) listener).valuesChanged(changed.keySet());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
//#ifdef exercises
|
||||
package org.eclipse.cdt.examples.dsf.dataviewer;
|
||||
//#else
|
||||
|
||||
//#package org.eclipse.cdt.examples.dsf.dataviewer.answers;
|
||||
//#endif
|
||||
|
||||
|
@ -51,16 +52,17 @@ public interface IDataGenerator {
|
|||
final static int RANDOM_COUNT_CHANGE_INTERVALS = 5;
|
||||
final static int RANDOM_CHANGE_SET_PERCENTAGE = 10;
|
||||
|
||||
|
||||
// Listener interface that the view needs to implement to react
|
||||
// to the changes in data.
|
||||
public interface Listener {
|
||||
void countChanged();
|
||||
|
||||
void valuesChanged(Set<Integer> indexes);
|
||||
}
|
||||
|
||||
// Data access methods.
|
||||
void getCount(DataRequestMonitor<Integer> rm);
|
||||
|
||||
void getValue(int index, DataRequestMonitor<Integer> rm);
|
||||
|
||||
// Method used to shutdown the data generator including any threads that
|
||||
|
@ -69,5 +71,6 @@ public interface IDataGenerator {
|
|||
|
||||
// Methods for registering change listeners.
|
||||
void addListener(Listener listener);
|
||||
|
||||
void removeListener(Listener listener);
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
//#ifdef exercises
|
||||
package org.eclipse.cdt.examples.dsf.dataviewer;
|
||||
//#else
|
||||
|
||||
//#package org.eclipse.cdt.examples.dsf.dataviewer.answers;
|
||||
//#endif
|
||||
|
||||
|
@ -46,9 +47,7 @@ import org.eclipse.swt.widgets.Shell;
|
|||
* {@link Query} object.
|
||||
* </p>
|
||||
*/
|
||||
public class SyncDataViewer
|
||||
implements IStructuredContentProvider, IDataGenerator.Listener
|
||||
{
|
||||
public class SyncDataViewer implements IStructuredContentProvider, IDataGenerator.Listener {
|
||||
// The viewer and generator that this content provider using.
|
||||
final private TableViewer fViewer;
|
||||
final private IDataGenerator fDataGenerator;
|
||||
|
@ -64,7 +63,6 @@ public class SyncDataViewer
|
|||
// Not used
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Object[] getElements(Object inputElement) {
|
||||
|
||||
|
@ -97,9 +95,7 @@ public class SyncDataViewer
|
|||
@Override
|
||||
protected void execute(final DataRequestMonitor<List<Integer>> rm) {
|
||||
final Integer[] retVal = new Integer[finalCount];
|
||||
final CountingRequestMonitor crm = new CountingRequestMonitor(
|
||||
ImmediateExecutor.getInstance(), rm)
|
||||
{
|
||||
final CountingRequestMonitor crm = new CountingRequestMonitor(ImmediateExecutor.getInstance(), rm) {
|
||||
@Override
|
||||
protected void handleSuccess() {
|
||||
rm.setData(Arrays.asList(retVal));
|
||||
|
@ -108,11 +104,7 @@ public class SyncDataViewer
|
|||
};
|
||||
for (int i = 0; i < finalCount; i++) {
|
||||
final int finalI = i;
|
||||
fDataGenerator.getValue(
|
||||
i,
|
||||
new DataRequestMonitor<Integer>(
|
||||
ImmediateExecutor.getInstance(), crm)
|
||||
{
|
||||
fDataGenerator.getValue(i, new DataRequestMonitor<Integer>(ImmediateExecutor.getInstance(), crm) {
|
||||
@Override
|
||||
protected void handleSuccess() {
|
||||
retVal[finalI] = getData();
|
||||
|
@ -152,13 +144,13 @@ public class SyncDataViewer
|
|||
//#ifdef exercises
|
||||
// TODO Exercise 5 - Add a call to getElements() to force a deadlock.
|
||||
//#else
|
||||
//# getElements(null);
|
||||
//# getElements(null);
|
||||
//#endif
|
||||
|
||||
// This method may be called on any thread, switch to the display
|
||||
// thread before calling the viewer.
|
||||
Display display = fViewer.getControl().getDisplay();
|
||||
display.asyncExec( new Runnable() {
|
||||
display.asyncExec(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (!fViewer.getControl().isDisposed()) {
|
||||
|
@ -190,12 +182,11 @@ public class SyncDataViewer
|
|||
// TODO Exercise 5 - Use the DataGeneratorWithExecutor() instead.
|
||||
final IDataGenerator generator = new DataGeneratorWithThread();
|
||||
//#else
|
||||
//# final IDataGenerator generator = new DataGeneratorWithExecutor();
|
||||
//# final IDataGenerator generator = new DataGeneratorWithExecutor();
|
||||
//#endif
|
||||
|
||||
// Create the content provider which will populate the viewer.
|
||||
SyncDataViewer contentProvider =
|
||||
new SyncDataViewer(tableViewer, generator);
|
||||
SyncDataViewer contentProvider = new SyncDataViewer(tableViewer, generator);
|
||||
tableViewer.setContentProvider(contentProvider);
|
||||
tableViewer.setInput(new Object());
|
||||
|
||||
|
@ -218,7 +209,8 @@ public class SyncDataViewer
|
|||
ImmediateExecutor.getInstance().execute(shutdownQuery);
|
||||
try {
|
||||
shutdownQuery.get();
|
||||
} catch (Exception e) {}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
|
||||
// Shut down the display.
|
||||
font.dispose();
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
//#ifdef exercises
|
||||
package org.eclipse.cdt.examples.dsf.requestmonitor;
|
||||
//#else
|
||||
|
||||
//#package org.eclipse.cdt.examples.dsf.requestmonitor.answers;
|
||||
//#endif
|
||||
|
||||
|
@ -30,8 +31,7 @@ public class Async2Plus2 {
|
|||
|
||||
public static void main(String[] args) {
|
||||
Executor executor = ImmediateExecutor.getInstance();
|
||||
DataRequestMonitor<Integer> rm =
|
||||
new DataRequestMonitor<Integer>(executor, null) {
|
||||
DataRequestMonitor<Integer> rm = new DataRequestMonitor<Integer>(executor, null) {
|
||||
@Override
|
||||
protected void handleCompleted() {
|
||||
System.out.println("2 + 2 = " + getData());
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
//#ifdef exercises
|
||||
package org.eclipse.cdt.examples.dsf.requestmonitor;
|
||||
//#else
|
||||
|
||||
//#package org.eclipse.cdt.examples.dsf.requestmonitor.answers;
|
||||
//#endif
|
||||
|
||||
|
@ -49,17 +50,17 @@ public class AsyncHelloWorld {
|
|||
// completed.
|
||||
rm.done();
|
||||
//#else
|
||||
//# RequestMonitor rm2 = new RequestMonitor(ImmediateExecutor.getInstance(), rm);
|
||||
//# asyncHelloWorld2(rm2);
|
||||
//# RequestMonitor rm2 = new RequestMonitor(ImmediateExecutor.getInstance(), rm);
|
||||
//# asyncHelloWorld2(rm2);
|
||||
//#endif
|
||||
}
|
||||
|
||||
//#ifdef exercises
|
||||
// TODO: Exercise 1 - Add a second async. "Hello world 2" method.
|
||||
//#else
|
||||
//# static void asyncHelloWorld2(RequestMonitor rm) {
|
||||
//# System.out.println("Hello world 2");
|
||||
//# rm.done();
|
||||
//# }
|
||||
//# static void asyncHelloWorld2(RequestMonitor rm) {
|
||||
//# System.out.println("Hello world 2");
|
||||
//# rm.done();
|
||||
//# }
|
||||
//#endif
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
//#ifdef exercises
|
||||
package org.eclipse.cdt.examples.dsf.requestmonitor;
|
||||
//#else
|
||||
|
||||
//#package org.eclipse.cdt.examples.dsf.requestmonitor.answers;
|
||||
//#endif
|
||||
|
||||
|
@ -36,12 +37,10 @@ public class AsyncQuicksort {
|
|||
static Executor fgExecutor = ImmediateExecutor.getInstance();
|
||||
|
||||
public static void main(String[] args) {
|
||||
final int[] array = {5, 7, 8, 3, 2, 1, 9, 5, 4};
|
||||
final int[] array = { 5, 7, 8, 3, 2, 1, 9, 5, 4 };
|
||||
|
||||
System.out.println("To sort: " + Arrays.toString(array));
|
||||
asyncQuicksort(
|
||||
array, 0, array.length - 1,
|
||||
new RequestMonitor(fgExecutor, null) {
|
||||
asyncQuicksort(array, 0, array.length - 1, new RequestMonitor(fgExecutor, null) {
|
||||
@Override
|
||||
protected void handleCompleted() {
|
||||
System.out.println("Sorted: " + Arrays.toString(array));
|
||||
|
@ -49,9 +48,7 @@ public class AsyncQuicksort {
|
|||
});
|
||||
}
|
||||
|
||||
static void asyncQuicksort(final int[] array, final int left,
|
||||
final int right, final RequestMonitor rm)
|
||||
{
|
||||
static void asyncQuicksort(final int[] array, final int left, final int right, final RequestMonitor rm) {
|
||||
if (right > left) {
|
||||
int pivot = left;
|
||||
//#ifdef exercises
|
||||
|
@ -67,20 +64,20 @@ public class AsyncQuicksort {
|
|||
asyncQuicksort(array, newPivot + 1, right, countingRm);
|
||||
countingRm.setDoneCount(2);
|
||||
//#else
|
||||
//# asyncPartition(
|
||||
//# array, left, right, pivot,
|
||||
//# new DataRequestMonitor<Integer>(fgExecutor, rm) {
|
||||
//# @Override
|
||||
//# protected void handleCompleted() {
|
||||
//# int newPivot = getData();
|
||||
//# printArray(array, left, right, newPivot);
|
||||
//#
|
||||
//# CountingRequestMonitor countingRm = new CountingRequestMonitor(fgExecutor, rm);
|
||||
//# asyncQuicksort(array, left, newPivot - 1, countingRm);
|
||||
//# asyncQuicksort(array, newPivot + 1, right, countingRm);
|
||||
//# countingRm.setDoneCount(2);
|
||||
//# }
|
||||
//# });
|
||||
//# asyncPartition(
|
||||
//# array, left, right, pivot,
|
||||
//# new DataRequestMonitor<Integer>(fgExecutor, rm) {
|
||||
//# @Override
|
||||
//# protected void handleCompleted() {
|
||||
//# int newPivot = getData();
|
||||
//# printArray(array, left, right, newPivot);
|
||||
//#
|
||||
//# CountingRequestMonitor countingRm = new CountingRequestMonitor(fgExecutor, rm);
|
||||
//# asyncQuicksort(array, left, newPivot - 1, countingRm);
|
||||
//# asyncQuicksort(array, newPivot + 1, right, countingRm);
|
||||
//# countingRm.setDoneCount(2);
|
||||
//# }
|
||||
//# });
|
||||
//#endif
|
||||
} else {
|
||||
rm.done();
|
||||
|
@ -93,7 +90,7 @@ public class AsyncQuicksort {
|
|||
// return value to the caller.
|
||||
static int partition(int[] array, int left, int right, int pivot)
|
||||
//#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
|
||||
{
|
||||
int pivotValue = array[pivot];
|
||||
|
@ -116,16 +113,16 @@ public class AsyncQuicksort {
|
|||
// a request monitor.
|
||||
return store;
|
||||
//#else
|
||||
//# // Java 5 automatically converts the int type of the store variable
|
||||
//# // to an Integer object.
|
||||
//# rm.setData(store);
|
||||
//# rm.done();
|
||||
//# // Java 5 automatically converts the int type of the store variable
|
||||
//# // to an Integer object.
|
||||
//# rm.setData(store);
|
||||
//# rm.done();
|
||||
//#endif
|
||||
}
|
||||
|
||||
static void printArray(int[] array, int left, int right, int pivot) {
|
||||
StringBuilder buffer = new StringBuilder();
|
||||
for (int i = 0; i < array.length; i++ ) {
|
||||
for (int i = 0; i < array.length; i++) {
|
||||
if (i == left) {
|
||||
buffer.append('>');
|
||||
} else if (i == pivot) {
|
||||
|
|
|
@ -462,8 +462,7 @@ abstract public class FormattedValueTests extends TestCase
|
|||
ArrayList<ElementFormatSetting> elementFormats1 = new ArrayList<>(map1.values());
|
||||
HashMap<String, ElementFormatSetting> expMap1 = new HashMap<>();
|
||||
makeElementFormatSetting(fViewer, TreePath.EMPTY, format1, depth, 0, expMap1);
|
||||
ArrayList<ElementFormatSetting> expectElementFormats1 = new ArrayList<>(
|
||||
expMap1.values());
|
||||
ArrayList<ElementFormatSetting> expectElementFormats1 = new ArrayList<>(expMap1.values());
|
||||
vmListenerLevel = depth;
|
||||
setFormatAndValidate(preferenceFormat, elementFormats1, expectElementFormats1, true, false, false);
|
||||
|
||||
|
@ -474,8 +473,7 @@ abstract public class FormattedValueTests extends TestCase
|
|||
ArrayList<ElementFormatSetting> elementFormats2 = new ArrayList<>(map2.values());
|
||||
HashMap<String, ElementFormatSetting> expMap2 = new HashMap<>();
|
||||
makeElementFormatSetting(fViewer, TreePath.EMPTY, format2, depth, 0, expMap2);
|
||||
ArrayList<ElementFormatSetting> expectElementFormats2 = new ArrayList<>(
|
||||
expMap2.values());
|
||||
ArrayList<ElementFormatSetting> expectElementFormats2 = new ArrayList<>(expMap2.values());
|
||||
setFormatAndValidate(preferenceFormat, elementFormats2, expectElementFormats2, true, true, false);
|
||||
|
||||
// Generate an event which will cause all cache entries to be marked dirty.
|
||||
|
@ -491,8 +489,7 @@ abstract public class FormattedValueTests extends TestCase
|
|||
ArrayList<ElementFormatSetting> elementFormats3 = new ArrayList<>(map3.values());
|
||||
HashMap<String, ElementFormatSetting> expMap3 = new HashMap<>();
|
||||
makeElementFormatSetting(fViewer, TreePath.EMPTY, format3, depth, 0, expMap3);
|
||||
ArrayList<ElementFormatSetting> expectElementFormats3 = new ArrayList<>(
|
||||
expMap3.values());
|
||||
ArrayList<ElementFormatSetting> expectElementFormats3 = new ArrayList<>(expMap3.values());
|
||||
setFormatAndValidate(preferenceFormat, elementFormats3, expectElementFormats3, true, true, true);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -476,8 +476,7 @@ public class GoToAddressBarWidget {
|
|||
String id = UNKNOWN_CONTEXT_ID;
|
||||
if (context instanceof IAdaptable) {
|
||||
IAdaptable adaptable = (IAdaptable) context;
|
||||
IRecurringDebugContext recurringDebugContext = adaptable
|
||||
.getAdapter(IRecurringDebugContext.class);
|
||||
IRecurringDebugContext recurringDebugContext = adaptable.getAdapter(IRecurringDebugContext.class);
|
||||
if (recurringDebugContext != null) {
|
||||
try {
|
||||
id = recurringDebugContext.getContextID();
|
||||
|
|
|
@ -660,7 +660,6 @@ public class MemoryBrowser extends ViewPart
|
|||
|
||||
label += ' ' + renderingType;
|
||||
|
||||
|
||||
// Allow the memory block to customize the label. The platform's
|
||||
// Memory view support this (it was done in the call to
|
||||
// rendering.getLabel() above)
|
||||
|
@ -1412,8 +1411,7 @@ public class MemoryBrowser extends ViewPart
|
|||
if (retrieval instanceof IMemoryBlockRetrievalExtension) {
|
||||
retrievalExtension = (IMemoryBlockRetrievalExtension) retrieval;
|
||||
} else if (retrieval instanceof IAdaptable) {
|
||||
retrievalExtension = ((IAdaptable) retrieval)
|
||||
.getAdapter(IMemoryBlockRetrievalExtension.class);
|
||||
retrievalExtension = ((IAdaptable) retrieval).getAdapter(IMemoryBlockRetrievalExtension.class);
|
||||
}
|
||||
if (retrievalExtension != null) {
|
||||
if (retrievalExtension instanceof IMemorySpaceAwareMemoryBlockRetrieval) {
|
||||
|
|
|
@ -42,10 +42,8 @@ public final class QMakeEnvInfo {
|
|||
Collection<IFile> sensitiveFiles) {
|
||||
this.proFile = proFile;
|
||||
this.qmakeFilePath = qmakeFilePath;
|
||||
this.environment = environment != null ? new HashMap<>(environment)
|
||||
: Collections.<String, String>emptyMap();
|
||||
this.sensitiveFiles = sensitiveFiles != null ? new HashSet<>(sensitiveFiles)
|
||||
: Collections.<IFile>emptySet();
|
||||
this.environment = environment != null ? new HashMap<>(environment) : Collections.<String, String>emptyMap();
|
||||
this.sensitiveFiles = sensitiveFiles != null ? new HashSet<>(sensitiveFiles) : Collections.<IFile>emptySet();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -61,8 +61,7 @@ public final class QMakeInfo implements IQMakeInfo {
|
|||
this.qtVersion = QMakeVersion.create(queryMap.get(QMakeParser.KEY_QT_VERSION));
|
||||
List<String> tmpQtImportPaths = new ArrayList<>(
|
||||
QMakeParser.singleValue(queryMap, QMakeParser.KEY_QT_INSTALL_IMPORTS));
|
||||
List<String> tmpQtQmlPaths = new ArrayList<>(
|
||||
QMakeParser.singleValue(queryMap, QMakeParser.KEY_QT_INSTALL_QML));
|
||||
List<String> tmpQtQmlPaths = new ArrayList<>(QMakeParser.singleValue(queryMap, QMakeParser.KEY_QT_INSTALL_QML));
|
||||
this.qtDocPath = QMakeParser.singleValue(queryMap, QMakeParser.KEY_QT_INSTALL_DOCS);
|
||||
|
||||
this.involvedQMakeFiles = QMakeParser.qmake3DecodeValueList(proMap,
|
||||
|
|
|
@ -76,8 +76,7 @@ public class QtPDOMQObject extends AbstractQtPDOMClass {
|
|||
|
||||
// Store the array into the Database.
|
||||
long arrayRec = getDB().getRecPtr(Field.ClassInfos.getRecord(record));
|
||||
QtPDOMArray<ClassInfo> pdomArray = new QtPDOMArray<>(getQtLinkage(), ClassInfo.Codec,
|
||||
arrayRec);
|
||||
QtPDOMArray<ClassInfo> pdomArray = new QtPDOMArray<>(getQtLinkage(), ClassInfo.Codec, arrayRec);
|
||||
arrayRec = pdomArray.set(array);
|
||||
|
||||
// Update the record that is stored in the receiver's field.
|
||||
|
@ -89,8 +88,7 @@ public class QtPDOMQObject extends AbstractQtPDOMClass {
|
|||
|
||||
// Read the array from the Database and insert the elements into the Map that is to be returned.
|
||||
long arrayRec = getDB().getRecPtr(Field.ClassInfos.getRecord(record));
|
||||
QtPDOMArray<ClassInfo> pdomArray = new QtPDOMArray<>(getQtLinkage(), ClassInfo.Codec,
|
||||
arrayRec);
|
||||
QtPDOMArray<ClassInfo> pdomArray = new QtPDOMArray<>(getQtLinkage(), ClassInfo.Codec, arrayRec);
|
||||
|
||||
ClassInfo[] array = pdomArray.get();
|
||||
if (array == null)
|
||||
|
|
|
@ -72,8 +72,7 @@ public class TestingSession implements ITestingSession {
|
|||
* statistics without model scanning.
|
||||
*
|
||||
*/
|
||||
private Map<ITestItem.Status, Integer> statusCounters = new EnumMap<>(
|
||||
ITestItem.Status.class);
|
||||
private Map<ITestItem.Status, Integer> statusCounters = new EnumMap<>(ITestItem.Status.class);
|
||||
|
||||
/**
|
||||
* The flag stores whether the testing session contains errors at the
|
||||
|
|
Loading…
Add table
Reference in a new issue