/** * Formats the message stored in the resource bundle (using a MessageFormat). * * @param key the resourcebundle key * @param parameter the parameter for the message * @return the formated string */ public String formatMessage( final String key, final Object parameter ) { return formatMessage( key, new Object[] { parameter } ); }
/** * Returns the mnemonic key code for the action associated with the dialog. * * @return The key code. */ public Integer getMnemonicKey() { return resources.getOptionalMnemonic( "action.export-to-csv.table.mnemonic" ); //$NON-NLS-1$ } }
/** * Returns an unscaled icon. * * @param key the name of the resource bundle key * @return the icon. */ public Icon getIcon( final String key ) { if ( key == null ) { throw new NullPointerException(); } final String name = strictString( key ); return createIcon( name, false, false ); }
/** * Returns the mnemonic stored at the given resourcebundle key. The mnemonic should be either the symbolic name of one * of the KeyEvent.VK_* constants (without the 'VK_') or the character for that key. * <p/> * For the enter key, the resource bundle would therefore either contain "ENTER" or "\n". * <pre> * a.resourcebundle.key=ENTER * an.other.resourcebundle.key=\n * </pre> * * @param key the resourcebundle key * @return the mnemonic */ public Integer getMnemonic( final String key ) { if ( key == null ) { throw new NullPointerException(); } final String name = strictString( key ); return createMnemonic( name ); }
/** * Formats the message stored in the resource bundle (using a MessageFormat). * * @param key the resourcebundle key * @param parameters the parameter collection for the message * @return the formated string */ public String formatMessage( final String key, final Object[] parameters ) { final MessageFormat format = new MessageFormat( strictString( key ) ); format.setLocale( getLocale() ); return format.format( parameters ); }
/** * Exports a report. * * @param report * the report. * @return true, if the export was successful, false otherwise. */ public boolean performExport( final MasterReport report ) { // need to connect to the report pane to receive state updates ... final ReportProgressDialog progressDialog; if ( "true".equals( report.getReportConfiguration().getConfigProperty( PrintingPlugin.PROGRESS_DIALOG_ENABLE_KEY, "false" ) ) ) { //$NON-NLS-1$ //$NON-NLS-2$ progressDialog = createProgressDialog(); if ( report.getTitle() == null ) { progressDialog.setTitle( getResources().getString( "ProgressDialog.EMPTY_TITLE" ) ); } else { progressDialog.setTitle( getResources().formatMessage( "ProgressDialog.TITLE", report.getTitle() ) ); } } else { progressDialog = null; } final PrintExportTask task = new PrintExportTask( report, progressDialog, getContext() ); final Thread worker = new Thread( task ); worker.start(); return true; }
/** * DefaultConstructor. */ public HtmlStreamExportPlugin() { resources = new ResourceBundleSupport( Locale.getDefault(), HtmlExportGUIModule.BASE_RESOURCE_CLASS, ObjectUtilities .getClassLoader( HtmlExportGUIModule.class ) ); }
String name = strictString( key ); if ( StringUtils.isEmpty( name ) ) { return null; mask |= KeyEvent.META_MASK; } else if ( "menu".equals( token ) ) { mask |= getMenuKeyMask(); } else if ( "none".equals( token ) ) { explicitNone = true; mask = 0; } else if ( mask == 0 ) { mask = getMenuKeyMask(); return KeyStroke.getKeyStroke( createMnemonic( name ).intValue(), mask );
String name = getOptionalString( key ); if ( StringUtils.isEmpty( name ) ) { return null; mask |= KeyEvent.META_MASK; } else if ( "menu".equals( token ) ) { mask |= getMenuKeyMask(); } else if ( "none".equals( token ) ) { noneSelected = true; mask = 0; } else if ( mask == 0 ) { mask = getMenuKeyMask(); return KeyStroke.getKeyStroke( createMnemonic( name ).intValue(), mask ); } catch ( MissingResourceException mre ) { return null;
/** * Returns the mnemonic stored at the given resourcebundle key. The mnemonic should be either the symbolic name of one * of the KeyEvent.VK_* constants (without the 'VK_') or the character for that key. * <p/> * For the enter key, the resource bundle would therefore either contain "ENTER" or "\n". * <pre> * a.resourcebundle.key=ENTER * an.other.resourcebundle.key=\n * </pre> * * @param key the resourcebundle key * @return the mnemonic or null, if the mnemonic is not defined. */ public Integer getOptionalMnemonic( final String key ) { if ( key == null ) { throw new NullPointerException(); } final String name = getOptionalString( key ); if ( name != null && name.length() > 0 ) { return createMnemonic( name ); } return INVALID_MNEMONIC; }
/** * Returns the error icon for this an all derived editors. * * @return the error icon. */ protected Icon getErrorIcon() { if ( errorIcon == null ) { errorIcon = resources.getIcon( "default-editor.error-icon" ); //$NON-NLS-1$ } return errorIcon; }
/** * Attempts to load an image from classpath. If this fails, an empty image icon is returned. * * @param resourceName the name of the image. The name should be a global resource name. * @param scale true, if the image should be scaled, false otherwise * @param large true, if the image should be scaled to 24x24, or false for 16x16 * @return the image icon. */ private ImageIcon createIcon( final String resourceName, final boolean scale, final boolean large ) { final URL in = sourceClassLoader.getResource( resourceName ); if ( in == null ) { logger.warn( "Unable to find file in the class path: " + resourceName ); return new ImageIcon( createTransparentImage( 1, 1 ) ); } final Image img = Toolkit.getDefaultToolkit().createImage( in ); if ( img == null ) { logger.warn( "Unable to instantiate the image: " + resourceName ); return new ImageIcon( createTransparentImage( 1, 1 ) ); } if ( scale ) { if ( large ) { return new ImageIcon( img.getScaledInstance( 24, 24, Image.SCALE_SMOOTH ) ); } return new ImageIcon( img.getScaledInstance( 16, 16, Image.SCALE_SMOOTH ) ); } return new ImageIcon( img ); }
progressDialog = createProgressDialog(); if ( report.getTitle() == null ) { progressDialog.setTitle( getResources().getString( "ProgressDialog.EMPTY_TITLE" ) ); } else { progressDialog.setTitle( getResources().formatMessage( "ProgressDialog.TITLE", report.getTitle() ) ); PdfExportPlugin.logger.error( "Failure while preparing the PDF export", e ); //$NON-NLS-1$ getContext().getStatusListener().setStatus( StatusType.ERROR, resources.getString( "PdfExportPlugin.USER_FAILED" ), e ); //$NON-NLS-1$ return false;
/** * DefaultConstructor. */ public PlainTextExportPlugin() { resources = new ResourceBundleSupport( Locale.getDefault(), PlainTextExportGUIModule.BUNDLE_NAME, ObjectUtilities .getClassLoader( PlainTextExportGUIModule.class ) ); }
String name = strictString(key); if (StringUtils.isEmpty(name)) mask |= getMenuKeyMask(); mask = getMenuKeyMask(); return KeyStroke.getKeyStroke(createMnemonic(name).intValue(), mask);
String name = getOptionalString(key); if (StringUtils.isEmpty(name)) mask |= getMenuKeyMask(); mask = getMenuKeyMask(); return KeyStroke.getKeyStroke(createMnemonic(name).intValue(), mask);
/** * Returns the mnemonic stored at the given resourcebundle key. The mnemonic * should be either the symbolic name of one of the KeyEvent.VK_* constants * (without the 'VK_') or the character for that key. * <p/> * For the enter key, the resource bundle would therefore either contain * "ENTER" or "\n". * <pre> * a.resourcebundle.key=ENTER * an.other.resourcebundle.key=\n * </pre> * * @param key the resourcebundle key * @return the mnemonic */ public Integer getMnemonic(final String key) { if (key == null) { throw new NullPointerException(); } final String name = strictString(key); return createMnemonic(name); }
/** * Returns the mnemonic stored at the given resourcebundle key. The mnemonic * should be either the symbolic name of one of the KeyEvent.VK_* constants * (without the 'VK_') or the character for that key. * <p/> * For the enter key, the resource bundle would therefore either contain * "ENTER" or "\n". * <pre> * a.resourcebundle.key=ENTER * an.other.resourcebundle.key=\n * </pre> * * @param key the resourcebundle key * @return the mnemonic or null, if the mnemonic is not defined. */ public Integer getOptionalMnemonic(final String key) { if (key == null) { throw new NullPointerException(); } final String name = getOptionalString(key); if (name != null && name.length() > 0) { return createMnemonic(name); } return INVALID_MNEMONIC; }