@Override
public void run() {
-
SegmentationContext ctx = window.getContext();
List<SegmentationMask> masks = ctx.getSegmentationMasks();
if (ctx.hasSegmentationMasks()) {
// Get options from user
ExportDialog dialog = new ExportDialog(window.getShell());
ExportDialog.Result result = dialog.open();
-
if (result != null) {
-
// Grab image and mask
BufferedImage image = ImageConverter.convert(ctx.getImageData());
exporter.setHtmlFile(result.html);
// Taking html file name and making the same as filename of imagemap
- int dotIndex = result.image.indexOf('.');
- String zipFile = result.image.substring(0, dotIndex);
+ int dotIndex = result.zipFile.indexOf('.');
+ String zipFile = result.zipFile.substring(0, dotIndex);
+ System.out.println("Zip file name is : "+zipFile);
exporter.setZipFile(zipFile+IMGMAP_EXTENSION);
exporter.setImageFile(result.image);
public class Result {
public final File folder;
public final String html;
+ public final String zipFile;
public final String image;
public final String link;
public final String description;
folder = new File(folderText.getText().trim());
//html = htmlText.getText().trim();
html = "imagemap.html";
- image = imageText.getText().trim();
+ zipFile = zipFileName.getText().trim();
+ image = "image";
link = linkText.getText().trim();
description = descriptionText.getText();
shape = getShape();
private Text folderText;
private Button browseButton;
private Text htmlText;
+ private Text zipFileName;
private Text imageText;
private Text linkText;
private Button effectCheck;
label(widgets, "Export folder:");
folderText = text(widgets, "");
browseButton = button(widgets, "Browse...");
- //label(widgets, "HTML file name:");
- //htmlText = text(widgets, "imagemap.html");
+ label(widgets, "Target zip file name:");
+ zipFileName = text(widgets, "annotated");
+ label(widgets, ".zip");
//spacer(widgets);
- label(widgets, "File name:");
+ /*label(widgets, "File name:");
imageText = text(widgets, "image");
- spacer(widgets);
+ spacer(widgets);*/
hline(widgets);
label(widgets, "Export shape:");
shapeRadios = radios(widgets, SHAPES);
return false;
}
- /*String htmlFile = htmlText.getText().trim();
- if (htmlFile.equals("")) {
+ String zipFile = zipFileName.getText().trim();
+ if (zipFile.equals("")) {
validationError("The HTML file name cannot be empty");
- htmlText.setFocus();
+ zipFileName.setFocus();
return false;
- }*/
+ }
- String imageFile = imageText.getText().trim();
+ /*String imageFile = imageText.getText().trim();
if (imageFile.equals("")) {
validationError("The image file name cannot be empty");
imageText.setFocus();
return false;
- }
+ }*/
return true;
}