View | Details | Raw Unified | Return to bug 312677 | Differences between
and this patch

Collapse All | Expand All

(-)plugin.xml (-1 / +11 lines)
Lines 1-6 Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
1
<?xml version="1.0" encoding="UTF-8"?>
2
<?eclipse version="3.0"?><!--
2
<?eclipse version="3.0"?><!--
3
     Copyright (c) 2005, 2009 IBM Corporation and others.
3
     Copyright (c) 2005, 2010 IBM Corporation and others.
4
     All rights reserved. This program and the accompanying materials
4
     All rights reserved. This program and the accompanying materials
5
     are made available under the terms of the Eclipse Public License v1.0
5
     are made available under the terms of the Eclipse Public License v1.0
6
     which accompanies this distribution, and is available at
6
     which accompanies this distribution, and is available at
Lines 2087-2090 Link Here
2087
            label="%consoleFactory.label">
2087
            label="%consoleFactory.label">
2088
      </consoleFactory>
2088
      </consoleFactory>
2089
   </extension>
2089
   </extension>
2090
   <extension
2091
         point="org.eclipse.ui.console.consolePageParticipants">
2092
      <consolePageParticipant
2093
            class="org.eclipse.pde.internal.ui.util.OSGiConsolePageParticipant"
2094
            id="org.eclipse.pde.ui.OSGiConsoleParticipant">
2095
         <enablement>
2096
            <test property="org.eclipse.ui.console.consoleTypeTest" value="osgiConsole"/>
2097
         </enablement>
2098
      </consolePageParticipant>
2099
   </extension>
2090
</plugin>
2100
</plugin>
(-)src/org/eclipse/pde/internal/ui/util/OSGiConsole.java (-2 / +13 lines)
Lines 7-25 Link Here
7
 *
7
 *
8
 * Contributors:
8
 * Contributors:
9
 *     Chris Aniszczyk <caniszczyk@gmail.com> - initial API and implementation
9
 *     Chris Aniszczyk <caniszczyk@gmail.com> - initial API and implementation
10
 *     IBM Corporation - ongoing enhancements and bug fixing
10
 *******************************************************************************/
11
 *******************************************************************************/
11
package org.eclipse.pde.internal.ui.util;
12
package org.eclipse.pde.internal.ui.util;
12
13
13
import java.io.InputStream;
14
import java.io.*;
14
import java.io.OutputStream;
15
import org.eclipse.core.runtime.Platform;
15
import org.eclipse.core.runtime.Platform;
16
import org.eclipse.osgi.framework.console.ConsoleSession;
16
import org.eclipse.osgi.framework.console.ConsoleSession;
17
import org.eclipse.osgi.util.NLS;
17
import org.eclipse.osgi.util.NLS;
18
import org.eclipse.pde.internal.ui.PDEPlugin;
18
import org.eclipse.pde.internal.ui.PDEPlugin;
19
import org.eclipse.pde.internal.ui.PDEUIMessages;
19
import org.eclipse.pde.internal.ui.PDEUIMessages;
20
import org.eclipse.ui.console.IOConsole;
20
import org.eclipse.ui.console.IOConsole;
21
import org.eclipse.ui.console.IOConsoleOutputStream;
21
import org.osgi.framework.BundleContext;
22
import org.osgi.framework.BundleContext;
22
23
24
/**
25
 * OSGi console connected to the Host/Running Eclipse.
26
 * 
27
 * @since 3.6
28
 */
23
public class OSGiConsole extends IOConsole {
29
public class OSGiConsole extends IOConsole {
24
30
25
	public final static String TYPE = "osgiConsole"; //$NON-NLS-1$
31
	public final static String TYPE = "osgiConsole"; //$NON-NLS-1$
Lines 47-52 Link Here
47
		BundleContext context = PDEPlugin.getDefault().getBundle().getBundleContext();
53
		BundleContext context = PDEPlugin.getDefault().getBundle().getBundleContext();
48
		context.registerService(ConsoleSession.class.getName(), session, null);
54
		context.registerService(ConsoleSession.class.getName(), session, null);
49
		super.init();
55
		super.init();
56
		IOConsoleOutputStream info = newOutputStream(); // create a stream to write info message to
57
		try {
58
			info.write(PDEUIMessages.OSGiConsoleFactory_title);
59
		} catch (IOException e) {
60
		}
50
	}
61
	}
