summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorViolaine Batthish2013-05-21 12:18:05 (EDT)
committer Chris Recoskie2013-05-21 12:25:21 (EDT)
commit2cc345eb459efdc6c210527fb221471be8647362 (patch)
tree7ade39f97748fac8a93ef5df9cb7889ce032d347
parent552d52d7570c35bf29403c91cb77650d08110f85 (diff)
downloadorg.eclipse.ptp-2cc345eb459efdc6c210527fb221471be8647362.zip
org.eclipse.ptp-2cc345eb459efdc6c210527fb221471be8647362.tar.gz
org.eclipse.ptp-2cc345eb459efdc6c210527fb221471be8647362.tar.bz2
Bug 407886 - Null pointer exception when the path specified for index
location is not a valid path
-rw-r--r--rdt/org.eclipse.ptp.rdt.ui/src/org/eclipse/ptp/rdt/ui/wizards/IndexFileLocationWidget.java29
1 files changed, 18 insertions, 11 deletions
diff --git a/rdt/org.eclipse.ptp.rdt.ui/src/org/eclipse/ptp/rdt/ui/wizards/IndexFileLocationWidget.java b/rdt/org.eclipse.ptp.rdt.ui/src/org/eclipse/ptp/rdt/ui/wizards/IndexFileLocationWidget.java
index 9d6138c..d0b9dfa 100644
--- a/rdt/org.eclipse.ptp.rdt.ui/src/org/eclipse/ptp/rdt/ui/wizards/IndexFileLocationWidget.java
+++ b/rdt/org.eclipse.ptp.rdt.ui/src/org/eclipse/ptp/rdt/ui/wizards/IndexFileLocationWidget.java
@@ -15,6 +15,7 @@ import java.util.Map;
import org.eclipse.core.runtime.ListenerList;
import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.jface.dialogs.IMessageProvider;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.preference.PreferenceDialog;
import org.eclipse.ptp.internal.rdt.ui.RSEUtils;
@@ -172,27 +173,33 @@ public class IndexFileLocationWidget extends Composite {
private void restoreDefault() {
text.setText(RSEUtils.getDefaultConfigDirectory(host));
+ validateIndexLoc();
}
private void validateIndexLoc() {
String path = text.getText();
IRemoteFileSubSystem remoteFileSubSystem = RemoteFileUtility.getFileSubSystem(host);
+ // display the message in the property dialog if possible
+ Composite parent = text.getParent();
+ PreferenceDialog dialog = null;
+ while (parent!=null && !(parent instanceof Shell))
+ parent=parent.getParent();
+ if (parent instanceof Shell) {
+ if (parent.getData() instanceof PreferenceDialog) {
+ dialog = (PreferenceDialog)parent.getData();
+ dialog.setMessage(null, IMessageProvider.NONE);
+ }
+ }
+
try {
IRemoteFile currentRemoteFolder =
remoteFileSubSystem.getRemoteFileObject(path, new NullProgressMonitor());
- if (!currentRemoteFolder.canWrite()){
- // display the message in the property dialog if possible
- Composite parent = text.getParent();
- while (parent!=null && !(parent instanceof Shell))
- parent=parent.getParent();
- if (parent instanceof Shell) {
- if (parent.getData() instanceof PreferenceDialog) {
- PreferenceDialog dialog = (PreferenceDialog)parent.getData();
- dialog.setErrorMessage(Messages.getString("InvalidIndexLocationLabel")); //$NON-NLS-1$
- }
- } else
+ if (currentRemoteFolder == null || !currentRemoteFolder.canWrite()){
+ if (dialog!=null)
+ dialog.setMessage(Messages.getString("InvalidIndexLocationLabel"), IMessageProvider.ERROR); //$NON-NLS-1$
+ else
// just display a dialog
MessageDialog.openWarning(getShell(),
Messages.getString("InvalidIndexLocationTitle"), Messages.getString("InvalidIndexLocationLabel")); //$NON-NLS-1$ //$NON-NLS-2$