Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 185838 | Differences between
and this patch

Collapse All | Expand All

(-)Eclipse UI/org/eclipse/ui/internal/part/NullEditorInput.java (-1 / +30 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2004, 2006 IBM Corporation and others.
2
 * Copyright (c) 2004, 2007 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 10-24 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.ui.internal.part;
11
package org.eclipse.ui.internal.part;
12
12
13
import org.eclipse.core.runtime.Assert;
14
13
import org.eclipse.jface.resource.ImageDescriptor;
15
import org.eclipse.jface.resource.ImageDescriptor;
16
14
import org.eclipse.ui.IEditorInput;
17
import org.eclipse.ui.IEditorInput;
15
import org.eclipse.ui.IPersistableElement;
18
import org.eclipse.ui.IPersistableElement;
19
import org.eclipse.ui.internal.EditorReference;
16
20
17
/**
21
/**
18
 * @since 3.1
22
 * @since 3.1
19
 */
23
 */
20
public class NullEditorInput implements IEditorInput {
24
public class NullEditorInput implements IEditorInput {
21
25
26
	private EditorReference editorReference;
27
28
	/**
29
	 * Creates a <code>NullEditorInput</code>.
30
	 */
31
	public NullEditorInput() {
32
	}
33
34
	/**
35
	 * Creates a <code>NullEditorInput</code> for the
36
	 * given editor reference.
37
	 * 
38
	 * @param editorReference the editor reference
39
	 * @since 3.4
40
	 */
41
	public NullEditorInput(EditorReference editorReference) {
42
		Assert.isLegal(editorReference != null);
43
		this.editorReference= editorReference;
44
45
	}
46
22
    /* (non-Javadoc)
47
    /* (non-Javadoc)
23
     * @see org.eclipse.ui.IEditorInput#exists()
48
     * @see org.eclipse.ui.IEditorInput#exists()
24
     */
49
     */
Lines 37-42 Link Here
37
     * @see org.eclipse.ui.IEditorInput#getName()
62
     * @see org.eclipse.ui.IEditorInput#getName()
38
     */
63
     */
39
    public String getName() {
64
    public String getName() {
65
		if (editorReference != null)
66
			return editorReference.getName();
40
        return ""; //$NON-NLS-1$
67
        return ""; //$NON-NLS-1$
41
    }
68
    }
42
69
Lines 51-56 Link Here
51
     * @see org.eclipse.ui.IEditorInput#getToolTipText()
78
     * @see org.eclipse.ui.IEditorInput#getToolTipText()
52
     */
79
     */
53
    public String getToolTipText() {
80
    public String getToolTipText() {
81
		if (editorReference != null)
82
			return editorReference.getTitleToolTip();
54
        return ""; //$NON-NLS-1$
83
        return ""; //$NON-NLS-1$
55
    }
84
    }
56
85
(-)Eclipse UI/org/eclipse/ui/internal/part/StatusPart.java (-11 / +23 lines)
Lines 13-23 Link Here
13
import java.io.PrintWriter;
13
import java.io.PrintWriter;
14
import java.io.StringWriter;
14
import java.io.StringWriter;
15
15
16
import org.eclipse.core.runtime.IStatus;
17
import org.eclipse.jface.dialogs.IDialogConstants;
18
import org.eclipse.swt.SWT;
16
import org.eclipse.swt.SWT;
19
import org.eclipse.swt.events.SelectionAdapter;
17
import org.eclipse.swt.events.SelectionAdapter;
20
import org.eclipse.swt.events.SelectionEvent;
18
import org.eclipse.swt.events.SelectionEvent;
19
import org.eclipse.swt.graphics.Color;
21
import org.eclipse.swt.graphics.Image;
20
import org.eclipse.swt.graphics.Image;
22
import org.eclipse.swt.layout.FillLayout;
21
import org.eclipse.swt.layout.FillLayout;
23
import org.eclipse.swt.layout.GridData;
22
import org.eclipse.swt.layout.GridData;
Lines 29-34 Link Here
29
import org.eclipse.swt.widgets.Label;
28
import org.eclipse.swt.widgets.Label;
30
import org.eclipse.swt.widgets.Text;
29
import org.eclipse.swt.widgets.Text;
31
30
31
import org.eclipse.core.runtime.IStatus;
32
33
import org.eclipse.jface.dialogs.IDialogConstants;
34
32
/**
35
/**
33
 * @since 3.1
36
 * @since 3.1
34
 */
37
 */
Lines 41-46 Link Here
41
    private IStatus reason;
44
    private IStatus reason;
42
    
45
    
43
    public StatusPart(final Composite parent, IStatus reason_) {
46
    public StatusPart(final Composite parent, IStatus reason_) {
47
    	Color bgColor= parent.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND);
48
		Color fgColor= parent.getDisplay().getSystemColor(SWT.COLOR_LIST_FOREGROUND);
49
    	
50
		parent.setBackground(bgColor);
51
		parent.setForeground(fgColor);
52
44
        this.reason = reason_;
53
        this.reason = reason_;
45
        GridLayout layout = new GridLayout();
54
        GridLayout layout = new GridLayout();
46
        
55
        
Lines 57-65 Link Here
57
        parent.setLayout(layout);
66
        parent.setLayout(layout);
58
        
67
        
59
        Label imageLabel = new Label(parent, SWT.NONE);
68
        Label imageLabel = new Label(parent, SWT.NONE);
69
        imageLabel.setBackground(bgColor);
60
        Image image = getImage();
70
        Image image = getImage();
61
        if (image != null) {
71
        if (image != null) {
62
            image.setBackground(imageLabel.getBackground());
72
            image.setBackground(bgColor);
63
            imageLabel.setImage(image);
73
            imageLabel.setImage(image);
64
            imageLabel.setLayoutData(new GridData(
74
            imageLabel.setLayoutData(new GridData(
65
                    GridData.HORIZONTAL_ALIGN_CENTER
75
                    GridData.HORIZONTAL_ALIGN_CENTER
Lines 67-78 Link Here
67
        }
77
        }
68
        
78
        
69
        Text text = new Text(parent, SWT.MULTI | SWT.READ_ONLY | SWT.WRAP);
79
        Text text = new Text(parent, SWT.MULTI | SWT.READ_ONLY | SWT.WRAP);
70
        text.setBackground(text.getDisplay().getSystemColor(
80
        text.setBackground(bgColor);
71
                SWT.COLOR_WIDGET_BACKGROUND));
81
        text.setForeground(fgColor);
72
82
73
        //text.setForeground(JFaceColors.getErrorText(text.getDisplay()));
83
        //text.setForeground(JFaceColors.getErrorText(text.getDisplay()));
74
        text.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING));
84
		text.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
75
        text.setText(reason.getMessage()); 
85
        text.setText(reason.getMessage());
76
        
86
        
77
        detailsButton = new Button(parent, SWT.PUSH);
87
        detailsButton = new Button(parent, SWT.PUSH);
78
        detailsButton.addSelectionListener(new SelectionAdapter() {
88
        detailsButton.addSelectionListener(new SelectionAdapter() {
Lines 81-92 Link Here
81
            }
91
            }
82
        });
92
        });
83
        
93
        
84
        detailsButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.VERTICAL_ALIGN_BEGINNING));
94
        detailsButton.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
85
        detailsButton.setVisible(reason.getException() != null);
95
        detailsButton.setVisible(reason.getException() != null);
86
        
96
        
87
        updateDetailsText();
97
        updateDetailsText();
88
        
98
        
89
        detailsArea = new Composite(parent, SWT.NONE);
99
        detailsArea = new Composite(parent, SWT.NONE);
100
        detailsArea.setBackground(bgColor);
101
        detailsArea.setForeground(fgColor);
90
        GridData data = new GridData(GridData.FILL_BOTH);
102
        GridData data = new GridData(GridData.FILL_BOTH);
91
        data.horizontalSpan = 3;
103
        data.horizontalSpan = 3;
92
        data.verticalSpan = 1;
104
        data.verticalSpan = 1;
Lines 98-110 Link Here
98
    /**
110
    /**
99
     * Return the image for the upper-left corner of this part
111
     * Return the image for the upper-left corner of this part
100
     *
112
     *
101
     * @return
113
     * @return the image
102
     */
114
     */
103
    private Image getImage() {
115
    private Image getImage() {
104
        Display d = Display.getCurrent();
116
        Display d = Display.getCurrent();
105
        
117
        
106
        switch(reason.getSeverity()) {
118
        switch(reason.getSeverity()) {
107
        case IStatus.ERROR: 
119
        case IStatus.ERROR:
108
            return d.getSystemImage(SWT.ICON_ERROR);
120
            return d.getSystemImage(SWT.ICON_ERROR);
109
        case IStatus.WARNING:
121
        case IStatus.WARNING:
110
            return d.getSystemImage(SWT.ICON_WARNING);
122
            return d.getSystemImage(SWT.ICON_WARNING);
Lines 129-135 Link Here
129
        
141
        
130
        if (showingDetails) {
142
        if (showingDetails) {
131
            detailsButton.setText(IDialogConstants.HIDE_DETAILS_LABEL);
143
            detailsButton.setText(IDialogConstants.HIDE_DETAILS_LABEL);
132
            Text detailsText = new Text(detailsArea, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL 
144
            Text detailsText = new Text(detailsArea, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL
133
                    | SWT.MULTI | SWT.READ_ONLY | SWT.LEFT_TO_RIGHT);
145
                    | SWT.MULTI | SWT.READ_ONLY | SWT.LEFT_TO_RIGHT);
134
            detailsText.setText(getDetails(reason));
146
            detailsText.setText(getDetails(reason));
135
            detailsText.setBackground(detailsText.getDisplay().getSystemColor(
147
            detailsText.setBackground(detailsText.getDisplay().getSystemColor(
(-)Eclipse UI/org/eclipse/ui/internal/EditorReference.java (-6 / +4 lines)
Lines 440-451 Link Here
440
                    NLS.bind("Unable to create editor ID {0}: {1}",  //$NON-NLS-1$
440
                    NLS.bind("Unable to create editor ID {0}: {1}",  //$NON-NLS-1$
441
                            getId(), originalStatus.getMessage()));
441
                            getId(), originalStatus.getMessage()));
442
            IStatus displayStatus = StatusUtil.newStatus(originalStatus,
442
            IStatus displayStatus = StatusUtil.newStatus(originalStatus,
443
					WorkbenchMessages.EditorManager_unableToCreateEditor);
443
            		NLS.bind(WorkbenchMessages.EditorManager_unableToCreateEditor,
444
            				originalStatus.getMessage()));
444
445
445
			// Pass the error to the status handling facility
446
			// Pass the error to the status handling facility
446
            StatusManager.getManager().handle(logStatus);
447
            StatusManager.getManager().handle(logStatus);
447
            StatusManager.getManager().handle(displayStatus,
448
						StatusManager.SHOW);
449
            
448
            
450
            ErrorEditorPart part = new ErrorEditorPart(displayStatus);
449
            ErrorEditorPart part = new ErrorEditorPart(displayStatus);
451
            
450
            
Lines 453-459 Link Here
453
            try {
452
            try {
454
                input = getEditorInput();
453
                input = getEditorInput();
455
            } catch (PartInitException e1) {
454
            } catch (PartInitException e1) {
456
                input = new NullEditorInput();
455
				input = new NullEditorInput(this);
457
            }
456
            }
458
            
457
            
459
            EditorPane pane = (EditorPane)getPane();
458
            EditorPane pane = (EditorPane)getPane();
Lines 745-751 Link Here
745
        try {
744
        try {
746
            input = getEditorInput();
745
            input = getEditorInput();
747
        } catch (PartInitException e1) {
746
        } catch (PartInitException e1) {
748
			input = new NullEditorInput();
747
			input = new NullEditorInput(this);
749
        }
748
        }
750
        
749
        
751
        EditorPane pane = (EditorPane)getPane();
750
        EditorPane pane = (EditorPane)getPane();
Lines 787-790 Link Here
787
        return part;
786
        return part;
788
	}
787
	}
789
}
788
}
790
(-)Eclipse UI/org/eclipse/ui/internal/messages.properties (-2 / +9 lines)
Lines 506-512 Link Here
506
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:
506
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:
507
EditorManager_saveResourcesTitle = Save Resources
507
EditorManager_saveResourcesTitle = Save Resources
508
EditorManager_exceptionRestoringEditor = Internal error activating an Editor.
508
EditorManager_exceptionRestoringEditor = Internal error activating an Editor.
509
EditorManager_unableToCreateEditor = Error opening the editor.
509
510
# The parameter {0} stands for the status message
511
EditorManager_unableToCreateEditor = Could not open the editor: {0}
512
510
EditorManager_systemEditorError = System editor can only open file base resources.
513
EditorManager_systemEditorError = System editor can only open file base resources.
511
EditorManager_invalidDescriptor = Invalid editor descriptor, id={0}.
514
EditorManager_invalidDescriptor = Invalid editor descriptor, id={0}.
512
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.
515
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.
Lines 589-597 Link Here
589
592
590
ViewLabel_unknown = Unknown
593
ViewLabel_unknown = Unknown
591
594
592
ViewFactory_initException = Error creating the view.
595
# The parameter {0} stands for the status message
596
ViewFactory_initException = Could not create the view: {0}
593
ViewFactory_siteException = View initialization failed: {0}.  Site is incorrect.
597
ViewFactory_siteException = View initialization failed: {0}.  Site is incorrect.
598
599
# The parameter {0} stands for the view ID 
594
ViewFactory_couldNotCreate = Could not create view: {0}
600
ViewFactory_couldNotCreate = Could not create view: {0}
601
595
ViewFactory_noMultiple = View does not allow multiple instances: {0}
602
ViewFactory_noMultiple = View does not allow multiple instances: {0}
596
ViewFactory_couldNotSave = Could not save view: {0}
603
ViewFactory_couldNotSave = Could not save view: {0}
597
604
(-)Eclipse UI/org/eclipse/ui/internal/ViewReference.java (-3 / +1 lines)
Lines 237-243 Link Here
237
		if (exception != null) {
237
		if (exception != null) {
238
			IStatus partStatus = exception.getStatus();
238
			IStatus partStatus = exception.getStatus();
239
			IStatus displayStatus = StatusUtil.newStatus(partStatus,
239
			IStatus displayStatus = StatusUtil.newStatus(partStatus,
240
					WorkbenchMessages.ViewFactory_initException);
240
					NLS.bind(WorkbenchMessages.ViewFactory_initException, partStatus.getMessage()));
241
			IStatus logStatus = StatusUtil
241
			IStatus logStatus = StatusUtil
242
					.newStatus(
242
					.newStatus(
243
							partStatus,
243
							partStatus,
Lines 247-254 Link Here
247
247
248
			// Pass the error to the status handling facility
248
			// Pass the error to the status handling facility
249
			StatusManager.getManager().handle(logStatus);
249
			StatusManager.getManager().handle(logStatus);
250
			StatusManager.getManager()
251
					.handle(displayStatus, StatusManager.SHOW);
252
250
253
			IViewDescriptor desc = factory.viewReg.find(getId());
251
			IViewDescriptor desc = factory.viewReg.find(getId());
254
			String label = getId();
252
			String label = getId();

Return to bug 185838