X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.modeling.ui%2Fsrc%2Forg%2Fsimantics%2Fmodeling%2Fui%2Factions%2FAssignSymbolGroup.java;h=1c5dea754acb55454e629926a67fe1e790f3f391;hp=aada046df3ce04cbccac48b553f8cb8948a074fa;hb=47269fe0acb894f346810417d950a1ab59cdc0ea;hpb=11309f6516278203264b680235cbbe1dc2bde98e diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/AssignSymbolGroup.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/AssignSymbolGroup.java index aada046df..1c5dea754 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/AssignSymbolGroup.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/AssignSymbolGroup.java @@ -21,6 +21,7 @@ import java.util.Set; import java.util.concurrent.atomic.AtomicReference; import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.dialogs.IDialogConstants; import org.eclipse.jface.dialogs.IInputValidator; import org.eclipse.jface.dialogs.InputDialog; import org.eclipse.jface.dialogs.MessageDialog; @@ -28,6 +29,7 @@ import org.eclipse.jface.viewers.ICheckStateProvider; import org.eclipse.jface.viewers.IStructuredContentProvider; import org.eclipse.jface.viewers.LabelProvider; import org.eclipse.jface.viewers.Viewer; +import org.eclipse.osgi.util.NLS; import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.PlatformUI; import org.simantics.Simantics; @@ -124,9 +126,9 @@ public class AssignSymbolGroup implements ActionFactory, ActionFactory2 { @Override public String toString() { - return getClass().getSimpleName() + "[name=" + name - + ", originally selected=" + originallySelected - + ", selected=" + selected + "]"; + return getClass().getSimpleName() + "[name=" + name //$NON-NLS-1$ + + ", originally selected=" + originallySelected //$NON-NLS-1$ + + ", selected=" + selected + "]"; //$NON-NLS-1$ //$NON-NLS-2$ } } @@ -260,19 +262,16 @@ public class AssignSymbolGroup implements ActionFactory, ActionFactory2 { final Resource model = getCommonModel(symbols); if (model == null) { - ShowMessage.showInformation("Same Model Required", "All the selected symbols must be from within the same model."); + ShowMessage.showInformation(Messages.AssignSymbolGroup_SameModelRequired, Messages.AssignSymbolGroup_SameModelRequiredMsg); return; } final AtomicReference groups = new AtomicReference( getSymbolGroups(symbols) ); - StringBuilder message = new StringBuilder(); - message.append("Select symbol groups the selected "); - if (symbols.size() > 1) - message.append(symbols.size()).append(" symbols are shown in."); - else - message.append("symbol is shown in."); + String message = symbols.size() > 1 + ? NLS.bind(Messages.AssignSymbolGroup_SelectSymbolGroupsTheSelectedSymbolsAreShownIn, symbols.size()) + : Messages.AssignSymbolGroup_SelectSymbolGroupsTheSelectedSymbolIsShownIn; AssignSymbolGroupsDialog dialog = new AssignSymbolGroupsDialog( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), @@ -326,7 +325,7 @@ public class AssignSymbolGroup implements ActionFactory, ActionFactory2 { } } }; - dialog.setTitle("Symbol Group Assignments"); + dialog.setTitle(Messages.AssignSymbolGroup_SymbolGroupAssignments); dialog.setInitialSelections(selectedElements(groups.get())); if (dialog.open() == Dialog.OK) { final ArrayList added = new ArrayList(); @@ -351,18 +350,18 @@ public class AssignSymbolGroup implements ActionFactory, ActionFactory2 { private static SymbolGroup newSymbolGroup(Shell shell, Resource model, final SymbolGroup[] oldGroups) { InputDialog dialog = new InputDialog(shell, - "New Symbol Group", - "Write the name of the new symbol group.", - "NewSymbolGroup", + Messages.AssignSymbolGroup_NewSymbolGroup, + Messages.AssignSymbolGroup_WriteSymbolGroupName, + "NewSymbolGroup", //$NON-NLS-1$ new IInputValidator() { @Override public String isValid(String newText) { newText = newText.trim(); if (newText.isEmpty()) - return "The name must be non-empty."; + return Messages.AssignSymbolGroup_NameMustNotBeEmpty; for (SymbolGroup g : oldGroups) if (newText.equals(g.name)) - return "A symbol group with that name already exists."; + return Messages.AssignSymbolGroup_GroupSymbolAlreadyExists; return null; } } @@ -388,11 +387,11 @@ public class AssignSymbolGroup implements ActionFactory, ActionFactory2 { return false; String message; if (groups.length == 1) - message = "Are you sure you want to remove symbol group '" + groups[0].name + "' ?"; + message = NLS.bind(Messages.AssignSymbolGroup_AreYouSureToRemoveSymbolGroup, groups[0].name ); else - message = "Are you sure you want to remove " + groups.length + " symbol groups?"; + message = NLS.bind(Messages.AssignSymbolGroup_AreYouSureToRemoveSymbolGroup1, groups.length ); MessageDialog dialog = - new MessageDialog(shell, "Confirm removal", null, message, MessageDialog.QUESTION, new String[] { "OK", "Cancel" }, 0); + new MessageDialog(shell, Messages.AssignSymbolGroup_ConfirmRemoval, null, message, MessageDialog.QUESTION, new String[] { IDialogConstants.OK_LABEL , IDialogConstants.CANCEL_LABEL }, 0); if (dialog.open() == Dialog.OK) { Simantics.getSession().asyncRequest(new WriteRequest() { @Override