Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 82778 Details for
Bug 185838
[Parts] CoreExceptions are thrown as PartInitExceptions by TextFileDocumentProvider
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Improved error handling with nicer look
patch.txt (text/plain), 11.90 KB, created by
Dani Megert
on 2007-11-13 11:31:05 EST
(
hide
)
Description:
Improved error handling with nicer look
Filename:
MIME Type:
Creator:
Dani Megert
Created:
2007-11-13 11:31:05 EST
Size:
11.90 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.ui.workbench >Index: Eclipse UI/org/eclipse/ui/internal/part/NullEditorInput.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/part/NullEditorInput.java,v >retrieving revision 1.3 >diff -u -r1.3 NullEditorInput.java >--- Eclipse UI/org/eclipse/ui/internal/part/NullEditorInput.java 8 May 2006 20:55:46 -0000 1.3 >+++ Eclipse UI/org/eclipse/ui/internal/part/NullEditorInput.java 13 Nov 2007 16:30:22 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2004, 2006 IBM Corporation and others. >+ * Copyright (c) 2004, 2007 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -10,15 +10,40 @@ > *******************************************************************************/ > package org.eclipse.ui.internal.part; > >+import org.eclipse.core.runtime.Assert; >+ > import org.eclipse.jface.resource.ImageDescriptor; >+ > import org.eclipse.ui.IEditorInput; > import org.eclipse.ui.IPersistableElement; >+import org.eclipse.ui.internal.EditorReference; > > /** > * @since 3.1 > */ > public class NullEditorInput implements IEditorInput { > >+ private EditorReference editorReference; >+ >+ /** >+ * Creates a <code>NullEditorInput</code>. >+ */ >+ public NullEditorInput() { >+ } >+ >+ /** >+ * Creates a <code>NullEditorInput</code> for the >+ * given editor reference. >+ * >+ * @param editorReference the editor reference >+ * @since 3.4 >+ */ >+ public NullEditorInput(EditorReference editorReference) { >+ Assert.isLegal(editorReference != null); >+ this.editorReference= editorReference; >+ >+ } >+ > /* (non-Javadoc) > * @see org.eclipse.ui.IEditorInput#exists() > */ >@@ -37,6 +62,8 @@ > * @see org.eclipse.ui.IEditorInput#getName() > */ > public String getName() { >+ if (editorReference != null) >+ return editorReference.getName(); > return ""; //$NON-NLS-1$ > } > >@@ -51,6 +78,8 @@ > * @see org.eclipse.ui.IEditorInput#getToolTipText() > */ > public String getToolTipText() { >+ if (editorReference != null) >+ return editorReference.getTitleToolTip(); > return ""; //$NON-NLS-1$ > } > >Index: Eclipse UI/org/eclipse/ui/internal/part/StatusPart.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/part/StatusPart.java,v >retrieving revision 1.4 >diff -u -r1.4 StatusPart.java >--- Eclipse UI/org/eclipse/ui/internal/part/StatusPart.java 22 May 2007 19:22:05 -0000 1.4 >+++ Eclipse UI/org/eclipse/ui/internal/part/StatusPart.java 13 Nov 2007 16:30:22 -0000 >@@ -13,11 +13,10 @@ > import java.io.PrintWriter; > import java.io.StringWriter; > >-import org.eclipse.core.runtime.IStatus; >-import org.eclipse.jface.dialogs.IDialogConstants; > import org.eclipse.swt.SWT; > import org.eclipse.swt.events.SelectionAdapter; > import org.eclipse.swt.events.SelectionEvent; >+import org.eclipse.swt.graphics.Color; > import org.eclipse.swt.graphics.Image; > import org.eclipse.swt.layout.FillLayout; > import org.eclipse.swt.layout.GridData; >@@ -29,6 +28,10 @@ > import org.eclipse.swt.widgets.Label; > import org.eclipse.swt.widgets.Text; > >+import org.eclipse.core.runtime.IStatus; >+ >+import org.eclipse.jface.dialogs.IDialogConstants; >+ > /** > * @since 3.1 > */ >@@ -41,6 +44,12 @@ > private IStatus reason; > > public StatusPart(final Composite parent, IStatus reason_) { >+ Color bgColor= parent.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND); >+ Color fgColor= parent.getDisplay().getSystemColor(SWT.COLOR_LIST_FOREGROUND); >+ >+ parent.setBackground(bgColor); >+ parent.setForeground(fgColor); >+ > this.reason = reason_; > GridLayout layout = new GridLayout(); > >@@ -57,9 +66,10 @@ > parent.setLayout(layout); > > Label imageLabel = new Label(parent, SWT.NONE); >+ imageLabel.setBackground(bgColor); > Image image = getImage(); > if (image != null) { >- image.setBackground(imageLabel.getBackground()); >+ image.setBackground(bgColor); > imageLabel.setImage(image); > imageLabel.setLayoutData(new GridData( > GridData.HORIZONTAL_ALIGN_CENTER >@@ -67,12 +77,12 @@ > } > > Text text = new Text(parent, SWT.MULTI | SWT.READ_ONLY | SWT.WRAP); >- text.setBackground(text.getDisplay().getSystemColor( >- SWT.COLOR_WIDGET_BACKGROUND)); >+ text.setBackground(bgColor); >+ text.setForeground(fgColor); > > //text.setForeground(JFaceColors.getErrorText(text.getDisplay())); >- text.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING)); >- text.setText(reason.getMessage()); >+ text.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); >+ text.setText(reason.getMessage()); > > detailsButton = new Button(parent, SWT.PUSH); > detailsButton.addSelectionListener(new SelectionAdapter() { >@@ -81,12 +91,14 @@ > } > }); > >- detailsButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.VERTICAL_ALIGN_BEGINNING)); >+ detailsButton.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false)); > detailsButton.setVisible(reason.getException() != null); > > updateDetailsText(); > > detailsArea = new Composite(parent, SWT.NONE); >+ detailsArea.setBackground(bgColor); >+ detailsArea.setForeground(fgColor); > GridData data = new GridData(GridData.FILL_BOTH); > data.horizontalSpan = 3; > data.verticalSpan = 1; >@@ -98,13 +110,13 @@ > /** > * Return the image for the upper-left corner of this part > * >- * @return >+ * @return the image > */ > private Image getImage() { > Display d = Display.getCurrent(); > > switch(reason.getSeverity()) { >- case IStatus.ERROR: >+ case IStatus.ERROR: > return d.getSystemImage(SWT.ICON_ERROR); > case IStatus.WARNING: > return d.getSystemImage(SWT.ICON_WARNING); >@@ -129,7 +141,7 @@ > > if (showingDetails) { > detailsButton.setText(IDialogConstants.HIDE_DETAILS_LABEL); >- Text detailsText = new Text(detailsArea, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL >+ Text detailsText = new Text(detailsArea, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL > | SWT.MULTI | SWT.READ_ONLY | SWT.LEFT_TO_RIGHT); > detailsText.setText(getDetails(reason)); > detailsText.setBackground(detailsText.getDisplay().getSystemColor( >Index: Eclipse UI/org/eclipse/ui/internal/EditorReference.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorReference.java,v >retrieving revision 1.32 >diff -u -r1.32 EditorReference.java >--- Eclipse UI/org/eclipse/ui/internal/EditorReference.java 13 Nov 2007 16:13:19 -0000 1.32 >+++ Eclipse UI/org/eclipse/ui/internal/EditorReference.java 13 Nov 2007 16:30:22 -0000 >@@ -440,12 +440,11 @@ > NLS.bind("Unable to create editor ID {0}: {1}", //$NON-NLS-1$ > getId(), originalStatus.getMessage())); > IStatus displayStatus = StatusUtil.newStatus(originalStatus, >- WorkbenchMessages.EditorManager_unableToCreateEditor); >+ NLS.bind(WorkbenchMessages.EditorManager_unableToCreateEditor, >+ originalStatus.getMessage())); > > // Pass the error to the status handling facility > StatusManager.getManager().handle(logStatus); >- StatusManager.getManager().handle(displayStatus, >- StatusManager.SHOW); > > ErrorEditorPart part = new ErrorEditorPart(displayStatus); > >@@ -453,7 +452,7 @@ > try { > input = getEditorInput(); > } catch (PartInitException e1) { >- input = new NullEditorInput(); >+ input = new NullEditorInput(this); > } > > EditorPane pane = (EditorPane)getPane(); >@@ -745,7 +744,7 @@ > try { > input = getEditorInput(); > } catch (PartInitException e1) { >- input = new NullEditorInput(); >+ input = new NullEditorInput(this); > } > > EditorPane pane = (EditorPane)getPane(); >@@ -787,4 +786,3 @@ > return part; > } > } >- >Index: Eclipse UI/org/eclipse/ui/internal/messages.properties >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/messages.properties,v >retrieving revision 1.363 >diff -u -r1.363 messages.properties >--- Eclipse UI/org/eclipse/ui/internal/messages.properties 2 Oct 2007 18:49:52 -0000 1.363 >+++ Eclipse UI/org/eclipse/ui/internal/messages.properties 13 Nov 2007 16:30:22 -0000 >@@ -506,7 +506,10 @@ > EditorManager_saveResourcesOptionallyMessage = The following resources have been modified, but are still open elsewhere with identical changes. Closing will not lose those changes. Select the &resources to save now anyway: > EditorManager_saveResourcesTitle = Save Resources > EditorManager_exceptionRestoringEditor = Internal error activating an Editor. >-EditorManager_unableToCreateEditor = Error opening the editor. >+ >+# The parameter {0} stands for the status message >+EditorManager_unableToCreateEditor = Could not open the editor: {0} >+ > EditorManager_systemEditorError = System editor can only open file base resources. > EditorManager_invalidDescriptor = Invalid editor descriptor, id={0}. > EditorManager_instantiationError = The editor class could not be instantiated. This usually indicates a missing no-arg constructor or that the editor's class name was mistyped in plugin.xml. >@@ -589,9 +592,13 @@ > > ViewLabel_unknown = Unknown > >-ViewFactory_initException = Error creating the view. >+# The parameter {0} stands for the status message >+ViewFactory_initException = Could not create the view: {0} > ViewFactory_siteException = View initialization failed: {0}. Site is incorrect. >+ >+# The parameter {0} stands for the view ID > ViewFactory_couldNotCreate = Could not create view: {0} >+ > ViewFactory_noMultiple = View does not allow multiple instances: {0} > ViewFactory_couldNotSave = Could not save view: {0} > >Index: Eclipse UI/org/eclipse/ui/internal/ViewReference.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ViewReference.java,v >retrieving revision 1.28 >diff -u -r1.28 ViewReference.java >--- Eclipse UI/org/eclipse/ui/internal/ViewReference.java 13 Nov 2007 16:18:12 -0000 1.28 >+++ Eclipse UI/org/eclipse/ui/internal/ViewReference.java 13 Nov 2007 16:30:22 -0000 >@@ -237,7 +237,7 @@ > if (exception != null) { > IStatus partStatus = exception.getStatus(); > IStatus displayStatus = StatusUtil.newStatus(partStatus, >- WorkbenchMessages.ViewFactory_initException); >+ NLS.bind(WorkbenchMessages.ViewFactory_initException, partStatus.getMessage())); > IStatus logStatus = StatusUtil > .newStatus( > partStatus, >@@ -247,8 +247,6 @@ > > // Pass the error to the status handling facility > StatusManager.getManager().handle(logStatus); >- StatusManager.getManager() >- .handle(displayStatus, StatusManager.SHOW); > > IViewDescriptor desc = factory.viewReg.find(getId()); > String label = getId();
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 185838
:
66765
|
67221
|
82777
| 82778