public static synchronized MessageHandler getInstance() { if ( GMinstance == null ) { GMinstance = new GlobalMessages(); } return GMinstance; }
@Override public String getString( String key ) { Object[] parameters = null; return calculateString( SYSTEM_BUNDLE_PACKAGE, key, parameters ); }
private void addToolBar() { try { XulLoader loader = new KettleXulLoader(); loader.setSettingsManager( XulSpoonSettingsManager.getInstance() ); ResourceBundle bundle = GlobalMessages.getBundle( "org/pentaho/di/ui/spoon/messages/messages" ); XulDomContainer xulDomContainer = loader.loadXul( XUL_FILE_TRANS_GRID_TOOLBAR, bundle ); xulDomContainer.addEventHandler( this ); toolbar = (XulToolbar) xulDomContainer.getDocumentRoot().getElementById( "nav-toolbar" ); ToolBar swtToolBar = (ToolBar) toolbar.getManagedObject(); spoon.props.setLook( swtToolBar, Props.WIDGET_STYLE_TOOLBAR ); swtToolBar.layout( true, true ); } catch ( Throwable t ) { log.logError( toString(), Const.getStackTracker( t ) ); new ErrorDialog( transGridComposite.getShell(), BaseMessages.getString( PKG, "Spoon.Exception.ErrorReadingXULFile.Title" ), BaseMessages.getString( PKG, "Spoon.Exception.ErrorReadingXULFile.Message", XUL_FILE_TRANS_GRID_TOOLBAR ), new Exception( t ) ); } }
res = GlobalMessages.getBundle( MESSAGES ); } catch ( MissingResourceException e ) { log.logError(
@Override public String getString( String packageName, String key, Class<?> resourceClass, String... parameters ) { return calculateString( packageName, key, parameters, resourceClass ); } }
private void addToolBar() { try { XulLoader loader = new KettleXulLoader(); loader.setSettingsManager( XulSpoonSettingsManager.getInstance() ); ResourceBundle bundle = GlobalMessages.getBundle( "org/pentaho/di/ui/spoon/messages/messages" ); XulDomContainer xulDomContainer = loader.loadXul( XUL_FILE_TRANS_PREVIEW_TOOLBAR, bundle ); xulDomContainer.addEventHandler( this ); toolbar = (XulToolbar) xulDomContainer.getDocumentRoot().getElementById( "nav-toolbar" ); ToolBar swtToolBar = (ToolBar) toolbar.getManagedObject(); spoon.props.setLook( swtToolBar, Props.WIDGET_STYLE_TOOLBAR ); swtToolBar.layout( true, true ); swtToolBar.pack(); firstRadio = (SwtRadio) xulDomContainer.getDocumentRoot().getElementById( "preview-first" ); lastRadio = (SwtRadio) xulDomContainer.getDocumentRoot().getElementById( "preview-last" ); offRadio = (SwtRadio) xulDomContainer.getDocumentRoot().getElementById( "preview-off" ); PropsUI.getInstance().setLook( (Control) firstRadio.getManagedObject(), Props.WIDGET_STYLE_TOOLBAR ); PropsUI.getInstance().setLook( (Control) lastRadio.getManagedObject(), Props.WIDGET_STYLE_TOOLBAR ); PropsUI.getInstance().setLook( (Control) offRadio.getManagedObject(), Props.WIDGET_STYLE_TOOLBAR ); } catch ( Throwable t ) { log.logError( toString(), Const.getStackTracker( t ) ); new ErrorDialog( transPreviewComposite.getShell(), BaseMessages.getString( PKG, "Spoon.Exception.ErrorReadingXULFile.Title" ), BaseMessages.getString( PKG, "Spoon.Exception.ErrorReadingXULFile.Message", XUL_FILE_TRANS_PREVIEW_TOOLBAR ), new Exception( t ) ); } }
@Override public String getString( String packageName, String key ) { Object[] parameters = new Object[] {}; return calculateString( packageName, key, parameters ); }
protected void addToolBar() { try { XulLoader loader = new KettleXulLoader(); loader.setSettingsManager( XulSpoonSettingsManager.getInstance() ); ResourceBundle bundle = GlobalMessages.getBundle( "org/pentaho/di/ui/spoon/messages/messages" ); XulDomContainer xulDomContainer = loader.loadXul( XUL_FILE_BROWSER_TOOLBAR, bundle ); xulDomContainer.addEventHandler( this ); toolbar = (XulToolbar) xulDomContainer.getDocumentRoot().getElementById( "nav-toolbar" ); @SuppressWarnings( "unused" ) ToolBar swtToolBar = (ToolBar) toolbar.getManagedObject(); spoon.props.setLook( swtToolBar, Props.WIDGET_STYLE_TOOLBAR ); // Add a URL back = (XulToolbarbutton) toolbar.getElementById( "browse-back" ); back.setDisabled( true ); forward = (XulToolbarbutton) toolbar.getElementById( "browse-forward" ); forward.setLabel( BaseMessages.getString( PKG, "SpoonBrowser.Dialog.Forward" ) ); forward.setDisabled( false ); location = (XulTextbox) toolbar.getElementById( "browser-address" ); Control toolbarControl = (Control) toolbar.getManagedObject(); toolbarControl.setLayoutData( new FormData() ); toolbarControl.setParent( composite ); } catch ( Exception e ) { e.printStackTrace(); new ErrorDialog( shell, BaseMessages.getString( PKG, "Spoon.Exception.ErrorReadingXULFile.Title" ), BaseMessages .getString( PKG, "Spoon.Exception.ErrorReadingXULFile.Message", XUL_FILE_BROWSER_TOOLBAR ), e ); } }
@Override public String getString( String packageName, String key, String... parameters ) { return calculateString( packageName, key, parameters ); }
/** * Returns the localized string for the given {@code key} and {@code parameters} in a bundle defined by the the * concatenation of {@code packageName} and {@link #BUNDLE_NAME}, using the {@link GlobalMessages} class loader. * * @param packageName the package containing the localized messages * @param key the message key being looked up * @param parameters parameters within the looked up message * @return the localized string for the given {@code key} and {@code parameters} in a bundle defined by the the * concatenation of {@code packageName} and {@link #BUNDLE_NAME}, using the {@link GlobalMessages} class loader. */ protected String calculateString( String packageName, String key, Object[] parameters ) { return calculateString( packageName, key, parameters, PKG ); }
/** * Returns the localized string for the given {@code key} and {@code parameters} in a bundle defined by the the * concatenation of {@code packageName} and {@link #BUNDLE_NAME}, using the provided {@code resourceClass}'s class * loader. * * @param packageName the package containing the localized messages * @param key the message key being looked up * @param parameters parameters within the looked up message * @param resourceClass the class whose class loader is used to getch the resource bundle * @return the localized string for the given {@code key} and {@code parameters} in a bundle defined by the the * concatenation of {@code packageName} and {@link #BUNDLE_NAME}, using the provided {@code resourceClass}'s class * loader. */ protected String calculateString( String packageName, String key, Object[] parameters, Class<?> resourceClass ) { final String[] pkgNames = new String[] { packageName, SYSTEM_BUNDLE_PACKAGE }; return calculateString( pkgNames, key, parameters, resourceClass ); }
@Override protected String calculateString( String packageName, String key, Object[] parameters, Class<?> resourceClass ) { if ( replaceWith != null ) { final String[] pkgNames = new String[] { replacePackage( packageName ), replaceSysBundle }; final String string = super.calculateString( pkgNames, key, parameters, resourceClass ); if ( !GlobalMessageUtil.isMissingKey( string ) ) { return string; } } final String[] pkgNames = new String[] { packageName, SYSTEM_BUNDLE_PACKAGE }; return GlobalMessageUtil.calculateString( pkgNames, key, parameters, resourceClass, BUNDLE_NAME, false ); } }