X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.ui%2Fsrc%2Forg%2Fsimantics%2Fui%2Fworkbench%2Feditor%2FEditorAdapterDescriptorImpl.java;fp=bundles%2Forg.simantics.ui%2Fsrc%2Forg%2Fsimantics%2Fui%2Fworkbench%2Feditor%2FEditorAdapterDescriptorImpl.java;h=01437631f7720695ac6a0bb49dc2197694e2d543;hb=0ae2b770234dfc3cbb18bd38f324125cf0faca07;hp=b324788203bbbe9dde13914817bc417aad201c7c;hpb=24e2b34260f219f0d1644ca7a138894980e25b14;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.ui/src/org/simantics/ui/workbench/editor/EditorAdapterDescriptorImpl.java b/bundles/org.simantics.ui/src/org/simantics/ui/workbench/editor/EditorAdapterDescriptorImpl.java index b32478820..01437631f 100644 --- a/bundles/org.simantics.ui/src/org/simantics/ui/workbench/editor/EditorAdapterDescriptorImpl.java +++ b/bundles/org.simantics.ui/src/org/simantics/ui/workbench/editor/EditorAdapterDescriptorImpl.java @@ -1,84 +1,84 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Association for Decentralized Information Management - * in Industry THTH ry. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * VTT Technical Research Centre of Finland - initial API and implementation - *******************************************************************************/ -package org.simantics.ui.workbench.editor; - -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; - - -public class EditorAdapterDescriptorImpl implements EditorAdapterDescriptor { - - private final String id; - - private final String groupId; - - private final EditorAdapter adapter; - - /** - * Null if there is no context limitation - */ - private final String[] inContexts; - - public EditorAdapterDescriptorImpl(String id, String groupId, EditorAdapter adapter, String[] inContexts) { - this.id = id; - if (groupId != null && groupId.isEmpty()) - groupId = null; - this.groupId = groupId; - this.adapter = adapter; - if (inContexts != null && inContexts.length == 0) - inContexts = null; - this.inContexts = inContexts; - } - - @Override - public String getId() { - return id; - } - - @Override - public String getGroupId() { - return groupId; - } - - @Override - public EditorAdapter getAdapter() { - return adapter; - } - - @Override - public Collection getInContexts() { - if (inContexts == null) - return Collections.emptyList(); - return Arrays.asList(inContexts); - } - - @Override - public boolean isActive(Collection activeContextIds) { - // null indicates perpetually active - if (inContexts == null) - return true; - - for (Object o : inContexts) - if (activeContextIds.contains(o)) - return true; - return false; - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append(EditorAdapterDescriptorImpl.class.getSimpleName()).append(" id=").append(id).append(" gId=").append(groupId); - return sb.toString(); - } - -} +/******************************************************************************* + * Copyright (c) 2007, 2010 Association for Decentralized Information Management + * in Industry THTH ry. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * VTT Technical Research Centre of Finland - initial API and implementation + *******************************************************************************/ +package org.simantics.ui.workbench.editor; + +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; + + +public class EditorAdapterDescriptorImpl implements EditorAdapterDescriptor { + + private final String id; + + private final String groupId; + + private final EditorAdapter adapter; + + /** + * Null if there is no context limitation + */ + private final String[] inContexts; + + public EditorAdapterDescriptorImpl(String id, String groupId, EditorAdapter adapter, String[] inContexts) { + this.id = id; + if (groupId != null && groupId.isEmpty()) + groupId = null; + this.groupId = groupId; + this.adapter = adapter; + if (inContexts != null && inContexts.length == 0) + inContexts = null; + this.inContexts = inContexts; + } + + @Override + public String getId() { + return id; + } + + @Override + public String getGroupId() { + return groupId; + } + + @Override + public EditorAdapter getAdapter() { + return adapter; + } + + @Override + public Collection getInContexts() { + if (inContexts == null) + return Collections.emptyList(); + return Arrays.asList(inContexts); + } + + @Override + public boolean isActive(Collection activeContextIds) { + // null indicates perpetually active + if (inContexts == null) + return true; + + for (Object o : inContexts) + if (activeContextIds.contains(o)) + return true; + return false; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append(EditorAdapterDescriptorImpl.class.getSimpleName()).append(" id=").append(id).append(" gId=").append(groupId); + return sb.toString(); + } + +}