51
62
52
	protected void dispose() {
63
	protected void dispose() {
(-)src/org/eclipse/pde/internal/ui/util/OSGiConsoleFactory.java (-6 / +5 lines)
Lines 11-19 Link Here
11
 *******************************************************************************/
11
 *******************************************************************************/
12
package org.eclipse.pde.internal.ui.util;
12
package org.eclipse.pde.internal.ui.util;
13
13
14
import org.eclipse.pde.internal.ui.PDEUIMessages;
15
import org.eclipse.ui.console.*;
14
import org.eclipse.ui.console.*;
16
15
16
/**
17
 * Console factory extension used to create a "Host OSGi Console".
18
 * 
19
 * @since 3.6
20
 */
17
public class OSGiConsoleFactory implements IConsoleFactory {
21
public class OSGiConsoleFactory implements IConsoleFactory {
18
	private final IConsoleManager fConsoleManager;
22
	private final IConsoleManager fConsoleManager;
19
	private IOConsole fConsole = null;
23
	private IOConsole fConsole = null;
Lines 26-35 Link Here
26
	 * @see org.eclipse.ui.console.IConsoleFactory#openConsole()
30
	 * @see org.eclipse.ui.console.IConsoleFactory#openConsole()
27
	 */
31
	 */
28
	public void openConsole() {
32
	public void openConsole() {
29
		openConsole(PDEUIMessages.OSGiConsoleFactory_title);
30
	}
31
32
	public void openConsole(String initialText) {
33
		IOConsole console = getConsole();
33
		IOConsole console = getConsole();
34
34
35
		IConsole[] existing = fConsoleManager.getConsoles();
35
		IConsole[] existing = fConsoleManager.getConsoles();
Lines 41-47 Link Here
41
		if (!exists)
41
		if (!exists)
42
			fConsoleManager.addConsoles(new IConsole[] {console});
42
			fConsoleManager.addConsoles(new IConsole[] {console});
43
		fConsoleManager.showConsoleView(console);
43
		fConsoleManager.showConsoleView(console);
44
		console.getDocument().set(initialText);
45
	}
44
	}
46
45
47
	private synchronized IOConsole getConsole() {
46
	private synchronized IOConsole getConsole() {
(-)src/org/eclipse/pde/internal/ui/util/OSGiConsolePageParticipant.java (+63 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2010 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.pde.internal.ui.util;
12
13
import org.eclipse.jface.action.IToolBarManager;
14
import org.eclipse.ui.console.*;
15
import org.eclipse.ui.console.actions.CloseConsoleAction;
16
import org.eclipse.ui.part.IPageBookViewPage;
17
18
/**
19
 * Page participant extension for an OSGi console. Contributes a close action.
20
 * 
21
 * @since 3.6
22
 */
23
public class OSGiConsolePageParticipant implements IConsolePageParticipant {
24
25
	private CloseConsoleAction fCloseAction;
26
27
	/* (non-Javadoc)
28
	 * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
29
	 */
30
	public Object getAdapter(Class adapter) {
31
		return null;
32
	}
33
34
	/* (non-Javadoc)
35
	 * @see org.eclipse.ui.console.IConsolePageParticipant#init(org.eclipse.ui.part.IPageBookViewPage, org.eclipse.ui.console.IConsole)
36
	 */
37
	public void init(IPageBookViewPage page, IConsole console) {
38
		fCloseAction = new CloseConsoleAction(console);
39
		IToolBarManager manager = page.getSite().getActionBars().getToolBarManager();
40
		manager.appendToGroup(IConsoleConstants.LAUNCH_GROUP, fCloseAction);
41
	}
42
43
	/* (non-Javadoc)
44
	 * @see org.eclipse.ui.console.IConsolePageParticipant#dispose()
45
	 */
46
	public void dispose() {
47
		fCloseAction = null;
48
49
	}
50
51
	/* (non-Javadoc)
52
	 * @see org.eclipse.ui.console.IConsolePageParticipant#activated()
53
	 */
54
	public void activated() {
55
	}
56
57
	/* (non-Javadoc)
58
	 * @see org.eclipse.ui.console.IConsolePageParticipant#deactivated()
59
	 */
60
	public void deactivated() {
61
	}
62
63
}

Return to bug 312677