import java.util.List;
import java.util.Stack;
+import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.widgets.Display;
import org.simantics.Simantics;
import org.simantics.db.ReadGraph;
public void run() {
System.out.println(target);
try {
- Pair<Collection<Resource>, Collection<Resource>> refs = Simantics.getSession().syncRequest(new FindFixable(target));
- String dialogTitle = "Fix References";
- String dialogMessage = "Fix " + refs.first.size() + " old references and " + refs.second.size() + " removed references?";
- String dialogButtonLabels[] = new String[]{"Ok","Cancel"};
+ Pair<Collection<Resource>, Collection<Resource>> refs = Simantics.getSession()
+ .syncRequest(new FindFixable(target));
+ String dialogTitle = Messages.FixAllReferencesAction_FixReferences;
+ String dialogMessage = NLS.bind(Messages.FixAllReferencesAction_FixOldReferences,
+ new Object[] { refs.first.size(), refs.second.size() });
+ String dialogButtonLabels[] = new String[] { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL };
int defaultIndex = 0;
if (refs.first.size() == 0 && refs.second.size() == 0) {
- dialogMessage = "Nothing to fix.";
- dialogButtonLabels = new String[]{"OK"};
- MessageDialog dialog = new MessageDialog(Display.getCurrent().getActiveShell(), dialogTitle, null, dialogMessage, MessageDialog.CONFIRM, dialogButtonLabels, defaultIndex);
+ dialogMessage = Messages.FixAllReferencesAction_NothingToFix;
+ dialogButtonLabels = new String[] { IDialogConstants.OK_LABEL };
+ MessageDialog dialog = new MessageDialog(Display.getCurrent().getActiveShell(), dialogTitle,
+ null, dialogMessage, MessageDialog.CONFIRM, dialogButtonLabels, defaultIndex);
dialog.open();
return;
}
- MessageDialog dialog = new MessageDialog(Display.getCurrent().getActiveShell(), dialogTitle, null, dialogMessage, MessageDialog.CONFIRM, dialogButtonLabels, defaultIndex);
+ MessageDialog dialog = new MessageDialog(Display.getCurrent().getActiveShell(), dialogTitle, null,
+ dialogMessage, MessageDialog.CONFIRM, dialogButtonLabels, defaultIndex);
if (dialog.open() != 0)
return;
Simantics.getSession().markUndoPoint();
Simantics.getSession().syncRequest(new FixAll(refs));
} catch (DatabaseException e) {
- ExceptionUtils.logAndShowError("Cannot fix references", e);
+ ExceptionUtils.logAndShowError(Messages.FixAllReferencesAction_CannotFixReferences, e);
}
}
};