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%2FModeledActions.java;h=e189d752daa85b89dc2fca8c33abbc604fec9c93;hp=478d8b761046177484db3ecbc02643ada1801feb;hb=47269fe0acb894f346810417d950a1ab59cdc0ea;hpb=11309f6516278203264b680235cbbe1dc2bde98e diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/ModeledActions.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/ModeledActions.java index 478d8b761..e189d752d 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/ModeledActions.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/ModeledActions.java @@ -33,6 +33,7 @@ import org.eclipse.jface.action.ActionContributionItem; import org.eclipse.jface.action.IContributionItem; import org.eclipse.jface.action.MenuManager; import org.eclipse.jface.action.Separator; +import org.eclipse.osgi.util.NLS; import org.simantics.browsing.ui.NodeContext; import org.simantics.browsing.ui.common.NodeContextBuilder; import org.simantics.browsing.ui.model.InvalidContribution; @@ -45,7 +46,6 @@ import org.simantics.issues.common.IssueUtils; import org.simantics.modeling.ui.Activator; import org.simantics.project.ontology.ProjectResource; import org.simantics.ui.contribution.DynamicMenuContribution; -import org.simantics.ui.selection.WorkbenchSelectionElement; import org.simantics.ui.selection.WorkbenchSelectionUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -81,12 +81,12 @@ public class ModeledActions extends DynamicMenuContribution implements IExecutab public void setInitializationData(IConfigurationElement config, String propertyName, Object data) throws CoreException { if(data instanceof String) { String str = (String)data; - String[] parms = str.split(";"); + String[] parms = str.split(";"); //$NON-NLS-1$ for(String parm : parms) { - String[] keyValue = parm.split("="); + String[] keyValue = parm.split("="); //$NON-NLS-1$ if(keyValue.length == 2) { String key = keyValue[0].trim(); - if("context".equals(key)) { + if("context".equals(key)) { //$NON-NLS-1$ browseContexts = Collections.singleton(keyValue[1]); } } @@ -126,7 +126,7 @@ public class ModeledActions extends DynamicMenuContribution implements IExecutab result.add(NodeContextBuilder.buildWithInput(res)); } } catch (DatabaseException e) { - LOGGER.error("Failed to get node contexts for selection.", e); + LOGGER.error("Failed to get node contexts for selection.", e); //$NON-NLS-1$ } } @@ -160,7 +160,7 @@ public class ModeledActions extends DynamicMenuContribution implements IExecutab if (first) first = false; else - items.add(new Separator(category == null ? "" : category.getLabel())); + items.add(new Separator(category == null ? "" : category.getLabel())); //$NON-NLS-1$ for (Action action : actions) items.add(new ActionContributionItem(action)); } @@ -176,10 +176,8 @@ public class ModeledActions extends DynamicMenuContribution implements IExecutab } @Override - protected IContributionItem[] getContributionItems(ReadGraph graph, Object[] selection) - throws DatabaseException - { - List contexts = Arrays.asList( (NodeContext[]) selection ); + protected IContributionItem[] getContributionItems(ReadGraph graph, Object[] selection) throws DatabaseException { + List contexts = Arrays.asList((NodeContext[]) selection); if (contexts.isEmpty()) return NONE; @@ -200,24 +198,26 @@ public class ModeledActions extends DynamicMenuContribution implements IExecutab result = new HashMap<>(); - for(Map.Entry> entry : m.entrySet()) { + for (Map.Entry> entry : m.entrySet()) { List exist = current.get(entry.getKey()); if (exist == null) continue; ArrayList l = new ArrayList(); - for(Action e : exist) { + for (Action e : exist) { String id = e.getId(); boolean found = false; - for(Action a : entry.getValue()) { - if(id.equals(a.getId())) { + for (Action a : entry.getValue()) { + if (id.equals(a.getId())) { found = true; break; } } - if(found) l.add(e); + if (found) + l.add(e); } - if(!l.isEmpty()) result.put(entry.getKey(), l); + if (!l.isEmpty()) + result.put(entry.getKey(), l); } current = result; @@ -228,7 +228,9 @@ public class ModeledActions extends DynamicMenuContribution implements IExecutab } catch (InvalidContribution e) { Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, - "Invalid contribution encountered in " + getClass().getSimpleName() + ".", e)); + NLS.bind(Messages.ModeledActions_ActivatorInvalidContributionsEncounteredIn, + getClass().getSimpleName()), + e)); } return NONE; }