X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.debug.browser%2Fsrc%2Forg%2Fsimantics%2Fdebug%2Fbrowser%2Fcontent%2FResourceBrowserRewriterRepository.java;h=a76ea6d428a99e23441ea59ad8d863fa471bf665;hb=0ae2b770234dfc3cbb18bd38f324125cf0faca07;hp=ce5aa937808a91cdd24a903ac259f1357fc6bc53;hpb=24e2b34260f219f0d1644ca7a138894980e25b14;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.debug.browser/src/org/simantics/debug/browser/content/ResourceBrowserRewriterRepository.java b/bundles/org.simantics.debug.browser/src/org/simantics/debug/browser/content/ResourceBrowserRewriterRepository.java index ce5aa9378..a76ea6d42 100644 --- a/bundles/org.simantics.debug.browser/src/org/simantics/debug/browser/content/ResourceBrowserRewriterRepository.java +++ b/bundles/org.simantics.debug.browser/src/org/simantics/debug/browser/content/ResourceBrowserRewriterRepository.java @@ -1,45 +1,45 @@ -/******************************************************************************* - * Copyright (c) 2016 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: - * THTH ry - initial API and implementation - *******************************************************************************/ -package org.simantics.debug.browser.content; - -import java.util.Arrays; -import java.util.Comparator; - -import org.osgi.framework.BundleContext; -import org.osgi.util.tracker.ServiceTracker; -import org.simantics.debug.browser.internal.Activator; - -public class ResourceBrowserRewriterRepository { - private static ServiceTracker TRACKER; - - private static final Comparator REWRITER_COMPARATOR = - new Comparator() { - @Override - public int compare(ResourceBrowserRewriter o1, - ResourceBrowserRewriter o2) { - return Double.compare(o1.getPriority(), o2.getPriority()); - } - }; - - public static ResourceBrowserRewriter[] getRewriters() { - if(TRACKER == null) { - BundleContext context = Activator.getContext(); - TRACKER = new ServiceTracker( - context, ResourceBrowserRewriter.class, null); - TRACKER.open(); - } - ResourceBrowserRewriter[] rewriters = - TRACKER.getServices(new ResourceBrowserRewriter[TRACKER.getTrackingCount()]); - Arrays.sort(rewriters, REWRITER_COMPARATOR); - return rewriters; - } -} +/******************************************************************************* + * Copyright (c) 2016 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: + * THTH ry - initial API and implementation + *******************************************************************************/ +package org.simantics.debug.browser.content; + +import java.util.Arrays; +import java.util.Comparator; + +import org.osgi.framework.BundleContext; +import org.osgi.util.tracker.ServiceTracker; +import org.simantics.debug.browser.internal.Activator; + +public class ResourceBrowserRewriterRepository { + private static ServiceTracker TRACKER; + + private static final Comparator REWRITER_COMPARATOR = + new Comparator() { + @Override + public int compare(ResourceBrowserRewriter o1, + ResourceBrowserRewriter o2) { + return Double.compare(o1.getPriority(), o2.getPriority()); + } + }; + + public static ResourceBrowserRewriter[] getRewriters() { + if(TRACKER == null) { + BundleContext context = Activator.getContext(); + TRACKER = new ServiceTracker( + context, ResourceBrowserRewriter.class, null); + TRACKER.open(); + } + ResourceBrowserRewriter[] rewriters = + TRACKER.getServices(new ResourceBrowserRewriter[TRACKER.getTrackingCount()]); + Arrays.sort(rewriters, REWRITER_COMPARATOR); + return rewriters; + } +}