public class ContentSelectionPage extends WizardPage {
/** Key for preference setting that contains sub-mementos for each content URI. */
- public static final String KEY_FORMAT_SELECTIONS = "org.simantics.modeling.ui.export.wizard.formatSelections";
+ public static final String KEY_FORMAT_SELECTIONS = "org.simantics.modeling.ui.export.wizard.formatSelections"; //$NON-NLS-1$
// UI stuff
LocalResourceManager resourceManager;
List<Content> contentSelection = new ArrayList<Content>();
public ContentSelectionPage(ExportContext ctx) throws ExportException {
- super("Select Content", "Select the PDF Pages and the attachments", null);
+ super(Messages.ContentSelectionPage_SelectContent, Messages.ContentSelectionPage_SelectContentDescription, null);
this.ctx = ctx;
init();
void init() throws ExportException {
try {
- System.out.println("Found Content Types:");
+ System.out.println("Found Content Types:"); //$NON-NLS-1$
for ( ContentType ct : ctx.eep.contentTypes() ) {
- System.out.println(" "+ct);
+ System.out.println(" "+ct); //$NON-NLS-1$
}
System.out.println();
- System.out.println("Exporters:");
+ System.out.println("Exporters:"); //$NON-NLS-1$
for ( Exporter ex : ctx.eep.exporters() ) {
- System.out.println(" "+ex);
+ System.out.println(" "+ex); //$NON-NLS-1$
}
System.out.println();
- System.out.println("Formats:");
+ System.out.println("Formats:"); //$NON-NLS-1$
for ( Format format : ctx.eep.formats() ) {
- System.out.println(" "+format);
+ System.out.println(" "+format); //$NON-NLS-1$
}
System.out.println();
- System.out.println("Discoverers:");
+ System.out.println("Discoverers:"); //$NON-NLS-1$
for ( Discoverer discoverer : ctx.eep.discoverers() ) {
- System.out.println(" "+discoverer);
+ System.out.println(" "+discoverer); //$NON-NLS-1$
}
System.out.println();
- System.out.println("Publishers:");
+ System.out.println("Publishers:"); //$NON-NLS-1$
for ( Publisher publisher : ctx.eep.publishers() ) {
- System.out.println(" "+publisher.id());
+ System.out.println(" "+publisher.id()); //$NON-NLS-1$
}
System.out.println();
// Organize formats by content types - Filter out ContentTypes that don't have exporter and format.
- System.out.println("Mapped ContentTypes to Exporters:");
+ System.out.println("Mapped ContentTypes to Exporters:"); //$NON-NLS-1$
typeToFormatMap = MapList.use( new TreeMap<ContentType, List<Format>>(toStringComparator) );
for ( ContentType ct : ctx.eep.contentTypes() ) {
for ( Exporter exp : ctx.eep.getExportersForContentType( ct.id() ) ) {
Format format = ctx.eep.getFormat( exp.formatId() );
if ( format==null ) continue;
- System.out.println(" "+ct.id()+" -> "+format.fileext());
+ System.out.println(" "+ct.id()+" -> "+format.fileext()); //$NON-NLS-1$ //$NON-NLS-2$
if (!typeToFormatMap.contains(ct, format)) typeToFormatMap.add(ct, format);
}
}
for ( String content : ctx.selection ) {
initialContentHash = 13*initialContentHash + content.hashCode();
}
- initialSelectionKey = "InitialSelection-"+initialContentHash;
+ initialSelectionKey = "InitialSelection-"+initialContentHash; //$NON-NLS-1$
String sel = ctx.store.get(initialSelectionKey, null);
if ( sel != null ) {
initialSelection = ExportWizardResult.parse(sel);
// First time wizard was called with this selection.
// Check in
for ( String contentUri : ctx.selection ) {
- initialSelection.add( new Content(contentUri, null, "all", null, null, null) );
+ initialSelection.add( new Content(contentUri, null, "all", null, null, null) ); //$NON-NLS-1$
}
}
StringBuilder modelsStr = new StringBuilder();
for ( String content : ctx.selection ) {
for ( String model : allModels ) {
- if ( content.equals(model) || content.startsWith(model + "/") ) {
+ if ( content.equals(model) || content.startsWith(model + "/") ) { //$NON-NLS-1$
if ( !selectedModels.contains( model ) ) {
selectedModels.add( model );
- if ( modelsStr.length()>0 ) modelsStr.append(", ");
+ if ( modelsStr.length()>0 ) modelsStr.append(", "); //$NON-NLS-1$
modelsStr.append( model );
}
}
if ( selectedModels.isEmpty() ) selectedModels.addAll( allModels );
// UI labels
labels = new HashMap<String, Map<String, String>>();
- labels.put( "model", ctx.session.syncRequest( ExportQueries.labels( selectedModels ) ) ); // Should Model CT be used for labeling?
+ labels.put( "model", ctx.session.syncRequest( ExportQueries.labels( selectedModels ) ) ); // Should Model CT be used for labeling? //$NON-NLS-1$
// Discover contents
- System.out.println("Discovering content: "+modelsStr);
+ System.out.println("Discovering content: "+modelsStr); //$NON-NLS-1$
content = MapList.use( new TreeMap<ContentType, List<String>>(toStringComparator) );
contentToTypeMap = MapList.use( new TreeMap<String, List<ContentType>>(toStringComparator) );
modelContent = MapList.use( new TreeMap<String, List<String>>() );
for ( ContentType ct : typeToFormatMap.getKeys() ) {
- System.out.println(" "+ct.label());
+ System.out.println(" "+ct.label()); //$NON-NLS-1$
for ( Discoverer discoverer : ctx.eep.getDiscoverers( ct.id() )) {
- System.out.println(" "+discoverer.toString());
+ System.out.println(" "+discoverer.toString()); //$NON-NLS-1$
// Get content Uris
Collection<String> contents = discoverer.discoverContent(ctx, selectedModels);
content.add( ct, contentId );
contentToTypeMap.add(contentId, ct);
//modelContent.add(key)
- System.out.println(" "+contentId);
+ System.out.println(" "+contentId); //$NON-NLS-1$
}
}
Color contentTypeColor = resourceManager.createColor( new RGB(245, 245, 252) );
GridColumn column = new GridColumn(grid,SWT.NONE);
column.setTree(true);
- column.setText("Name");
+ column.setText(Messages.ContentSelectionPage_Name);
column.setWidth(200);
// "Pagees"
assertColumnIndex(1);
- Format pdfFormat = ctx.eep.getFormat("pdf");
+ Format pdfFormat = ctx.eep.getFormat("pdf"); //$NON-NLS-1$
ImageDescriptor folderID = null;
try {
- URL folderUrl = new URL("platform:/plugin/com.famfamfam.silk/icons/folder.png");
+ URL folderUrl = new URL("platform:/plugin/com.famfamfam.silk/icons/folder.png"); //$NON-NLS-1$
folderID = ImageDescriptor.createFromURL( folderUrl );
} catch (MalformedURLException e) {
e.printStackTrace();
if (modelContentType==null) continue;
// Create Model Node
- String modelLabel = labels.get("model").get(modelUri);
+ String modelLabel = labels.get("model").get(modelUri); //$NON-NLS-1$
GridItem modelNode = newLine(grid, modelLabel, modelUri, modelContentType.id());
setIcon(modelNode, 0, modelContentType.icon(modelUri));
modelNode.setToolTipText(0, modelUri);
columnNumber++;
assertColumnIndex( columnNumber );
- contentNode.setText(columnNumber, " "+pdfFormat.fileext());
+ contentNode.setText(columnNumber, " "+pdfFormat.fileext()); //$NON-NLS-1$
contentNode.setGrayed(columnNumber, false);
contentNode.setCheckable(columnNumber, true);
contentNode.setChecked(columnNumber, hasInitialSelection(contentUri, pdfFormat.id()) );
if ( !contentTypesFormats.contains(format) ) contentTypesFormats.add(format);
columnNumber++;
assertColumnIndex( columnNumber );
- contentNode.setText(columnNumber, " "+format.fileext());
+ contentNode.setText(columnNumber, " "+format.fileext()); //$NON-NLS-1$
contentNode.setGrayed(columnNumber, false);
contentNode.setCheckable(columnNumber, true);
contentNode.setChecked(columnNumber, hasInitialSelection(contentUri, format.id()) );
int cc = grid.getColumnCount();
GridColumn column = new GridColumn(grid, SWT.CHECK);
- column.setText( cc==1?"Pages":"Attachments");
+ column.setText( cc==1?Messages.ContentSelectionPage_Pages:Messages.ContentSelectionPage_Attachments);
column.setWidth( cc==1?150:200 );
for (GridItem gi : grid.getItems()) {
boolean hasInitialSelection(String uri, String formatId) {
for (Content c : initialSelection) {
if ( !c.url.equals( uri ) ) continue;
- if ( c.formatId.equals("all") || c.formatId.equals(formatId) ) return true;
+ if ( c.formatId.equals("all") || c.formatId.equals(formatId) ) return true; //$NON-NLS-1$
}
return false;
}