Author: yradtsevich
Date: 2012-04-01 06:44:22 -0400 (Sun, 01 Apr 2012)
New Revision: 39955
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim.eclipse/src/org/jboss/tools/vpe/browsersim/eclipse/callbacks/OpenFileCallback.java
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim.eclipse/src/org/jboss/tools/vpe/browsersim/eclipse/callbacks/ViewSourceCallback.java
Log:
https://issues.jboss.org/browse/JBIDE-11179 : BrowserSim - add a view source option
- added exceptions logging
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim.eclipse/src/org/jboss/tools/vpe/browsersim/eclipse/callbacks/OpenFileCallback.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim.eclipse/src/org/jboss/tools/vpe/browsersim/eclipse/callbacks/OpenFileCallback.java 2012-04-01
10:29:26 UTC (rev 39954)
+++
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim.eclipse/src/org/jboss/tools/vpe/browsersim/eclipse/callbacks/OpenFileCallback.java 2012-04-01
10:44:22 UTC (rev 39955)
@@ -11,6 +11,7 @@
package org.jboss.tools.vpe.browsersim.eclipse.callbacks;
import java.io.File;
+import java.io.FileNotFoundException;
import org.eclipse.core.filesystem.EFS;
import org.eclipse.core.filesystem.IFileStore;
@@ -20,6 +21,7 @@
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.ide.IDE;
+import org.jboss.tools.vpe.browsersim.eclipse.Activator;
import org.jboss.tools.vpe.browsersim.eclipse.util.BrowserSimLauncher;
import org.jboss.tools.vpe.browsersim.eclipse.util.TransparentReader;
@@ -49,7 +51,8 @@
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
- File fileToOpen = new File(lastString.substring(OPEN_FILE_COMMAND.length()));
+ String fileNameToOpen = lastString.substring(OPEN_FILE_COMMAND.length());
+ File fileToOpen = new File(fileNameToOpen);
if (fileToOpen.exists() && fileToOpen.isFile()) {
IFileStore fileStore = EFS.getLocalFileSystem().getStore(fileToOpen.toURI());
@@ -60,13 +63,15 @@
try {
IDE.openEditorOnFileStore(page, fileStore);
} catch (PartInitException e) {
- //TODO: put exception handler
+ Activator.logError(e.getMessage(), e);
}
} else {
- // TODO: log exception
+ Exception e = new Exception("Cannot obtain workbench page");
+ Activator.logError(e.getMessage(), e);
}
} else {
- //TODO: Do something if the file does not exist
+ FileNotFoundException e = new FileNotFoundException("Cannot open file: " +
fileNameToOpen);
+ Activator.logError(e.getMessage(), e);
}
}
});
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim.eclipse/src/org/jboss/tools/vpe/browsersim/eclipse/callbacks/ViewSourceCallback.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim.eclipse/src/org/jboss/tools/vpe/browsersim/eclipse/callbacks/ViewSourceCallback.java 2012-04-01
10:29:26 UTC (rev 39954)
+++
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim.eclipse/src/org/jboss/tools/vpe/browsersim/eclipse/callbacks/ViewSourceCallback.java 2012-04-01
10:44:22 UTC (rev 39955)
@@ -32,6 +32,7 @@
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.texteditor.ITextEditor;
import org.jboss.tools.jst.jsp.jspeditor.JSPMultiPageEditor;
+import org.jboss.tools.vpe.browsersim.eclipse.Activator;
import org.jboss.tools.vpe.browsersim.eclipse.util.BrowserSimLauncher;
import org.jboss.tools.vpe.browsersim.eclipse.util.TransparentReader;
@@ -128,10 +129,11 @@
editor.doSave(null); // reset resource-changed marker
}
} catch (PartInitException e) {
- // TODO: log exception
+ Activator.logError(e.getMessage(), e);
}
} else {
- // TODO: log exception
+ Exception e = new Exception("Cannot obtain workbench page");
+ Activator.logError(e.getMessage(), e);
}
}
}