Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUwe Stieber2012-05-25 07:29:15 -0400
committerUwe Stieber2012-05-25 07:29:15 -0400
commit274931fab9aab122ea534f9760179522c2aa48f6 (patch)
tree1ab4cc8d508356318223f047e49bfa7d4aa230a2
parent80f618c3a7dde6d24a4ccc05de8b095a06d0fa9e (diff)
downloadorg.eclipse.tcf-274931fab9aab122ea534f9760179522c2aa48f6.tar.gz
org.eclipse.tcf-274931fab9aab122ea534f9760179522c2aa48f6.tar.xz
org.eclipse.tcf-274931fab9aab122ea534f9760179522c2aa48f6.zip
Target Explorer: More findbugs fixes
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/internal/properties/FileTransferPropertiesSection.java2
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/internal/properties/LaunchConfigTypePropertiesSection.java2
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/internal/properties/LaunchContextPropertiesSection.java2
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/internal/properties/RefProjectsPropertiesSection.java2
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/model/LaunchModel.java15
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/selection/LaunchSelectionManager.java6
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/tabs/filetransfers/AbstractFileTransferSection.java24
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/tabs/refprojects/RefProjectsSection.java22
8 files changed, 41 insertions, 34 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/internal/properties/FileTransferPropertiesSection.java b/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/internal/properties/FileTransferPropertiesSection.java
index 58ce13632..88e90afd8 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/internal/properties/FileTransferPropertiesSection.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/internal/properties/FileTransferPropertiesSection.java
@@ -134,7 +134,7 @@ public class FileTransferPropertiesSection extends BaseTitledSection {
*/
@Override
public void refresh() {
- viewer.setInput(items);
+ if (viewer != null) viewer.setInput(items);
}
/* (non-Javadoc)
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/internal/properties/LaunchConfigTypePropertiesSection.java b/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/internal/properties/LaunchConfigTypePropertiesSection.java
index 72624b51b..46047a538 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/internal/properties/LaunchConfigTypePropertiesSection.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/internal/properties/LaunchConfigTypePropertiesSection.java
@@ -61,7 +61,7 @@ public class LaunchConfigTypePropertiesSection extends BaseTitledSection {
*/
@Override
public void refresh() {
- name.setText(nameValue);
+ if (name != null) name.setText(nameValue);
}
/* (non-Javadoc)
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/internal/properties/LaunchContextPropertiesSection.java b/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/internal/properties/LaunchContextPropertiesSection.java
index 9841f6f18..ec90e02d9 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/internal/properties/LaunchContextPropertiesSection.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/internal/properties/LaunchContextPropertiesSection.java
@@ -78,7 +78,7 @@ public class LaunchContextPropertiesSection extends BaseTitledSection {
*/
@Override
public void refresh() {
- launchContext.setText(launchContextValue);
+ if (launchContext != null) launchContext.setText(launchContextValue);
}
/* (non-Javadoc)
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/internal/properties/RefProjectsPropertiesSection.java b/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/internal/properties/RefProjectsPropertiesSection.java
index 7cd85ef09..5c0c07dad 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/internal/properties/RefProjectsPropertiesSection.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/internal/properties/RefProjectsPropertiesSection.java
@@ -119,7 +119,7 @@ public class RefProjectsPropertiesSection extends BaseTitledSection {
*/
@Override
public void refresh() {
- viewer.setInput(items);
+ if (viewer != null) viewer.setInput(items);
}
/* (non-Javadoc)
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/model/LaunchModel.java b/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/model/LaunchModel.java
index d5ec186cc..c3e1bd789 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/model/LaunchModel.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/model/LaunchModel.java
@@ -140,13 +140,14 @@ public final class LaunchModel implements IEventListener, ILaunchConfigurationLi
*/
@Override
public void eventFired(EventObject event) {
- Assert.isTrue(event instanceof ChangeEvent);
- ChangeEvent e = (ChangeEvent)event;
- if (e.getSource() instanceof ICategory &&
- ((e.getNewValue() instanceof String && ((String)e.getNewValue()).startsWith(LaunchNode.class.getName())) ||
- (e.getOldValue() instanceof String && ((String)e.getOldValue()).startsWith(LaunchNode.class.getName())))) {
- if (refresh()) {
- EventManager.getInstance().fireEvent(new ChangeEvent(this, ((ChangeEvent)event).getEventId(), null, null));
+ if (event instanceof ChangeEvent) {
+ ChangeEvent e = (ChangeEvent)event;
+ if (e.getSource() instanceof ICategory &&
+ ((e.getNewValue() instanceof String && ((String)e.getNewValue()).startsWith(LaunchNode.class.getName())) ||
+ (e.getOldValue() instanceof String && ((String)e.getOldValue()).startsWith(LaunchNode.class.getName())))) {
+ if (refresh()) {
+ EventManager.getInstance().fireEvent(new ChangeEvent(this, ((ChangeEvent)event).getEventId(), null, null));
+ }
}
}
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/selection/LaunchSelectionManager.java b/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/selection/LaunchSelectionManager.java
index 3e824cb48..44b768534 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/selection/LaunchSelectionManager.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/selection/LaunchSelectionManager.java
@@ -16,6 +16,7 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
+import java.util.Map.Entry;
import java.util.Set;
import org.eclipse.cdt.utils.elf.Elf.Attribute;
@@ -126,8 +127,9 @@ public class LaunchSelectionManager {
if (PART_ID_TE_VIEW.equalsIgnoreCase(partId)) {
// Get the selected remote contexts
Map<IModelNode, Set<IModelNode>> remoteCtxSelections = getRemoteCtxSelections(getPartSelection(PART_ID_TE_VIEW));
- for (IModelNode remoteCtx : remoteCtxSelections.keySet()) {
- contexts.add(new RemoteSelectionContext(remoteCtx, remoteCtxSelections.get(remoteCtx).toArray(), preferedPart));
+
+ for (Entry<IModelNode, Set<IModelNode>> remoteCtx : remoteCtxSelections.entrySet()) {
+ contexts.add(new RemoteSelectionContext(remoteCtx.getKey(), remoteCtx.getValue().toArray(), preferedPart));
}
}
else if (PART_ID_PROJECT_VIEW.equalsIgnoreCase(partId)) {
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/tabs/filetransfers/AbstractFileTransferSection.java b/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/tabs/filetransfers/AbstractFileTransferSection.java
index 2a351f646..c064a9a36 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/tabs/filetransfers/AbstractFileTransferSection.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/tabs/filetransfers/AbstractFileTransferSection.java
@@ -155,17 +155,19 @@ public abstract class AbstractFileTransferSection extends AbstractTableSection i
final Table table = viewer.getTable();
- ((CheckboxTableViewer)viewer).setCheckStateProvider(new FileTransferCheckStateProvider());
- ((CheckboxTableViewer)viewer).addCheckStateListener(new ICheckStateListener() {
- @Override
- public void checkStateChanged(CheckStateChangedEvent event) {
- if (event.getElement() instanceof IFileTransferItem) {
- IFileTransferItem item = (IFileTransferItem)event.getElement();
- item.setProperty(IFileTransferItem.PROPERTY_ENABLED, event.getChecked());
- getManagedForm().dirtyStateChanged();
+ if (viewer instanceof CheckboxTableViewer) {
+ ((CheckboxTableViewer)viewer).setCheckStateProvider(new FileTransferCheckStateProvider());
+ ((CheckboxTableViewer)viewer).addCheckStateListener(new ICheckStateListener() {
+ @Override
+ public void checkStateChanged(CheckStateChangedEvent event) {
+ if (event.getElement() instanceof IFileTransferItem) {
+ IFileTransferItem item = (IFileTransferItem)event.getElement();
+ item.setProperty(IFileTransferItem.PROPERTY_ENABLED, event.getChecked());
+ getManagedForm().dirtyStateChanged();
+ }
}
- }
- });
+ });
+ }
TableViewerColumn tvEnableCol = new TableViewerColumn(viewer, SWT.NONE);
final TableColumn colEnable = tvEnableCol.getColumn();
@@ -256,7 +258,7 @@ public abstract class AbstractFileTransferSection extends AbstractTableSection i
protected Object getValue(Object element) {
if (element instanceof IFileTransferItem) {
IFileTransferItem item = (IFileTransferItem)element;
- return new Boolean(item.getIntProperty(IFileTransferItem.PROPERTY_DIRECTION) != IFileTransferItem.TARGET_TO_HOST);
+ return Boolean.valueOf(item.getIntProperty(IFileTransferItem.PROPERTY_DIRECTION) != IFileTransferItem.TARGET_TO_HOST);
}
return null;
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/tabs/refprojects/RefProjectsSection.java b/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/tabs/refprojects/RefProjectsSection.java
index d3e62ceaf..96f793da6 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/tabs/refprojects/RefProjectsSection.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/tabs/refprojects/RefProjectsSection.java
@@ -167,17 +167,19 @@ public class RefProjectsSection extends AbstractTableSection implements ILaunchC
final Table table = viewer.getTable();
- ((CheckboxTableViewer)viewer).setCheckStateProvider(new RefProjectsCheckStateProvider());
- ((CheckboxTableViewer)viewer).addCheckStateListener(new ICheckStateListener() {
- @Override
- public void checkStateChanged(CheckStateChangedEvent event) {
- if (event.getElement() instanceof IReferencedProjectItem) {
- IReferencedProjectItem item = (IReferencedProjectItem)event.getElement();
- item.setProperty(IReferencedProjectItem.PROPERTY_ENABLED, event.getChecked());
- getManagedForm().dirtyStateChanged();
+ if (viewer instanceof CheckboxTableViewer) {
+ ((CheckboxTableViewer)viewer).setCheckStateProvider(new RefProjectsCheckStateProvider());
+ ((CheckboxTableViewer)viewer).addCheckStateListener(new ICheckStateListener() {
+ @Override
+ public void checkStateChanged(CheckStateChangedEvent event) {
+ if (event.getElement() instanceof IReferencedProjectItem) {
+ IReferencedProjectItem item = (IReferencedProjectItem)event.getElement();
+ item.setProperty(IReferencedProjectItem.PROPERTY_ENABLED, event.getChecked());
+ getManagedForm().dirtyStateChanged();
+ }
}
- }
- });
+ });
+ }
TableViewerColumn tvEnableCol = new TableViewerColumn(viewer, SWT.NONE);
final TableColumn colEnable = tvEnableCol.getColumn();

Back to the top