1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 14:42:11 +02:00

[fix] [174966] IRSESystemType should have a getLabel() method for translatable label

This commit is contained in:
Uwe Stieber 2007-02-26 16:38:21 +00:00
parent e2ad7f32cd
commit d9e08a3526
26 changed files with 136 additions and 64 deletions

View file

@ -12,4 +12,7 @@
pluginName = Target Management Service Discovery RSE Plug-in
providerName = Eclipse.org
DiscoverySystemLabel=Discovery
DiscoverySystemDescription=Discovery
NewConnectionWizard.discovery.name=Service Discovery Wizard

View file

@ -29,8 +29,9 @@ Contributors:
<extension
point="org.eclipse.rse.core.systemTypes">
<systemType id="org.eclipse.rse.systemtype.discovery"
label="%DiscoverySystemLabel"
name="Discovery"
description="Discovery"
description="%DiscoverySystemDescription"
iconLive=""/>
</extension>

View file

@ -12,6 +12,7 @@
pluginName = RSE Daytime
providerName = Eclipse.org
DaytimeSystemLabel=Daytime
DaytimeSystemDescription=Daytime System Type
Files=Files

View file

@ -14,6 +14,7 @@ Martin Oberhuber (Wind River) - initial API and implementation
<!-- Register a System that will only show Daytime subsystems -->
<extension point="org.eclipse.rse.core.systemTypes">
<systemType id="org.eclipse.rse.examples.daytime.systemtype"
label="%DaytimeSystemLabel"
name="Daytime"
description="%DaytimeSystemDescription"
icon="icons/full/obj16/daytime_obj.gif"

View file

@ -15,6 +15,6 @@
pluginName = RSE SSH Connector Service
providerName = Eclipse.org
SshSystemName=SSH Only
SshSystemLabel=SSH Only
SshSystemDescription=Connection for SSH access to remote systems

View file

@ -14,6 +14,7 @@ Martin Oberhuber - initial API and implementation
<extension point="org.eclipse.rse.core.systemTypes">
<systemType
description="%SshSystemDescription"
label="%SshSystemLabel"
icon="icons/full/obj16/systemcommands_obj.gif"
iconLive="icons/full/obj16/systemcommandslive_obj.gif"
id="org.eclipse.rse.systemtype.ssh"

View file

@ -67,7 +67,9 @@
<attribute name="name" type="string" use="required">
<annotation>
<documentation>
The display name for the system type, such as &quot;Solaris&quot;. This name is also currently used when referencing the system type in filters, subsystem configurations and similar, therefore it is not translatable. Future versions of RSE may change this and reference the systemType id instead of the name.
The display name for the system type, such as &quot;Solaris&quot;. This name is also currently used as internal identifier when referencing the system type in filters, subsystem configurations and similar, therefore it is not translatable. Future versions of RSE may change this and reference the systemType id instead of the name.
&lt;p&gt;
&lt;b&gt;Deprecated:&lt;/b&gt; Use system type id to specify a unique identifier and system type label to specify a translatable UI label.
&lt;p&gt;
RSE pre-defines a number of system types, although they may not appear unless a subsystem configuration is registered against that type. These are the supplied system types:
&lt;ul&gt;
@ -77,6 +79,19 @@ RSE pre-defines a number of system types, although they may not appear unless a
&lt;/ul&gt;
&lt;/p&gt;
</documentation>
<appInfo>
<meta.attribute deprecated="true"/>
</appInfo>
</annotation>
</attribute>
<attribute name="label" type="string" use="required">
<annotation>
<documentation>
A label used in the UI to identify the system type besides the system type icon.
</documentation>
<appInfo>
<meta.attribute translatable="true"/>
</appInfo>
</annotation>
</attribute>
<attribute name="description" type="string">
@ -123,7 +138,6 @@ If not specified, a default icon will be used by RSE.
A semicolon separated list of fully qualified subsystem configuration ids this system type wants to get registered against.
&lt;p&gt;
&lt;b&gt;Note:&lt;/b&gt; The list specified here does not imply that the corresponding subsystem configurations exist. The list contains only possibilites, not requirements.
</documentation>
</annotation>
</attribute>

View file

