import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.DirectoryDialog;
import org.eclipse.swt.widgets.Display;
import org.simantics.db.Resource;
import org.simantics.db.exception.DatabaseException;
import org.simantics.db.layer0.adapter.ActionFactory;
+import org.simantics.document.FileDocumentUtil;
import org.simantics.document.ui.Activator;
-import org.simantics.document.ui.graphfile.FileDocumentUtil;
import org.simantics.graphfile.util.GraphFileUtil;
/**
public ExportDocumentFolder(ReadGraph graph, String relationUri, String useResourceNames) throws DatabaseException {
relation = graph.getResource(relationUri);
- this.useResourceNames = useResourceNames.equals("true");
+ this.useResourceNames = useResourceNames.equals("true"); //$NON-NLS-1$
}
@Override
File folder = new File(folderName);
int choice = -1;
if (folder.list().length > 0) {
- MessageDialog messageDialog = new MessageDialog(shell, "Folder export", null, "Selected folder \"" + folderName + "\" is not empty.", MessageDialog.QUESTION, new String[]{"Delete and export","Overwrite","Cancel"}, 2);
+ MessageDialog messageDialog = new MessageDialog(shell, Messages.ExportDocumentFolder_FolderExport, null, NLS.bind(Messages.ExportDocumentFolder_SelectedFolder, folderName), MessageDialog.QUESTION, new String[]{Messages.ExportDocumentFolder_DeleteAndExport,Messages.ExportDocumentFolder_Overwrite, IDialogConstants.CANCEL_LABEL }, 2); //$NON-NLS-3$
choice = messageDialog.open();
if (choice == 2)
return;
File folder;
boolean clear = false;
public ExportJob(Resource resource,File folder, boolean clear) {
- super("Export folder");
+ super(Messages.ExportDocumentFolder_ExportFolder);
this.resource = resource;
this.folder = folder;
this.clear = clear;
@Override
protected IStatus run(IProgressMonitor monitor) {
try {
- monitor.beginTask("Export folder", IProgressMonitor.UNKNOWN);
+ monitor.beginTask(Messages.ExportDocumentFolder_ExportFolder, IProgressMonitor.UNKNOWN);
if (clear) {
GraphFileUtil.clearDirectoryStructure(folder);
monitor.worked(1);
}
FileDocumentUtil.exportDocumentFolder(resource, folder, relation, useResourceNames, monitor);
monitor.done();
- return new Status(IStatus.OK, Activator.PLUGIN_ID, "Folder exported.");
+ return new Status(IStatus.OK, Activator.PLUGIN_ID, Messages.ExportDocumentFolder_ActivatorFolderExported);
} catch (Exception e) {
monitor.done();
- return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Cannot export document folder.", e);
+ return new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.ExportDocumentFolder_AcivatorCannotExport, e);
}
}
}