Author: yradtsevich
Date: 2009-06-17 08:31:47 -0400 (Wed, 17 Jun 2009)
New Revision: 16011
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeEditorPart.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaEditor.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaPreview.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/messages/VpeUIMessages.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/messages/messages.properties
Log:
https://jira.jboss.org/jira/browse/JBIDE-4256
- org.eclipse.ui.internal.part.StatusPart has been used to show the VPE exceptions
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeEditorPart.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeEditorPart.java 2009-06-17
12:29:35 UTC (rev 16010)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeEditorPart.java 2009-06-17
12:31:47 UTC (rev 16011)
@@ -83,7 +83,6 @@
import org.jboss.tools.vpe.editor.mozilla.EditorLoadWindowListener;
import org.jboss.tools.vpe.editor.mozilla.MozillaEditor;
import org.jboss.tools.vpe.editor.mozilla.MozillaPreview;
-import org.jboss.tools.vpe.editor.util.Constants;
import org.jboss.tools.vpe.editor.xpl.CustomSashForm;
import org.jboss.tools.vpe.editor.xpl.EditorSettings;
import org.jboss.tools.vpe.editor.xpl.SashSetting;
@@ -860,21 +859,19 @@
} catch (PartInitException e) {
VpePlugin.reportProblem(e);
}
- if (visualEditor != null) {
- visualEditor.setEditorLoadWindowListener(new EditorLoadWindowListener() {
- public void load() {
- visualEditor.setEditorLoadWindowListener(null);
- visualEditor.setController(new VpeController(
- VpeEditorPart.this));
- selectionBar.setVpeController(visualEditor.getController());
- visualEditor.getController().setSelectionBarController(selectionBar);
- createShowSelectionBarMenuItem();
- visualEditor.getController().init(sourceEditor, visualEditor);
- }
+ visualEditor.setEditorLoadWindowListener(new EditorLoadWindowListener() {
+ public void load() {
+ visualEditor.setEditorLoadWindowListener(null);
+ visualEditor.setController(new VpeController(
+ VpeEditorPart.this));
+ selectionBar.setVpeController(visualEditor.getController());
+ visualEditor.getController().setSelectionBarController(selectionBar);
+ createShowSelectionBarMenuItem();
+ visualEditor.getController().init(sourceEditor, visualEditor);
+ }
- });
- visualEditor.createPartControl(visualContent);
- }
+ });
+ visualEditor.createPartControl(visualContent);
}
/**
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaEditor.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaEditor.java 2009-06-17
12:29:35 UTC (rev 16010)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaEditor.java 2009-06-17
12:31:47 UTC (rev 16011)
@@ -16,6 +16,7 @@
import java.io.Writer;
import java.net.MalformedURLException;
import java.net.URL;
+import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -24,6 +25,8 @@
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.swt.SWT;
import org.eclipse.swt.browser.ProgressEvent;
@@ -44,7 +47,6 @@
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Link;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Menu;
@@ -59,6 +61,7 @@
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.browser.IWorkbenchBrowserSupport;
import org.eclipse.ui.editors.text.ILocationProvider;
+import org.eclipse.ui.internal.part.StatusPart;
import org.eclipse.ui.part.EditorPart;
import org.jboss.tools.common.model.XModelException;
import org.jboss.tools.jst.jsp.preferences.VpePreference;
@@ -78,7 +81,6 @@
import org.jboss.tools.vpe.messages.VpeUIMessages;
import org.jboss.tools.vpe.resref.VpeResourcesDialog;
import org.jboss.tools.vpe.xulrunner.XPCOM;
-import org.jboss.tools.vpe.xulrunner.XulRunnerException;
import org.jboss.tools.vpe.xulrunner.editor.XulRunnerEditor;
import org.mozilla.interfaces.nsIDOMDocument;
import org.mozilla.interfaces.nsIDOMElement;
@@ -159,6 +161,7 @@
}
public void init(IEditorSite site, IEditorInput input) throws PartInitException {
+ super.setSite(site);
super.setInput(input);
}
@@ -457,11 +460,9 @@
// }
xulRunnerEditor.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ } catch (Throwable t) {
+ showXulRunnerException(cmpEd, t);
}
- catch (XulRunnerException e) {
- layout.verticalSpacing = 10;
- showXulRunnerException(cmpEd, e);
- }
/*
*
https://jira.jboss.org/jira/browse/JBIDE-4062
@@ -518,22 +519,38 @@
}
/**
- * Logs given {@code exception} and shows error message in
+ * Logs given {@code throwable} and shows error message in
* the {@code parent} composite.
*/
protected void showXulRunnerException(Composite parent,
- XulRunnerException exception) {
- VpePlugin.getPluginLog().logError(
- VpeUIMessages.MOZILLA_LOADING_ERROR_LOG_ENTRY, exception);
+ Throwable throwable) {
+ String errorMessage = MessageFormat.format(
+ VpeUIMessages.MOZILLA_LOADING_ERROR, throwable.getMessage());
- Label title = new Label(parent, SWT.WRAP);
- title.setText(VpeUIMessages.MOZILLA_LOADING_ERROR);
- title.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ VpePlugin.getPluginLog().logError(errorMessage, throwable);
+ parent.setLayout(new GridLayout());
+ Composite statusComposite = new Composite(parent, SWT.NONE);
+ Color bgColor= parent.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND);
+ Color fgColor= parent.getDisplay().getSystemColor(SWT.COLOR_LIST_FOREGROUND);
+ parent.setBackground(bgColor);
+ parent.setForeground(fgColor);
+ GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
+ gridData.widthHint = 0;
+ gridData.heightHint = 0;
+ statusComposite.setLayoutData(gridData);
+
+ IStatus displayStatus = new Status(IStatus.ERROR,
+ VpePlugin.PLUGIN_ID, errorMessage, throwable);
+ new StatusPart(statusComposite, displayStatus);
+
final Link link = new Link(parent, SWT.WRAP);
+ link.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
+ link.setBackground(bgColor);
link.setText(VpeUIMessages.MOZILLA_LOADING_ERROR_LINK_TEXT);
link.setToolTipText(VpeUIMessages.MOZILLA_LOADING_ERROR_LINK);
link.setForeground(link.getDisplay().getSystemColor(SWT.COLOR_BLUE));
+
link.addMouseListener(new MouseListener() {
public void mouseDown(org.eclipse.swt.events.MouseEvent e) {
BusyIndicator.showWhile(link.getDisplay(), new Runnable() {
@@ -559,9 +576,6 @@
public void mouseUp(MouseEvent e) {
}
});
- link.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- Label fill = new Label(parent, SWT.WRAP);
- fill.setLayoutData(new GridData(GridData.FILL_BOTH));
}
private ToolItem createToolItem(ToolBar parent, int type, String image, String
disabledImage,
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaPreview.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaPreview.java 2009-06-17
12:29:35 UTC (rev 16010)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaPreview.java 2009-06-17
12:31:47 UTC (rev 16011)
@@ -24,7 +24,6 @@
import org.jboss.tools.vpe.editor.context.VpePageContext;
import org.jboss.tools.vpe.editor.mapping.VpeDomMapping;
import org.jboss.tools.vpe.editor.template.VpeTemplateManager;
-import org.jboss.tools.vpe.xulrunner.XulRunnerException;
import org.jboss.tools.vpe.xulrunner.editor.XulRunnerEditor;
/**
@@ -79,7 +78,7 @@
});
setInitialContent();
getXulRunnerEditor().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
- } catch (XulRunnerException e) {
+ } catch (Throwable e) {
showXulRunnerException(parent, e);
}
}
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/messages/VpeUIMessages.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/messages/VpeUIMessages.java 2009-06-17
12:29:35 UTC (rev 16010)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/messages/VpeUIMessages.java 2009-06-17
12:31:47 UTC (rev 16011)
@@ -31,7 +31,6 @@
public static String PAGE_DESIGN_OPTIONS;
public static String HIDE_SELECTION_BAR;
public static String SHOW_SELECTION_BAR;
- public static String MOZILLA_LOADING_ERROR_LOG_ENTRY;
public static String MOZILLA_LOADING_ERROR;
public static String MOZILLA_LOADING_ERROR_LINK_TEXT;
public static String MOZILLA_LOADING_ERROR_LINK;
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/messages/messages.properties
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/messages/messages.properties 2009-06-17
12:29:35 UTC (rev 16010)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/messages/messages.properties 2009-06-17
12:31:47 UTC (rev 16011)
@@ -8,10 +8,8 @@
PAGE_DESIGN_OPTIONS=Page Design Options
HIDE_SELECTION_BAR=Hide Selection Bar
SHOW_SELECTION_BAR=Show Selection Bar
-MOZILLA_LOADING_ERROR_LOG_ENTRY=Cannot run the Visual Page Editor
-MOZILLA_LOADING_ERROR=Cannot run the Visual Page Editor. See the Error Log view for the
stack trace of the error.\n\
- Probably your system environment needs to be slightly changed.
-MOZILLA_LOADING_ERROR_LINK_TEXT=Find out more.
+MOZILLA_LOADING_ERROR=Could not open the Visual Page Editor: {0}
+MOZILLA_LOADING_ERROR_LINK_TEXT=See JBoss Tools Visual Editor FAQ
# START NON-TRANSLATABLE
MOZILLA_LOADING_ERROR_LINK=http://www.jboss.org/community/docs/DOC-10862
# END NON-TRANSLATABLE