@ -83,9 +83,18 @@ public interface IRSESystemType extends IAdaptable {
*/
public String getId();
/**
* Returns the translatable label for use in the UI.
*
* @return The UI label or <code>null</code> if not set.
*/
public String getLabel();
/**
* Returns the name of the system type.
* @return the name of the system type
*
* @deprecated Use {@link #getId()} for accessing the unique id or {@link #getLabel()} for the UI label.
*/
public String getName();

View file

@ -138,13 +138,13 @@ public class RSECoreRegistry implements IRSECoreRegistry {
IConfigurationElement element = elements[i];
if (element.getName().equals(ELEMENT_SYTEM_TYPE)) {
RSESystemType type = new RSESystemType(element);
IRSESystemType type = new RSESystemType(element);
if (!typeIds.contains(type.getId())) {
types.add(type);
typeIds.add(type.getId());
String message = "Successfully registered RSE system type ''{0}'' (id = ''{1}'')."; //$NON-NLS-1$
message = MessageFormat.format(message, new Object[] { type.getName(), type.getId() });
message = MessageFormat.format(message, new Object[] { type.getLabel(), type.getId() });
RSECorePlugin.getDefault().getLogger().logInfo(message);
} else {
String message = "RSE system type contribution skipped. Non-unique system type id (plugin: {0}, id: {1})."; //$NON-NLS-1$
@ -171,7 +171,7 @@ public class RSECoreRegistry implements IRSECoreRegistry {
typeIds.add(type.getId());
String message = "Successfully registered RSE system type ''{0}'' (id = ''{1}'')."; //$NON-NLS-1$
message = MessageFormat.format(message, new Object[] { type.getName(), type.getId() });
message = MessageFormat.format(message, new Object[] { type.getLabel(), type.getId() });
RSECorePlugin.getDefault().getLogger().logInfo(message);
} else {
String message = "RSE system type contribution skipped. Non-unique system type id (plugin: {0}, id: {1})."; //$NON-NLS-1$

View file

@ -33,6 +33,7 @@ public class RSESystemType implements IRSESystemType {
private static final String ATTR_ID = "id"; //$NON-NLS-1$
private static final String ATTR_NAME = "name"; //$NON-NLS-1$
private static final String ATTR_LABEL = "label"; //$NON-NLS-1$
private static final String ATTR_DESCRIPTION = "description"; //$NON-NLS-1$
private static final String ATTR_ICON = "icon"; //$NON-NLS-1$
private static final String ATTR_ICONLIVE = "iconLive"; //$NON-NLS-1$
@ -42,6 +43,7 @@ public class RSESystemType implements IRSESystemType {
private String id = null;
private String name = null;
private String label = null;
private String description = null;
private Map properties;
private Bundle definingBundle = null;
@ -55,6 +57,7 @@ public class RSESystemType implements IRSESystemType {
id = element.getAttribute(ATTR_ID);
name = element.getAttribute(ATTR_NAME);
label = element.getAttribute(ATTR_LABEL);
description = element.getAttribute(ATTR_DESCRIPTION);
loadProperties(element);
@ -105,6 +108,15 @@ public class RSESystemType implements IRSESystemType {
return id;
}
/* (non-Javadoc)
* @see org.eclipse.rse.core.IRSESystemType#getLabel()
*/
public String getLabel() {
// fallback to the id if the label should be null.
if (label == null) return getId();
return label;
}
/* (non-Javadoc)
* @see org.eclipse.rse.core.IRSESystemType#getName()
*/

View file

@ -21,6 +21,7 @@
pluginName = RSE FTP Files
providerName = Eclipse.org
FtpSystemLabel=FTP Only
FtpSystemDescription=Connection for FTP access to remote systems
Files=Files

View file

@ -19,6 +19,7 @@ Martin Oberhuber (Wind River) - add FTP Only system type
<plugin>
<extension point="org.eclipse.rse.core.systemTypes">
<systemType
label="%FtpSystemLabel"
description="%FtpSystemDescription"
icon="icons/full/obj16/systemfiles_obj.gif"
iconLive="icons/full/obj16/systemfileslive_obj.gif"

View file

@ -136,7 +136,7 @@ public class RSESystemTypeAdapter extends RSEAdapter implements IRSESystemTypeCo
public String getLabel(Object object) {
if ((object != null) && (object instanceof IRSESystemType)) {
return ((IRSESystemType)object).getName();
return ((IRSESystemType)object).getLabel();
}
else {
return super.getLabel(object);

View file

@ -19,8 +19,10 @@ import java.util.LinkedList;
import java.util.List;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.wizard.IWizard;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.rse.core.IRSESystemType;
@ -143,7 +145,17 @@ public class SystemNewConnectionAction extends SystemBaseWizardAction {
// on as well to the new connection wizard.
newConnWizard.setConnectionContext(connectionContext);
return newConnWizard.isRestrictedToSingleSystemType() ? newConnWizard.getSelectedWizard() : newConnWizard;
// If the wizard is restricted to only one system type, the main wizard has to be skipped
// and the dialog needs to be initialized directly with the selected wizard.
if (newConnWizard.isRestrictedToSingleSystemType()) {
IWizard wizard = newConnWizard.getSelectedWizard();
if (wizard instanceof ISelectionChangedListener) {
((ISelectionChangedListener)wizard).selectionChanged(new SelectionChangedEvent(newConnWizard, newConnWizard.getSelection()));
}
return wizard;
}
return newConnWizard;
}
/* (non-Javadoc)

View file

@ -362,7 +362,7 @@ public class SystemTypeFieldEditor extends FieldEditor
Object value = ""; //$NON-NLS-1$
if (property.equals(P_NAME))
value = row.getName();
value = row.getLabel();
else if (property.equals(P_ENABLED))
value = (adapter.isEnabled(row) ? new Integer(0) : new Integer(1));
else if (property.equals(P_USERID))
@ -399,7 +399,7 @@ public class SystemTypeFieldEditor extends FieldEditor
else
return;
keyValues.put(row.getName(), ""); //$NON-NLS-1$
keyValues.put(row.getLabel(), ""); //$NON-NLS-1$
tableViewer.update(row, null);
}
@ -424,7 +424,7 @@ public class SystemTypeFieldEditor extends FieldEditor
RSESystemTypeAdapter adapter = (RSESystemTypeAdapter)(currType.getAdapter(IRSESystemType.class));
if (columnIndex == COLUMN_NAME)
return currType.getName();
return currType.getLabel();
else if (columnIndex == COLUMN_ENABLED)
return Boolean.toString(adapter.isEnabled(currType));
else if (columnIndex == COLUMN_USERID)

View file

@ -77,14 +77,7 @@ public class RSEDialogPageMessageLine implements ISystemMessageLine {
*/
public void setErrorMessage(String message) {
assert page != null;
// Per Eclipse UI style, wizard pager should never start with errors!
if (message != null && message.toLowerCase().startsWith("please enter")) { //$NON-NLS-1$
errorSystemMessage = null;
page.setErrorMessage(null);
setMessage(message);
} else {
page.setErrorMessage(message);
}
page.setErrorMessage(message);
}
/* (non-Javadoc)

View file

@ -38,6 +38,9 @@ public abstract class RSEAbstractNewConnectionWizard extends Wizard implements I
public RSEAbstractNewConnectionWizard() {
systemType = null;
isBusy = false;
setNeedsProgressMonitor(true);
setForcePreviousAndNextButtons(true);
}
/* (non-Javadoc)

View file

@ -114,6 +114,7 @@ public class RSEDefaultNewConnectionWizard extends RSEAbstractNewConnectionWizar
public void addPages() {
try {
mainPage = createMainPage(getSystemType());
SystemConnectionForm form = mainPage.getSystemConnectionForm();
if (form != null) {
form.setCurrentlySelectedConnection(selectedContext);
@ -138,6 +139,10 @@ public class RSEDefaultNewConnectionWizard extends RSEAbstractNewConnectionWizar
*/
protected RSEDefaultNewConnectionWizardMainPage createMainPage(IRSESystemType systemType) {
mainPage = new RSEDefaultNewConnectionWizardMainPage(this, getPageTitle(), SystemResources.RESID_NEWCONN_PAGE1_DESCRIPTION);
mainPage.setTitle(getPageTitle());
mainPage.setSystemType(systemType);
subsystemFactorySuppliedWizardPages = getAdditionalWizardPages(systemType.getName());
return mainPage;
}
@ -148,7 +153,7 @@ public class RSEDefaultNewConnectionWizard extends RSEAbstractNewConnectionWizar
if (getSystemType() == null) {
pageTitle = SystemResources.RESID_NEWCONN_PAGE1_TITLE;
} else {
String onlySystemType = getSystemType().getName();
String onlySystemType = getSystemType().getLabel();
if (onlySystemType.equals(IRSESystemType.SYSTEMTYPE_LOCAL)) {
pageTitle = SystemResources.RESID_NEWCONN_PAGE1_LOCAL_TITLE;

View file

@ -59,10 +59,9 @@ public class RSEDefaultNewConnectionWizardMainPage extends WizardPage implements
if (title != null) setTitle(title);
if (description != null) setDescription(description);
// setHelp(parentHelpId);
messageLine = new RSEDialogPageMessageLine(this);
}
/**
* Set the system type the page is working with.
*

View file

@ -307,7 +307,7 @@ public class RSEMainNewConnectionWizard extends Wizard implements INewWizard, IS
addSelectionChangedListener((ISelectionChangedListener)selectedWizard);
}
// Initialize the wizard pages and remember which wizard we have initialized already
// Initialize the wizard pages and remember which wizard we have initialized already.
if (selectedWizard != null && !initializedWizards.contains(selectedWizard)) {
selectedWizard.addPages();
initializedWizards.add(selectedWizard);
@ -338,7 +338,7 @@ public class RSEMainNewConnectionWizard extends Wizard implements INewWizard, IS
public IWizardPage getNextPage(IWizardPage page) {
IWizardPage nextPage = null;
if (page != null && page == mainPage && getSelectedWizard() != null) {
nextPage = getSelectedWizard().getStartingPage();
nextPage = getSelectedWizard().getStartingPage();
}
if (nextPage == null) super.getNextPage(page);

View file

@ -51,7 +51,7 @@ public class RSENewConnectionWizardSelectionTreeElement extends RSEWizardSelecti
* @see org.eclipse.rse.ui.internal.wizards.newconnection.RSEWizardSelectionTreeElement#getLabel()
*/
public String getLabel() {
return getSystemType().getName();
return getSystemType().getLabel();
}
/* (non-Javadoc)

View file

@ -188,7 +188,7 @@ public class SystemNewConnectionPromptObject implements ISystemPromptableObject,
else
newConnText = SystemResources.RESID_NEWCONN_PROMPT_LABEL + " ..."; //$NON-NLS-1$
} else if (getSystemTypes().length > 0) {
newConnText = systemTypes[0].getName() + " ..."; //$NON-NLS-1$
newConnText = systemTypes[0].getLabel() + " ..."; //$NON-NLS-1$
}
}

View file

@ -1,5 +1,5 @@
################################################################################
# Copyright (c) 2000, 2006 IBM Corporation. All rights reserved.
# Copyright (c) 2000, 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 http://www.eclipse.org/legal/epl-v10.html
@ -11,7 +11,8 @@
# Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
#
# Contributors:
# {Name} (company) - description of contribution.
# Uwe Stieber (Wind River) - [174966] IRSESystemType should have a getLabel()
# method for translatable label.
################################################################################
# NLS_MESSAGEFORMAT_NONE
@ -28,16 +29,21 @@ extPoint.remoteSystemsViewPreferencesActions = Remote Systems View Preferences A
extPoint.compile = Remote Compile Commands
extPoint.mountPathMappers = Mount Path Mappers
#systemType.iseries = iSeries native operating system (OS/400 or i5/OS)
#systemType.iseries.PASE = PASE on iSeries
#systemType.zseries = zSeries native operating system (z/OS)
systemType.windows = Any version of Microsoft Windows
systemType.unix = Any distribution of Unix
#systemType.aix = IBM AIX operating system
systemType.linux = Any distribution of Linux
#systemType.powerlinux = Linux running on PowerPC hardware
#systemType.zlinux = Linux running on zSeries hardware
systemType.local = Local file system on this computer
systemType.windows.label=Windows
systemType.unix.label=Unix
systemType.linux.label=Linux
systemType.local.label=Local
#systemType.iseries.description = iSeries native operating system (OS/400 or i5/OS)
#systemType.iseries.PASE.description = PASE on iSeries
#systemType.zseries.description = zSeries native operating system (z/OS)
systemType.windows.description = Any version of Microsoft Windows
systemType.unix.description = Any distribution of Unix
#systemType.aix.description = IBM AIX operating system
systemType.linux.description = Any distribution of Linux
#systemType.powerlinux.description = Linux running on PowerPC hardware
#systemType.zlinux.description = Linux running on zSeries hardware
systemType.local.description = Local file system on this computer
#PropertyPage.Info = Info
#PropertyPage.Team = Team

View file

@ -183,61 +183,69 @@ Contributors:
<!--
<systemType id="org.eclipse.rse.systemtype.iseries"
name="iSeries"
description="%systemType.iseries"
description="%systemType.iseries.description"
icon="icons/full/obj16/system400_obj.gif"
iconLive="icons/full/obj16/system400live_obj.gif"/>
<systemType id="org.eclipse.rse.systemtype.iseries.PASE"
name="PASE"
description="%systemType.iseries.PASE"
description="%systemType.iseries.PASE.description"
icon="icons/full/obj16/system400_obj.gif"
iconLive="icons/full/obj16/system400live_obj.gif"/>
-->
<systemType id="org.eclipse.rse.systemtype.windows"
name="Windows"
description="%systemType.windows"
icon="icons/full/obj16/systemwin_obj.gif"
iconLive="icons/full/obj16/systemwinlive_obj.gif"/>
<systemType
description="%systemType.windows.description"
icon="icons/full/obj16/systemwin_obj.gif"
iconLive="icons/full/obj16/systemwinlive_obj.gif"
id="org.eclipse.rse.systemtype.windows"
label="%systemType.windows.label"
name="Windows"/>
<!--
<systemType id="org.eclipse.rse.systemtype.zseries"
name="z/OS"
description="%systemType.zseries"
description="%systemType.zseries.description"
icon="icons/full/obj16/system390_obj.gif"
iconLive="icons/full/obj16/system390live_obj.gif"/>
-->
<systemType id="org.eclipse.rse.systemtype.linux"
name="Linux"
description="%systemType.linux"
<systemType
description="%systemType.linux.description"
icon="icons/full/obj16/systemlinux_obj.gif"
iconLive="icons/full/obj16/systemlinuxlive_obj.gif"/>
iconLive="icons/full/obj16/systemlinuxlive_obj.gif"
id="org.eclipse.rse.systemtype.linux"
label="%systemType.linux.label"
name="Linux"/>
<!--
<systemType id="org.eclipse.rse.systemtype.linux.power"
name="Power Linux"
description="%systemType.powerlinux"
description="%systemType.powerlinux.description"
icon="icons/full/obj16/systemlinux_obj.gif"
iconLive="icons/full/obj16/systemlinuxlive_obj.gif"/>
<systemType id="org.eclipse.rse.systemtype.linux.zSeries"
name="zSeries Linux"
description="%systemType.zlinux"
description="%systemType.zlinux.description"
icon="icons/full/obj16/systemlinux_obj.gif"
iconLive="icons/full/obj16/systemlinuxlive_obj.gif"/>
-->
<systemType id="org.eclipse.rse.systemtype.unix"
name="Unix"
description="%systemType.unix"
icon="icons/full/obj16/systemunix_obj.gif"
iconLive="icons/full/obj16/systemunixlive_obj.gif"/>
<systemType
description="%systemType.unix.description"
icon="icons/full/obj16/systemunix_obj.gif"
iconLive="icons/full/obj16/systemunixlive_obj.gif"
id="org.eclipse.rse.systemtype.unix"
label="%systemType.unix.label"
name="Unix"/>
<!--
<systemType id="org.eclipse.rse.systemtype.aix"
name="AIX"
description="%systemType.aix"
description="%systemType.aix.description"
icon="icons/full/obj16/systemaix_obj.gif"
iconLive="icons/full/obj16/systemaixlive_obj.gif"/>
-->
<systemType id="org.eclipse.rse.systemtype.local"
name="Local"
description="%systemType.local"
icon="icons/full/obj16/systemlocal_obj.gif"
iconLive="icons/full/obj16/systemlocallive_obj.gif"/>
<systemType
description="%systemType.local.description"
icon="icons/full/obj16/systemlocal_obj.gif"
iconLive="icons/full/obj16/systemlocallive_obj.gif"
id="org.eclipse.rse.systemtype.local"
label="%systemType.local.label"
name="Local"/>
</extension>

View file

@ -21,4 +21,5 @@ testSubSystem2Description = Test Subsystem 2
testSubSystem3Name = Tests3
testSubSystem3Description = Test Subsystem 3
testSystemTypeLabel = Tests Only
testSystemTypeDescription = RSE Test plugin internal system type

View file

@ -61,6 +61,7 @@
<extension
point="org.eclipse.rse.core.systemTypes">
<systemType
label="%testSystemTypeLabel"
description="%testSystemTypeDescription"
enableOffline="false"
id="org.eclipse.rse.tests.testSystemType"