import java.util.regex.Pattern;
import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.ScrolledComposite;
import org.eclipse.swt.layout.GridData;
*/
public class OptionsPage extends WizardPage {
- public static String S_OUTPUT_OPTIONS = "Output Options";
+ public static String S_OUTPUT_OPTIONS = Messages.OptionsPage_OutputOptions;
public static LabelReference P_OUTPUT_OPTIONS = new LabelReference( S_OUTPUT_OPTIONS );
/** A reference to combo box selection */
- public static String S_PUBLISH = "Publish to";
+ public static String S_PUBLISH = Messages.OptionsPage_PublishTo;
public static ChildReference P_PUBLISH = ChildReference.compile(P_OUTPUT_OPTIONS, new LabelReference(S_PUBLISH));
ExportContext ctx;
String selectedPublisherId;
public OptionsPage(ExportContext ctx) throws ExportException {
- super("Options page", "Select export options", null);
+ super(Messages.OptionsPage_OptionsPage, Messages.OptionsPage_SelectExportOptions, null);
this.ctx = ctx;
}
public void handleEvent(Event event) {
updatingForm = true;
try {
- Preferences contentScopePrefs = ctx.store.node( "Selection-"+selectionHash );
+ Preferences contentScopePrefs = ctx.store.node( "Selection-"+selectionHash ); //$NON-NLS-1$
Preferences workspaceScopePrefs = ctx.store;
Composite outputOptions = (Composite) form.getControl(composite, P_OUTPUT_OPTIONS);
updatingForm = false;
validate();
} catch ( BindingException e ) {
- setErrorMessage( e.getClass().getName()+": "+ e.getMessage() );
+ setErrorMessage( e.getClass().getName()+": "+ e.getMessage() ); //$NON-NLS-1$
ExceptionUtils.logError(e);
} catch (AccessorConstructionException e) {
- setErrorMessage( e.getClass().getName()+": "+ e.getMessage() );
+ setErrorMessage( e.getClass().getName()+": "+ e.getMessage() ); //$NON-NLS-1$
ExceptionUtils.logError(e);
} catch (AccessorException e) {
- setErrorMessage( e.getClass().getName()+": "+ e.getMessage() );
+ setErrorMessage( e.getClass().getName()+": "+ e.getMessage() ); //$NON-NLS-1$
ExceptionUtils.logError(e);
} catch (ExportException e) {
- setErrorMessage( e.getClass().getName()+": "+ e.getMessage() );
+ setErrorMessage( e.getClass().getName()+": "+ e.getMessage() ); //$NON-NLS-1$
ExceptionUtils.logError(e);
} finally {
updatingForm = false;
for ( Format format : formats ) {
if ( format.isGroupFormat() && contentByFormat.getValues(format).size()>1 ) {
- outputOptions.addComponent("Merge "+format.fileext()+" content into one file", Datatypes.BOOLEAN);
+ outputOptions.addComponent(NLS.bind(Messages.OptionsPage_Merge, format.fileext()), Datatypes.BOOLEAN); //$NON-NLS-2$
}
if ( format.isContainerFormat() ) {
}
if ( attachmentCount > 0 ) {
- outputOptions.addComponent("Include attachments to "+format.fileext(), Datatypes.BOOLEAN);
- outputOptions.addComponent("Export attachments of "+format.fileext()+" to separate files", Datatypes.BOOLEAN);
+ outputOptions.addComponent(NLS.bind(Messages.OptionsPage_IncludeAttachmentTo, format.fileext()), Datatypes.BOOLEAN);
+ outputOptions.addComponent(NLS.bind(Messages.OptionsPage_ExportAttachmentOf, format.fileext()), Datatypes.BOOLEAN);
}
}
}
{
selection = contents;
Preferences workspaceScopePrefs = ctx.store;
- Preferences contentScopePrefs = ctx.store.node( "Selection-"+selectionHash );
- selectedPublisherId = ctx.store.get("publisherId", "");
+ Preferences contentScopePrefs = ctx.store.node( "Selection-"+selectionHash ); //$NON-NLS-1$
+ selectedPublisherId = ctx.store.get("publisherId", ""); //$NON-NLS-1$ //$NON-NLS-2$
Publisher publisher = ctx.eep.getPublisher(selectedPublisherId);
if ( publisher != null ) {
} catch (BindingException e) {
ExceptionUtils.logError(e);
- ShowMessage.showError("Unexpected error", e.getClass().getName()+" "+e.getMessage());
+ ShowMessage.showError(Messages.OptionsPage_UnExpectedError, e.getClass().getName()+" "+e.getMessage()); //$NON-NLS-2$
throw new RuntimeBindingException(e);
} catch (ExportException e) {
ExceptionUtils.logError(e);
- ShowMessage.showError("Unexpected error", e.getClass().getName()+" "+e.getMessage());
+ ShowMessage.showError(Messages.OptionsPage_UnExpectedError, e.getClass().getName()+" "+e.getMessage()); //$NON-NLS-2$
} catch (DatatypeConstructionException e) {
ExceptionUtils.logError(e);
- ShowMessage.showError("Unexpected error", e.getClass().getName()+" "+e.getMessage());
+ ShowMessage.showError(Messages.OptionsPage_UnExpectedError, e.getClass().getName()+" "+e.getMessage()); //$NON-NLS-2$
} catch (AccessorConstructionException e) {
ExceptionUtils.logError(e);
- ShowMessage.showError("Unexpected error", e.getClass().getName()+" "+e.getMessage());
+ ShowMessage.showError(Messages.OptionsPage_UnExpectedError, e.getClass().getName()+" "+e.getMessage()); //$NON-NLS-2$
} catch (AccessorException e) {
ExceptionUtils.logError(e);
// TODO Auto-generated catch block
result.accessor = Accessors.getAccessor(result.options);
result.contents = selection;
result.type = (RecordType) options.type();
- result.publisherId = "file";
+ result.publisherId = "file"; //$NON-NLS-1$
List<ExportAction> actions = new ArrayList<ExportAction>();
List<Content> manifest = new ArrayList<Content>();
String publisherLabel = ExporterUtils.getUnionValue(result.accessor, P_PUBLISH);
Publisher publisher = ctx.eep.getPublisherByLabel(publisherLabel);
- result.publisherId = publisher==null?"":publisher.id();
+ result.publisherId = publisher==null?"":publisher.id(); //$NON-NLS-1$
} catch (BindingException e) {
throw new ExportException(e);
}
- setErrorMessage( errs.isEmpty() ? null : CollectionUtils.toString(errs, ", ") );
+ setErrorMessage( errs.isEmpty() ? null : CollectionUtils.toString(errs, ", ") ); //$NON-NLS-1$
setPageComplete( errs.isEmpty() );
}
RecordAccessor ra = Accessors.getAccessor(options);
String publisherId = ExporterUtils.getUnionValue(ra, P_PUBLISH);
Publisher publisher = ctx.eep.getPublisherByLabel(publisherId);
- if ( publisher!=null ) workspaceScopePrefs.put("publisherId", publisher.id());
+ if ( publisher!=null ) workspaceScopePrefs.put("publisherId", publisher.id()); //$NON-NLS-1$
if ( ra.type().hasComponent(P_OUTPUT_OPTIONS.label) ) {
RecordAccessor rao = ra.getComponent( P_OUTPUT_OPTIONS );
- Pattern merge_pattern = Pattern.compile("Merge ([^\\s]*) content into one file");
- Pattern include_pattern = Pattern.compile("Include attachments to ([^\\s]*)");
- Pattern export_pattern = Pattern.compile("Export attachments of ([^\\s]*) to separate files");
+ Pattern merge_pattern = Pattern.compile("Merge ([^\\s]*) content into one file"); //$NON-NLS-1$
+ Pattern include_pattern = Pattern.compile("Include attachments to ([^\\s]*)"); //$NON-NLS-1$
+ Pattern export_pattern = Pattern.compile("Export attachments of ([^\\s]*) to separate files"); //$NON-NLS-1$
for (int i=0; i<rao.count(); i++) {
String name = rao.type().getComponent(i).name;
String fileExt = m.group(1);
Format format = ctx.eep.getFormatByExt(fileExt);
Boolean value = (Boolean) rao.getFieldValue(i, Bindings.BOOLEAN);
- String key = format.id()+"_merge";
+ String key = format.id()+"_merge"; //$NON-NLS-1$
contentScopePrefs.putBoolean(key, value);
workspaceScopePrefs.putBoolean(key, value);
}
String fileExt = m.group(1);
Format format = ctx.eep.getFormatByExt(fileExt);
Boolean value = (Boolean) rao.getFieldValue(i, Bindings.BOOLEAN);
- String key = format.id()+"_include_attachments";
+ String key = format.id()+"_include_attachments"; //$NON-NLS-1$
contentScopePrefs.putBoolean(key, value);
workspaceScopePrefs.putBoolean(key, value);
}
String fileExt = m.group(1);
Format format = ctx.eep.getFormatByExt(fileExt);
Boolean value = (Boolean) rao.getFieldValue(i, Bindings.BOOLEAN);
- String key = format.id()+"_export_attachments";
+ String key = format.id()+"_export_attachments"; //$NON-NLS-1$
contentScopePrefs.putBoolean(key, value);
workspaceScopePrefs.putBoolean(key, value);
}
//Preferences workspaceScopePrefs = ctx.store;
try {
RecordAccessor ra = Accessors.getAccessor(options);
- String publisherId = workspaceScopePrefs.get("publisherId", "");
+ String publisherId = workspaceScopePrefs.get("publisherId", ""); //$NON-NLS-1$ //$NON-NLS-2$
Publisher publisher = ctx.eep.getPublisher(publisherId);
if ( publisher != null ) ExporterUtils.setUnionValue(ra, P_PUBLISH, publisher.label());
for (Format format : ctx.eep.formats()) {
if ( format.isGroupFormat() ) {
- String key = format.id()+"_merge";
+ String key = format.id()+"_merge"; //$NON-NLS-1$
Boolean value = null;
if ( containsKey(contentScopePrefs, key) ) {
value = contentScopePrefs.getBoolean(key, false);
}
if ( value != null ) {
- String key2 = "Merge "+format.fileext()+" content into one file";
+ String key2 = "Merge "+format.fileext()+" content into one file"; //$NON-NLS-1$ //$NON-NLS-2$
int index = rao.type().getComponentIndex2(key2);
if ( index>=0 ) {
rao.setFieldValue(index, Bindings.BOOLEAN, value);
}
if ( format.isContainerFormat() ) {
- String key = format.id()+"_include_attachments";
+ String key = format.id()+"_include_attachments"; //$NON-NLS-1$
Boolean value = null;
if ( containsKey(contentScopePrefs, key) ) {
value = contentScopePrefs.getBoolean(key, false);
}
if ( value != null ) {
- String key2 = "Include attachments to "+format.fileext();
+ String key2 = "Include attachments to "+format.fileext(); //$NON-NLS-1$
int index = rao.type().getComponentIndex2(key2);
if ( index>=0 ) {
rao.setFieldValue(index, Bindings.BOOLEAN, value);
}
if ( format.isContainerFormat() ) {
- String key = format.id()+"_export_attachments";
+ String key = format.id()+"_export_attachments"; //$NON-NLS-1$
Boolean value = null;
if ( containsKey(contentScopePrefs, key) ) {
value = contentScopePrefs.getBoolean(key, false);
}
if ( value != null ) {
- String key2 = "Export attachments of "+format.fileext()+" to separate files";
+ String key2 = "Export attachments of"+format.fileext()+" to separate files"; //$NON-NLS-2$
int index = rao.type().getComponentIndex2(key2);
if ( index>=0 ) {
rao.setFieldValue(index, Bindings.BOOLEAN, value);
public void savePrefs() throws ExportException {
try {
int oldSelectionHash = selectionHash;
- Preferences contentScopePrefs = ctx.store.node( "Selection-"+oldSelectionHash );
+ Preferences contentScopePrefs = ctx.store.node( "Selection-"+oldSelectionHash ); //$NON-NLS-1$
Preferences workspaceScopePrefs = ctx.store;
RecordBinding binding = ctx.databoard.getMutableBinding( form.type() );
for (Format format : ctx.eep.formats()) {
if ( format.isContainerFormat() ) {
- String key = "Include attachments to "+format.fileext();
+ String key = "Include attachments to "+format.fileext(); //$NON-NLS-1$
int index = rao.type().getComponentIndex2(key);
if ( index>=0 ) rao.setFieldValue(index, Bindings.BOOLEAN, true);
- key = "Export attachments of "+format.fileext()+" to separate files";;
+ key = "Export attachments of "+format.fileext()+" to separate files";; //$NON-NLS-1$ //$NON-NLS-2$
index = rao.type().getComponentIndex2(key);
if ( index>=0 ) rao.setFieldValue(index, Bindings.BOOLEAN, true);
}