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 173040 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/ui/internal/views/log/messages.properties (+1 lines)
Lines 39-44 Link Here
39
LogView_operation_reloading = Reloading...
39
LogView_operation_reloading = Reloading...
40
LogView_activate = &Activate on new events
40
LogView_activate = &Activate on new events
41
LogView_AddingBatchedEvents=Adding batched log events...
41
LogView_AddingBatchedEvents=Adding batched log events...
42
LogView_Confirm_EarlyStart_Message=Do you want to activate view even if it's closed? Answering no view will be activated only if it's already visible.
42
LogView_view_currentLog = &Open Log
43
LogView_view_currentLog = &Open Log
43
LogView_view_currentLog_tooltip = Open Log
44
LogView_view_currentLog_tooltip = Open Log
44
LogView_properties_tooltip = Event Details
45
LogView_properties_tooltip = Event Details
(-)src/org/eclipse/ui/internal/views/log/Messages.java (+1 lines)
Lines 47-52 Link Here
47
	public static String LogView_operation_reloading;
47
	public static String LogView_operation_reloading;
48
	public static String LogView_activate;
48
	public static String LogView_activate;
49
	public static String LogView_AddingBatchedEvents;
49
	public static String LogView_AddingBatchedEvents;
50
	public static String LogView_Confirm_EarlyStart_Message;
50
	public static String LogView_view_currentLog;
51
	public static String LogView_view_currentLog;
51
	public static String LogView_view_currentLog_tooltip;
52
	public static String LogView_view_currentLog_tooltip;
52
	public static String LogView_properties_tooltip;
53
	public static String LogView_properties_tooltip;
(-)src/org/eclipse/ui/internal/views/log/LogView.java (+4 lines)
Lines 292-297 Link Here
292
		Action action = new Action(Messages.LogView_activate) { //       	
292
		Action action = new Action(Messages.LogView_activate) { //       	
293
			public void run() {
293
			public void run() {
294
				fMemento.putString(P_ACTIVATE, isChecked() ? "true" : "false"); //$NON-NLS-1$ //$NON-NLS-2$
294
				fMemento.putString(P_ACTIVATE, isChecked() ? "true" : "false"); //$NON-NLS-1$ //$NON-NLS-2$
295
				if (isChecked()) {
296
					boolean earlyStartEnabled = MessageDialog.openQuestion(getSite().getShell(), Messages.LogView_activate, Messages.LogView_Confirm_EarlyStart_Message);
297
					Activator.getDefault().getPreferenceStore().setValue(Activator.EARLY_START_ENABLED, earlyStartEnabled);
298
				}
295
			}
299
			}
296
		};
300
		};
297
		action.setChecked(fMemento.getString(P_ACTIVATE).equals("true")); //$NON-NLS-1$
301
		action.setChecked(fMemento.getString(P_ACTIVATE).equals("true")); //$NON-NLS-1$
(-)src/org/eclipse/ui/internal/views/log/Activator.java (-2 / +35 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2007 IBM Corporation and others.
2
 * Copyright (c) 2008 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 11-29 Link Here
11
 *******************************************************************************/
11
 *******************************************************************************/
12
package org.eclipse.ui.internal.views.log;
12
package org.eclipse.ui.internal.views.log;
13
13
14
import org.eclipse.core.runtime.*;
14
import org.eclipse.jface.resource.ImageDescriptor;
15
import org.eclipse.jface.resource.ImageDescriptor;
15
import org.eclipse.jface.resource.ImageRegistry;
16
import org.eclipse.jface.resource.ImageRegistry;
17
import org.eclipse.ui.*;
16
import org.eclipse.ui.plugin.AbstractUIPlugin;
18
import org.eclipse.ui.plugin.AbstractUIPlugin;
17
import org.osgi.framework.BundleContext;
19
import org.osgi.framework.BundleContext;
18
20
19
/**
21
/**
20
 * The activator class controls the plug-in life cycle
22
 * The activator class controls the plug-in life cycle
21
 */
23
 */
22
public class Activator extends AbstractUIPlugin {
24
public class Activator extends AbstractUIPlugin implements ILogListener {
23
25
24
	// The plug-in ID
26
	// The plug-in ID
25
	public static final String PLUGIN_ID = "org.eclipse.ui.views.log"; //$NON-NLS-1$
27
	public static final String PLUGIN_ID = "org.eclipse.ui.views.log"; //$NON-NLS-1$
26
28
29
	public static final String EARLY_START_ENABLED = "earlyStartEnabled"; //$NON-NLS-1$
30
31
	public static class Startup implements IStartup {
32
33
		public void earlyStartup() {
34
			// empty - all initialization is in Activator.start(BundleContext)
35
		}
36
37
	}
38
27
	// The shared instance
39
	// The shared instance
28
	private static Activator plugin;
40
	private static Activator plugin;
29
41
Lines 40-45 Link Here
40
	public void start(BundleContext context) throws Exception {
52
	public void start(BundleContext context) throws Exception {
41
		super.start(context);
53
		super.start(context);
42
		plugin = this;
54
		plugin = this;
55
		Platform.addLogListener(this);
43
	}
56
	}
44
57
45
	/*
58
	/*
Lines 49-54 Link Here
49
	public void stop(BundleContext context) throws Exception {
62
	public void stop(BundleContext context) throws Exception {
50
		plugin = null;
63
		plugin = null;
51
		super.stop(context);
64
		super.stop(context);
65
		Platform.removeLogListener(this);
52
	}
66
	}
53
67
54
	public static Activator getDefault() {
68
	public static Activator getDefault() {
Lines 88-91 Link Here
88
		return imageDescriptorFromPlugin(PLUGIN_ID, id);
102
		return imageDescriptorFromPlugin(PLUGIN_ID, id);
89
	}
103
	}
90
104
105
	public void logging(IStatus status, String plugin) {
106
		if (!getPluginPreferences().getBoolean(EARLY_START_ENABLED)) {
107
			return;
108
		}
109
110
		// initializes logview on first comming log entry
111
		final IWorkbench workbench = PlatformUI.getWorkbench();
112
		workbench.getDisplay().asyncExec(new Runnable() {
113
			public void run() {
114
				IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
115
				if (window != null) {
116
					try {
117
						window.getActivePage().showView("org.eclipse.pde.runtime.LogView"); //$NON-NLS-1$
118
					} catch (PartInitException e) { // empty
119
					}
120
				}
121
			}
122
		});
123
	}
91
}
124
}
(-)plugin.xml (+6 lines)
Lines 58-61 Link Here
58
            priority="high">
58
            priority="high">
59
      </content-type>
59
      </content-type>
60
   </extension>
60
   </extension>
61
   <extension
62
         point="org.eclipse.ui.startup">
63
         <startup
64
               class="org.eclipse.ui.internal.views.log.Activator$Startup">
65
         </startup>
66
   </extension>
61
</plugin>
67
</plugin>

Return to bug 173040