Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUwe Stieber2013-10-14 14:04:40 +0000
committerUwe Stieber2013-10-14 14:04:40 +0000
commitc004140cb9055bf5893e0d420a7f640c14595b64 (patch)
treef1609cd193b34b9b31f67e1d59f0e5159e1ca94f
parentd5755657903e822a62625efe86a038f1d9313dbf (diff)
downloadorg.eclipse.tcf-c004140cb9055bf5893e0d420a7f640c14595b64.tar.gz
org.eclipse.tcf-c004140cb9055bf5893e0d420a7f640c14595b64.tar.xz
org.eclipse.tcf-c004140cb9055bf5893e0d420a7f640c14595b64.zip
Target Explorer: Fix FindBugs warnings
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/extensions/StepExecutor.java3
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/ChannelManager.java2
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/internal/services/PathMapService.java184
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/sections/AbstractContextSelectorSection.java8
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/file/FileSelectionControl.java2
5 files changed, 104 insertions, 95 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/extensions/StepExecutor.java b/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/extensions/StepExecutor.java
index 293c3e0db..63fda4d9d 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/extensions/StepExecutor.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/extensions/StepExecutor.java
@@ -91,6 +91,7 @@ public class StepExecutor implements IStepExecutor {
int ticksToUse = step.getTotalWork(context, data);
progress = ProgressHelper.getProgressMonitor(progress, ticksToUse);
+ Assert.isNotNull(progress);
ProgressHelper.beginTask(progress, step.getLabel(), ticksToUse);
// Create the handler (and the callback) for the current step
@@ -127,7 +128,7 @@ public class StepExecutor implements IStepExecutor {
return;
}
- if (callback.getStatus().matches(IStatus.CANCEL) || (progress != null && progress.isCanceled())) {
+ if (callback.getStatus().matches(IStatus.CANCEL) || progress.isCanceled()) {
throw new OperationCanceledException(callback.getStatus().getMessage());
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/ChannelManager.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/ChannelManager.java
index 9177301eb..a10717701 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/ChannelManager.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/ChannelManager.java
@@ -144,7 +144,7 @@ public final class ChannelManager extends PlatformObject implements IChannelMana
});
thread.start();
} else {
- done.doneOpenChannel(error, channel);
+ done.doneOpenChannel(null, channel);
}
}
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/internal/services/PathMapService.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/internal/services/PathMapService.java
index 3ce3dc023..6679182bb 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/internal/services/PathMapService.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/internal/services/PathMapService.java
@@ -64,40 +64,42 @@ public class PathMapService extends AbstractService implements IPathMapService {
PathMapRule[] rules = null;
List<PathMapRule> rulesList = new ArrayList<PathMapRule>();
- // Get the launch configuration for that peer model
- ILaunchConfiguration config = (ILaunchConfiguration) Platform.getAdapterManager().getAdapter(context, ILaunchConfiguration.class);
- if (config == null) {
- config = (ILaunchConfiguration) Platform.getAdapterManager().loadAdapter(context, "org.eclipse.debug.core.ILaunchConfiguration"); //$NON-NLS-1$
- }
+ try {
+ // Get the launch configuration for that peer model
+ ILaunchConfiguration config = (ILaunchConfiguration) Platform.getAdapterManager().getAdapter(context, ILaunchConfiguration.class);
+ if (config == null) {
+ config = (ILaunchConfiguration) Platform.getAdapterManager().loadAdapter(context, "org.eclipse.debug.core.ILaunchConfiguration"); //$NON-NLS-1$
+ }
- if (config != null) {
- try {
- String path_map_cfg = config.getAttribute(org.eclipse.tcf.internal.debug.launch.TCFLaunchDelegate.ATTR_PATH_MAP, ""); //$NON-NLS-1$
- rulesList.addAll(org.eclipse.tcf.internal.debug.launch.TCFLaunchDelegate.parsePathMapAttribute(path_map_cfg));
+ if (config != null) {
+ try {
+ String path_map_cfg = config.getAttribute(org.eclipse.tcf.internal.debug.launch.TCFLaunchDelegate.ATTR_PATH_MAP, ""); //$NON-NLS-1$
+ rulesList.addAll(org.eclipse.tcf.internal.debug.launch.TCFLaunchDelegate.parsePathMapAttribute(path_map_cfg));
- path_map_cfg = config.getAttribute(ILaunchConfiguration.ATTR_SOURCE_LOCATOR_MEMENTO, ""); //$NON-NLS-1$
- rulesList.addAll(org.eclipse.tcf.internal.debug.launch.TCFLaunchDelegate.parseSourceLocatorMemento(path_map_cfg));
- } catch (CoreException e) { /* ignored on purpose */ }
- }
+ path_map_cfg = config.getAttribute(ILaunchConfiguration.ATTR_SOURCE_LOCATOR_MEMENTO, ""); //$NON-NLS-1$
+ rulesList.addAll(org.eclipse.tcf.internal.debug.launch.TCFLaunchDelegate.parseSourceLocatorMemento(path_map_cfg));
+ } catch (CoreException e) { /* ignored on purpose */ }
+ }
- IPathMapGeneratorService generator = ServiceManager.getInstance().getService(context, IPathMapGeneratorService.class);
- if (generator != null) {
- PathMapRule[] generatedRules = generator.getPathMap(context);
- if (generatedRules != null && generatedRules.length > 0) {
- rulesList.addAll(Arrays.asList(generatedRules));
- }
- }
+ IPathMapGeneratorService generator = ServiceManager.getInstance().getService(context, IPathMapGeneratorService.class);
+ if (generator != null) {
+ PathMapRule[] generatedRules = generator.getPathMap(context);
+ if (generatedRules != null && generatedRules.length > 0) {
+ rulesList.addAll(Arrays.asList(generatedRules));
+ }
+ }
- if (!rulesList.isEmpty()) {
- int cnt = 0;
- String id = getClientID();
- for (PathMapRule r : rulesList) r.getProperties().put(IPathMap.PROP_ID, id + "/" + cnt++); //$NON-NLS-1$
- rules = rulesList.toArray(new PathMapRule[rulesList.size()]);
+ if (!rulesList.isEmpty()) {
+ int cnt = 0;
+ String id = getClientID();
+ for (PathMapRule r : rulesList) r.getProperties().put(IPathMap.PROP_ID, id + "/" + cnt++); //$NON-NLS-1$
+ rules = rulesList.toArray(new PathMapRule[rulesList.size()]);
+ }
+ } finally {
+ // Release the lock
+ lock.unlock();
}
- // Release the lock
- lock.unlock();
-
return rules;
}
@@ -117,49 +119,51 @@ public class PathMapService extends AbstractService implements IPathMapService {
PathMapRule rule = null;
List<PathMapRule> rulesList = new ArrayList<PathMapRule>();
- // Get the launch configuration for that peer model
- ILaunchConfigurationWorkingCopy config = (ILaunchConfigurationWorkingCopy) Platform.getAdapterManager().getAdapter(context, ILaunchConfigurationWorkingCopy.class);
- if (config == null) {
- config = (ILaunchConfigurationWorkingCopy) Platform.getAdapterManager().loadAdapter(context, "org.eclipse.debug.core.ILaunchConfigurationWorkingCopy"); //$NON-NLS-1$
- }
+ try {
+ // Get the launch configuration for that peer model
+ ILaunchConfigurationWorkingCopy config = (ILaunchConfigurationWorkingCopy) Platform.getAdapterManager().getAdapter(context, ILaunchConfigurationWorkingCopy.class);
+ if (config == null) {
+ config = (ILaunchConfigurationWorkingCopy) Platform.getAdapterManager().loadAdapter(context, "org.eclipse.debug.core.ILaunchConfigurationWorkingCopy"); //$NON-NLS-1$
+ }
- if (config != null) {
- populatePathMapRulesList(config, rulesList);
+ if (config != null) {
+ populatePathMapRulesList(config, rulesList);
- // Find an existing path map rule for the given source and destination
- for (PathMapRule candidate : rulesList) {
- if (source.equals(candidate.getSource()) && destination.equals(candidate.getDestination())) {
- rule = candidate;
- break;
+ // Find an existing path map rule for the given source and destination
+ for (PathMapRule candidate : rulesList) {
+ if (source.equals(candidate.getSource()) && destination.equals(candidate.getDestination())) {
+ rule = candidate;
+ break;
+ }
}
- }
- // If not matching path map rule exist, create a new one
- if (rule == null) {
- Map<String, Object> props = new LinkedHashMap<String, Object>();
- props.put(IPathMap.PROP_SOURCE, source);
- props.put(IPathMap.PROP_DESTINATION, destination);
- rule = new org.eclipse.tcf.internal.debug.launch.TCFLaunchDelegate.PathMapRule(props);
- rulesList.add(rule);
-
- // Update the launch configuration
- updateLaunchConfiguration(config, rulesList);
-
- // Apply the path map
- applyPathMap(context, new Callback() {
- @Override
- protected void internalDone(Object caller, IStatus status) {
- if (status != null && Platform.inDebugMode()) {
- Platform.getLog(CoreBundleActivator.getContext().getBundle()).log(status);
- }
- }
- });
+ // If not matching path map rule exist, create a new one
+ if (rule == null) {
+ Map<String, Object> props = new LinkedHashMap<String, Object>();
+ props.put(IPathMap.PROP_SOURCE, source);
+ props.put(IPathMap.PROP_DESTINATION, destination);
+ rule = new org.eclipse.tcf.internal.debug.launch.TCFLaunchDelegate.PathMapRule(props);
+ rulesList.add(rule);
+
+ // Update the launch configuration
+ updateLaunchConfiguration(config, rulesList);
+
+ // Apply the path map
+ applyPathMap(context, new Callback() {
+ @Override
+ protected void internalDone(Object caller, IStatus status) {
+ if (status != null && Platform.inDebugMode()) {
+ Platform.getLog(CoreBundleActivator.getContext().getBundle()).log(status);
+ }
+ }
+ });
+ }
}
+ } finally {
+ // Release the lock
+ lock.unlock();
}
- // Release the lock
- lock.unlock();
-
return rule;
}
@@ -177,34 +181,36 @@ public class PathMapService extends AbstractService implements IPathMapService {
List<PathMapRule> rulesList = new ArrayList<PathMapRule>();
- // Get the launch configuration for that peer model
- ILaunchConfigurationWorkingCopy config = (ILaunchConfigurationWorkingCopy) Platform.getAdapterManager().getAdapter(context, ILaunchConfigurationWorkingCopy.class);
- if (config == null) {
- config = (ILaunchConfigurationWorkingCopy) Platform.getAdapterManager().loadAdapter(context, "org.eclipse.debug.core.ILaunchConfigurationWorkingCopy"); //$NON-NLS-1$
- }
+ try {
+ // Get the launch configuration for that peer model
+ ILaunchConfigurationWorkingCopy config = (ILaunchConfigurationWorkingCopy) Platform.getAdapterManager().getAdapter(context, ILaunchConfigurationWorkingCopy.class);
+ if (config == null) {
+ config = (ILaunchConfigurationWorkingCopy) Platform.getAdapterManager().loadAdapter(context, "org.eclipse.debug.core.ILaunchConfigurationWorkingCopy"); //$NON-NLS-1$
+ }
- if (config != null) {
- populatePathMapRulesList(config, rulesList);
-
- // Remove the given rule from the list of present
- if (rulesList.remove(rule)) {
- // Update the launch configuration
- updateLaunchConfiguration(config, rulesList);
-
- // Apply the path map
- applyPathMap(context, new Callback() {
- @Override
- protected void internalDone(Object caller, IStatus status) {
- if (status != null && Platform.inDebugMode()) {
- Platform.getLog(CoreBundleActivator.getContext().getBundle()).log(status);
- }
- }
- });
+ if (config != null) {
+ populatePathMapRulesList(config, rulesList);
+
+ // Remove the given rule from the list of present
+ if (rulesList.remove(rule)) {
+ // Update the launch configuration
+ updateLaunchConfiguration(config, rulesList);
+
+ // Apply the path map
+ applyPathMap(context, new Callback() {
+ @Override
+ protected void internalDone(Object caller, IStatus status) {
+ if (status != null && Platform.inDebugMode()) {
+ Platform.getLog(CoreBundleActivator.getContext().getBundle()).log(status);
+ }
+ }
+ });
+ }
}
+ } finally {
+ // Release the lock
+ lock.unlock();
}
-
- // Release the lock
- lock.unlock();
}
/**
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/sections/AbstractContextSelectorSection.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/sections/AbstractContextSelectorSection.java
index 1d0c9ee31..a9ccb36a6 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/sections/AbstractContextSelectorSection.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/sections/AbstractContextSelectorSection.java
@@ -189,9 +189,11 @@ public abstract class AbstractContextSelectorSection extends org.eclipse.tcf.te.
String encoded = data.getStringProperty(getContextListDataKey());
IModelNode[] list = decode(encoded);
- selector.setCheckedModelContexts(list);
- if (selector != null && selector.getViewer() != null) {
- selector.getViewer().refresh();
+ if (selector != null) {
+ selector.setCheckedModelContexts(list);
+ if (selector.getViewer() != null) {
+ selector.getViewer().refresh();
+ }
}
// Mark the control update as completed now
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/file/FileSelectionControl.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/file/FileSelectionControl.java
index 2727f5d14..8235af924 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/file/FileSelectionControl.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/file/FileSelectionControl.java
@@ -140,7 +140,7 @@ public class FileSelectionControl extends BaseDialogSelectionControl {
}
String filterFileName = filePath.toFile().isDirectory() || !filePath.toFile().exists() ? null : filePath.lastSegment();
- if (!filterPath.isEmpty()) fileDialog.setFilterPath(filterPath.toString());
+ if (filterPath != null && !filterPath.isEmpty()) fileDialog.setFilterPath(filterPath.toString());
if (filterFileName != null) fileDialog.setFileName(filterFileName);
} else {
String filterPath = last_filter_path != null ? last_filter_path : doGetDefaultFilterPath();

Back to the top