mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-05 08:05:24 +02:00
[235626] Convert terminals.ui to MessageBundle format
This commit is contained in:
parent
d845181b70
commit
19fdbcabac
6 changed files with 55 additions and 66 deletions
|
@ -1,18 +1,16 @@
|
|||
/********************************************************************************
|
||||
* Copyright (c) 2008 MontaVista Software, Inc.
|
||||
* Copyright (c) 2008 MontaVista Software, Inc. and others.
|
||||
* 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
|
||||
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
|
||||
* available at http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
*
|
||||
* Contributors:
|
||||
* Yu-Fen Kuo (MontaVista) - initial API and implementation
|
||||
* Martin Oberhuber (Wind River) - [235626] Convert terminals.ui to MessageBundle format
|
||||
********************************************************************************/
|
||||
|
||||
package org.eclipse.rse.internal.terminals.ui;
|
||||
|
||||
import java.util.MissingResourceException;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
import org.eclipse.rse.ui.SystemBasePlugin;
|
||||
import org.osgi.framework.BundleContext;
|
||||
|
||||
|
@ -27,8 +25,6 @@ public class Activator extends SystemBasePlugin {
|
|||
// The shared instance
|
||||
private static Activator plugin;
|
||||
|
||||
private ResourceBundle resourceBundle;
|
||||
|
||||
public static String ICON_ID_LAUNCH_TERMINAL = "icon_id_launch_terminal"; //$NON-NLS-1$
|
||||
public static String ICON_ID_TERMINAL_SUBSYSTEM = "icon_id_terminal_subsystem"; //$NON-NLS-1$
|
||||
public static String ICON_ID_TERMINAL_SUBSYSTEM_LIVE = "icon_id_terminal_subsystem_live"; //$NON-NLS-1$
|
||||
|
@ -42,7 +38,7 @@ public class Activator extends SystemBasePlugin {
|
|||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
*
|
||||
* @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
|
||||
*/
|
||||
public void start(BundleContext context) throws Exception {
|
||||
|
@ -52,59 +48,23 @@ public class Activator extends SystemBasePlugin {
|
|||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
*
|
||||
* @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
|
||||
*/
|
||||
public void stop(BundleContext context) throws Exception {
|
||||
plugin = null;
|
||||
resourceBundle = null;
|
||||
super.stop(context);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the shared instance
|
||||
*
|
||||
*
|
||||
* @return the shared instance
|
||||
*/
|
||||
public static Activator getDefault() {
|
||||
return plugin;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the string from the plugin's resource bundle, or 'key' if not
|
||||
* found.
|
||||
*
|
||||
* @see java.util.ResourceBundle#getString(String)
|
||||
*
|
||||
* @param key
|
||||
* the key for the desired string
|
||||
* @return the string for the given key
|
||||
*/
|
||||
public static String getResourceString(String key) {
|
||||
ResourceBundle bundle = Activator.getDefault().getResourceBundle();
|
||||
try {
|
||||
return (bundle != null) ? bundle.getString(key) : key;
|
||||
} catch (MissingResourceException e) {
|
||||
return key;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the plugin's Resource bundle.
|
||||
*
|
||||
* @return the Resource bundle
|
||||
*/
|
||||
public ResourceBundle getResourceBundle() {
|
||||
try {
|
||||
if (resourceBundle == null)
|
||||
resourceBundle = ResourceBundle
|
||||
.getBundle("org.eclipse.rse.internal.terminals.ui.TerminalUIResources"); //$NON-NLS-1$
|
||||
} catch (MissingResourceException x) {
|
||||
resourceBundle = null;
|
||||
}
|
||||
return resourceBundle;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize the image registry by declaring all of the required graphics.
|
||||
*/
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2008 Wind River Systems, Inc. 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
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Martin Oberhuber (Wind River) - [235626] initial API and implementation
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.rse.internal.terminals.ui;
|
||||
|
||||
import org.eclipse.osgi.util.NLS;
|
||||
|
||||
public class TerminalUIResources extends NLS {
|
||||
private static String BUNDLE_NAME = "org.eclipse.rse.internal.terminals.ui.TerminalUIResources"; //$NON-NLS-1$
|
||||
|
||||
public static String RemoveTerminalAction_label;
|
||||
public static String RemoveTerminalAction_tooltip;
|
||||
public static String ShowInTerminalViewAction_label;
|
||||
public static String ShowInTerminalViewAction_tooltip;
|
||||
|
||||
public static String TerminalsUI_cannotOpenView_error;
|
||||
|
||||
static {
|
||||
NLS.initializeMessages(BUNDLE_NAME, TerminalUIResources.class);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,22 +1,21 @@
|
|||
################################################################################
|
||||
# Copyright (c) 2008 MontaVista Software, Inc.
|
||||
# Copyright (c) 2008 MontaVista Software, Inc. 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
|
||||
# http://www.eclipse.org/legal/epl-v10.html
|
||||
#
|
||||
# Contributors:
|
||||
# Yu-Fen Kuo (MontaVista) - initial API and implementation
|
||||
# Yu-Fen Kuo (MontaVista) - initial API and implementation
|
||||
# Martin Oberhuber (Wind River) - [235626] Convert terminals.ui to MessageBundle format
|
||||
################################################################################
|
||||
|
||||
# NLS_MESSAGEFORMAT_VAR
|
||||
# NLS_ENCODING=UTF-8
|
||||
|
||||
LaunchTerminalAction.title=Launch Terminal
|
||||
LaunchTerminalAction.tooltip=Launch Terminal view
|
||||
TerminalsUI.cannotOpenView.error=Can not open remote terminals view
|
||||
RemoveTerminalAction_label=Remove Terminal
|
||||
RemoveTerminalAction_tooltip=Remove current terminal from terminals view
|
||||
ShowInTerminalViewAction_label=Show In Terminals View
|
||||
ShowInTerminalViewAction_tooltip=Show current terminal in Terminals view
|
||||
|
||||
RemoveTerminalAction.label=Remove Terminal
|
||||
RemoveTerminalAction.tooltip=Remove current terminal from terminals view
|
||||
ShowInTerminalViewAction.label=Show In Terminals View
|
||||
ShowInTerminalViewAction.tooltip=Show current terminal in Terminals view
|
||||
TerminalsUI_cannotOpenView_error=Can not open remote terminals view
|
||||
|
|
|
@ -15,11 +15,13 @@
|
|||
* David McKnight (IBM) - [165680] "Show in Remote Shell View" does not work
|
||||
* Anna Dushistova (MontaVista) - Adapted from SystemShowInShellViewAction
|
||||
* Anna Dushistova (MontaVista) - Adapted from ShowInTerminalViewAction
|
||||
* Martin Oberhuber (Wind River) - [235626] Convert terminals.ui to MessageBundle format
|
||||
*******************************************************************************/
|
||||
package org.eclipse.rse.internal.terminals.ui.actions;
|
||||
|
||||
import org.eclipse.jface.resource.ImageDescriptor;
|
||||
import org.eclipse.rse.internal.terminals.ui.Activator;
|
||||
import org.eclipse.rse.internal.terminals.ui.TerminalUIResources;
|
||||
import org.eclipse.rse.internal.terminals.ui.views.TerminalViewer;
|
||||
import org.eclipse.rse.internal.terminals.ui.views.TerminalsUI;
|
||||
import org.eclipse.rse.subsystems.terminals.core.elements.TerminalElement;
|
||||
|
@ -27,8 +29,7 @@ import org.eclipse.swt.widgets.Shell;
|
|||
|
||||
public class RemoveTerminalAction extends TerminalElementBaseAction {
|
||||
public RemoveTerminalAction(Shell parent) {
|
||||
this(Activator.getResourceString("RemoveTerminalAction.label"), //$NON-NLS-1$
|
||||
Activator.getResourceString("RemoveTerminalAction.tooltip"), //$NON-NLS-1$
|
||||
this(TerminalUIResources.RemoveTerminalAction_label, TerminalUIResources.RemoveTerminalAction_tooltip,
|
||||
Activator.getDefault().getImageDescriptor(
|
||||
Activator.ICON_ID_REMOVE_TERMINAL), parent);
|
||||
}
|
||||
|
|
|
@ -14,11 +14,13 @@
|
|||
* Contributors:
|
||||
* David McKnight (IBM) - [165680] "Show in Remote Shell View" does not work
|
||||
* Anna Dushistova (MontaVista) - Adapted from SystemShowInShellViewAction
|
||||
* Martin Oberhuber (Wind River) - [235626] Convert terminals.ui to MessageBundle format
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.rse.internal.terminals.ui.actions;
|
||||
|
||||
import org.eclipse.rse.internal.terminals.ui.Activator;
|
||||
import org.eclipse.rse.internal.terminals.ui.TerminalUIResources;
|
||||
import org.eclipse.rse.internal.terminals.ui.views.TerminalViewer;
|
||||
import org.eclipse.rse.internal.terminals.ui.views.TerminalsUI;
|
||||
import org.eclipse.rse.subsystems.terminals.core.elements.TerminalElement;
|
||||
|
@ -27,11 +29,8 @@ import org.eclipse.swt.widgets.Shell;
|
|||
public class ShowInTerminalViewAction extends TerminalElementBaseAction {
|
||||
|
||||
public ShowInTerminalViewAction(Shell parent) {
|
||||
super(
|
||||
Activator.getResourceString("ShowInTerminalViewAction.label"), //$NON-NLS-1$
|
||||
Activator.getResourceString("ShowInTerminalViewAction.tooltip"), //$NON-NLS-1$
|
||||
Activator.getDefault().getImageDescriptor(
|
||||
Activator.ICON_ID_LAUNCH_TERMINAL), parent);
|
||||
super(TerminalUIResources.ShowInTerminalViewAction_label, TerminalUIResources.ShowInTerminalViewAction_tooltip,
|
||||
Activator.getDefault().getImageDescriptor(Activator.ICON_ID_LAUNCH_TERMINAL), parent);
|
||||
allowOnMultipleSelection(false);
|
||||
}
|
||||
|
||||
|
|
|
@ -14,11 +14,12 @@
|
|||
* Martin Oberhuber (Wind River) - [168870] refactor org.eclipse.rse.core package of the UI plugin
|
||||
* Yu-Fen Kuo (MontaVista) - Adapted from SystemCommandsUI
|
||||
* Anna Dushistova (MontaVista) - [228577] [rseterminal] Clean up RSE Terminal impl
|
||||
* Martin Oberhuber (Wind River) - [235626] Convert terminals.ui to MessageBundle format
|
||||
********************************************************************************/
|
||||
|
||||
package org.eclipse.rse.internal.terminals.ui.views;
|
||||
|
||||
import org.eclipse.rse.internal.terminals.ui.Activator;
|
||||
import org.eclipse.rse.internal.terminals.ui.TerminalUIResources;
|
||||
import org.eclipse.rse.ui.SystemBasePlugin;
|
||||
import org.eclipse.ui.IWorkbenchPage;
|
||||
import org.eclipse.ui.PartInitException;
|
||||
|
@ -57,8 +58,7 @@ public class TerminalsUI {
|
|||
viewer = (TerminalViewer) page.showView(TerminalViewer.VIEW_ID);
|
||||
page.bringToTop(viewer);
|
||||
} catch (PartInitException e) {
|
||||
SystemBasePlugin.logError(Activator
|
||||
.getResourceString("TerminalsUI.cannotOpenView.error"), e); //$NON-NLS-1$
|
||||
SystemBasePlugin.logError(TerminalUIResources.TerminalsUI_cannotOpenView_error, e);
|
||||
}
|
||||
|
||||
return viewer;
|
||||
|
|
Loading…
Add table
Reference in a new issue