import org.eclipse.jface.window.Window;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CCombo;
import org.eclipse.swt.events.ModifyEvent;
import org.simantics.db.WriteGraph;
import org.simantics.db.common.NamedResource;
import org.simantics.db.common.request.ObjectsWithType;
-import org.simantics.db.common.request.ReadRequest;
import org.simantics.db.common.request.UnaryRead;
import org.simantics.db.common.request.UniqueRead;
import org.simantics.db.common.request.WriteResultRequest;
this.initial = initial;
- setWindowTitle("Perform migration");
+ setWindowTitle(Messages.MigrateWizard_PerformMigration);
setNeedsProgressMonitor(true);
setForcePreviousAndNextButtons(false);
setDialogSettings(Activator.getDefault().getDialogSettings());
- prefnode = InstanceScope.INSTANCE.getNode( "org.simantics.modeling.ui.wizard.MigrateWizard" );
+ prefnode = InstanceScope.INSTANCE.getNode( "org.simantics.modeling.ui.wizard.MigrateWizard" ); //$NON-NLS-1$
}
graph.markUndoPoint();
String report = UserComponentMigration.doMigration(mon.newChild(500, SubMonitor.SUPPRESS_NONE), graph, result);
UserComponentMigration.doPostMigration(mon.newChild(500, SubMonitor.SUPPRESS_NONE), graph, result);
- mon.setTaskName("Committing Changes");
- mon.subTask("");
+ mon.setTaskName(Messages.MigrateWizard_MonitorCommitingChanges);
+ mon.subTask(""); //$NON-NLS-1$
return report;
}
});
Throwable cause = e.getCause();
if (!(cause instanceof CancelTransactionException || cause instanceof OperationCanceledException)) {
Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
- "Migration failed, see Error Log for details.", e.getCause()));
+ Messages.MigrateWizard_ActivatorMigrationFailed, e.getCause()));
}
} catch (InterruptedException e) {
Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
- "Migration interrupted, see Error Log for details.", e));
+ Messages.MigrateWizard_ActivatorMigrationInterrupted, e));
}
return false;
}
public ReportDialog(Shell shell, String report, int width, int height) {
super(shell,
- "Migration report", null,
- "",
- MessageDialog.INFORMATION, new String[] { "Continue" }, 0);
+ Messages.MigrateWizard_MigrationReport, null,
+ "", //$NON-NLS-1$
+ MessageDialog.INFORMATION, new String[] { Messages.MigrateWizard_Continue }, 0);
this.report = report;
this.initialWidth = width;
this.initialHeight = height;
String previouslySelectedLocationId = null;
public MigratePage(String initial) {
- super("Perform migration", "Perform migration", null);
+ super(Messages.MigrateWizard_PerformMigration, Messages.MigrateWizard_PerformMigration, null);
this.initial = initial;
}
container.setLayout(layout);
}
- new Label(container, SWT.NONE).setText("&Source:");
+ new Label(container, SWT.NONE).setText(Messages.MigrateWizard_SourceAnd);
source = new Text(container, SWT.BORDER);
source.setText(initial);
source.addModifyListener(new ModifyListener() {
GridDataFactory.fillDefaults().grab(true, false).span(8, 1).applyTo(source);
browseSource = new Button(container, SWT.NONE);
- browseSource.setText("&Browse");
+ browseSource.setText(Messages.MigrateWizard_BrowseAnd);
GridDataFactory.fillDefaults().grab(false, false).applyTo(browseSource);
browseSource.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e_) {
try {
Map<String, Pair<String, ImageDescriptor>> map = Simantics.getSession().syncRequest(new BrowseSourceContentRequest(target.getText()));
- String uri = queryTargetSelection("Select Source Type", map);
+ String uri = queryTargetSelection(Messages.MigrateWizard_SelectSourceType, map);
if (uri != null)
source.setText(uri);
} catch (DatabaseException e) {
}
});
- new Label(container, SWT.NONE).setText("&Target:");
+ new Label(container, SWT.NONE).setText(Messages.MigrateWizard_TargetAnd);
target = new Text(container, SWT.BORDER);
target.setText(initial);
target.addModifyListener(new ModifyListener() {
GridDataFactory.fillDefaults().grab(true, false).span(8, 1).applyTo(target);
browseTarget = new Button(container, SWT.NONE);
- browseTarget.setText("B&rowse");
+ browseTarget.setText(Messages.MigrateWizard_BrowseAnd1);
GridDataFactory.fillDefaults().grab(false, false).applyTo(browseTarget);
browseTarget.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e_) {
try {
Map<String, Pair<String, ImageDescriptor>> map = Simantics.getSession().syncRequest(new BrowseTargetContentRequest(source.getText()));
- String uri = queryTargetSelection("Select Target Type", map);
+ String uri = queryTargetSelection(Messages.MigrateWizard_SelectTargetType, map);
if (uri != null)
target.setText(uri);
} catch (DatabaseException e) {
});
symbolsLabel = new Label(container, SWT.NONE);
- symbolsLabel.setText("Target &symbol:");
+ symbolsLabel.setText(Messages.MigrateWizard_TargetAndSymbol);
GridDataFactory.fillDefaults().applyTo(symbolsLabel);
symbols = new CCombo(container, SWT.BORDER | SWT.READ_ONLY);
instanceLabel = new Label(container, SWT.NONE);
GridDataFactory.fillDefaults().grab(true, false).span(10, 1).applyTo(instanceLabel);
- instanceLabel.setText("");
+ instanceLabel.setText(""); //$NON-NLS-1$
locationsLabel = new Label(container, SWT.NONE);
- locationsLabel.setText("&Locations:");
+ locationsLabel.setText(Messages.MigrateWizard_LocationAnd);
locations = new CCombo(container, SWT.BORDER | SWT.READ_ONLY);
locations.setVisibleItemCount(25);
locations.addSelectionListener(new SelectionAdapter() {
GridDataFactory.fillDefaults().grab(true, false).span(9, 1).applyTo(locations);
instancesLabel = new Label(container, SWT.NONE);
- instancesLabel.setText("&Select instances to migrate:");
+ instancesLabel.setText(Messages.MigrateWizard_SelectInstancesToMigrate);
GridDataFactory.fillDefaults().grab(true, false).span(10, 1).applyTo(instancesLabel);
buttonBar = new Composite(container, SWT.NONE);
RowLayoutFactory.fillDefaults().type(SWT.HORIZONTAL).applyTo(buttonBar);
GridDataFactory.fillDefaults().grab(true, false).span(10, 1).applyTo(buttonBar);
Button selectAll = new Button(buttonBar, SWT.PUSH);
- selectAll.setText("Select &All");
+ selectAll.setText(Messages.MigrateWizard_SelectAllAnd);
Button selectNone = new Button(buttonBar, SWT.PUSH);
- selectNone.setText("Select &None");
+ selectNone.setText(Messages.MigrateWizard_SelectNoneAnd);
selectAll.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
});
symbols.removeAll();
- symbols.add("<retain symbol name>");
+ symbols.add(Messages.MigrateWizard_RetainSymbolName);
for(NamedResource nr : syms) {
symbols.add(nr.getName());
}
int preSelect = -1, i = 0;
for (Triple<String,NamedResource,Collection<MigrationOperation>> r : model.instances) {
- locations.add(r.second.getName() + " (" + r.third.size() + " instances)");
+ locations.add(NLS.bind(Messages.MigrateWizard_LocationInstance, r.second.getName(), r.third.size()));
if (r.first.equals(previouslySelectedLocationId))
preSelect = i;
if (preSelect < 0 && model.activeModels.contains(r.second.getResource()))
++i;
}
if (locations.getItemCount() == 0) {
- locations.add("<no instances were found>");
+ locations.add(Messages.MigrateWizard_NoInstancesFound);
locations.select(0);
} else {
locations.select(preSelect > -1 ? preSelect : 0);
void refreshInstances() {
int toMigrate = 0;
- for(Triple<String,NamedResource,Collection<MigrationOperation>> pair : model.instances) {
+ for (Triple<String, NamedResource, Collection<MigrationOperation>> pair : model.instances) {
toMigrate += pair.third.size();
}
- if(model.instanceCount == 0)
- instanceLabel.setText("No instances were found.");
- else if(model.instanceCount == 1) {
- if(toMigrate == 1) {
- instanceLabel.setText("1 migratable instance found.");
+ if (model.instanceCount == 0)
+ instanceLabel.setText(Messages.MigrateWizard_NoInstancesWereFound);
+ else if (model.instanceCount == 1) {
+ if (toMigrate == 1) {
+ instanceLabel.setText(Messages.MigrateWizard_OneMigratableInstanceFound);
} else {
- instanceLabel.setText("1 instance found, but it cannot be migrated with current settings.");
+ instanceLabel.setText(Messages.MigrateWizard_InstanceFoundCannotBeMigrated);
}
} else {
- if(toMigrate < model.instanceCount) {
- if(toMigrate == 0) {
- instanceLabel.setText(model.instanceCount + " instances were found. None of them can be migrated with current settings.");
+ if (toMigrate < model.instanceCount) {
+ if (toMigrate == 0) {
+ instanceLabel
+ .setText(NLS.bind(Messages.MigrateWizard_NumberOfInstancesFound, model.instanceCount));
} else {
- instanceLabel.setText(model.instanceCount + " instances were found. " + (model.instanceCount-toMigrate) + " of them cannot be migrated with current settings.");
+ instanceLabel.setText(NLS.bind(Messages.MigrateWizard_InstancesWereFound, model.instanceCount,
+ (model.instanceCount - toMigrate)));
}
} else {
- instanceLabel.setText(model.instanceCount + " migratable instances found. ");
+ instanceLabel
+ .setText(NLS.bind(Messages.MigrateWizard_MigratableInstancesFound, model.instanceCount));
}
}
if (model == null)
return;
- if(toMigrate == 0) {
+ if (toMigrate == 0) {
locationsLabel.setVisible(false);
locations.setVisible(false);
GridDataFactory.fillDefaults().exclude(true).applyTo(locationsLabel);
GridDataFactory.fillDefaults().grab(true, false).span(9, 1).applyTo(locations);
}
- if(!model.instances.isEmpty()) {
+ if (!model.instances.isEmpty()) {
int locationIndex = locations.getSelectionIndex();
- if(locationIndex == -1) return;
+ if (locationIndex == -1)
+ return;
model.sortedShownInstances = new ArrayList<>();
- for(MigrationOperation o : model.instances.get(locationIndex).third)
+ for (MigrationOperation o : model.instances.get(locationIndex).third)
model.sortedShownInstances.add(o);
Collections.sort(model.sortedShownInstances, MIGRATION_OP_COMPARATOR);
- for(MigrationOperation o : model.sortedShownInstances) {
+ for (MigrationOperation o : model.sortedShownInstances) {
String uri = o.toString();
- uri = uri.replace("http://Projects/Development%20Project/", "");
+ uri = uri.replace("http://Projects/Development%20Project/", ""); //$NON-NLS-1$ //$NON-NLS-2$
uri = URIStringUtils.unescape(uri);
instances.add(uri);
}
}
- if(model.sortedShownInstances.isEmpty()) {
+ if (model.sortedShownInstances.isEmpty()) {
instancesLabel.setVisible(false);
instances.setVisible(false);
buttonBar.setVisible(false);