コード例 #1
0
  private void initServices() {
    BundleContext context = Activator.getContext();
    if (context == null) {
      RuntimeLog.log(
          new Status(
              IStatus.ERROR,
              RegistryMessages.OWNER_NAME,
              0,
              RegistryMessages.bundle_not_activated,
              null));
      return;
    }

    debugTracker = new ServiceTracker(context, DebugOptions.class.getName(), null);
    debugTracker.open();

    bundleTracker = new ServiceTracker(context, PackageAdmin.class.getName(), null);
    bundleTracker.open();

    // locations
    final String FILTER_PREFIX =
        "(&(objectClass=org.eclipse.osgi.service.datalocation.Location)(type="; //$NON-NLS-1$
    Filter filter = null;
    try {
      filter = context.createFilter(FILTER_PREFIX + PROP_CONFIG_AREA + "))"); // $NON-NLS-1$
    } catch (InvalidSyntaxException e) {
      // ignore this.  It should never happen as we have tested the above format.
    }
    configurationLocationTracker = new ServiceTracker(context, filter, null);
    configurationLocationTracker.open();
  }
  protected void setUp() throws Exception {
    super.setUp();

    project = createProject("Project_", new String[] {"File1.txt", "File2.txt"});

    file1 = project.getFile("File1.txt");
    file2 = project.getFile("File2.txt");
    file1.setContents(new ByteArrayInputStream(fileContents1.getBytes()), true, true, null);
    file2.setContents(new ByteArrayInputStream(fileContents2.getBytes()), true, true, null);

    RuntimeLog.addLogListener(logListener);
  }
コード例 #3
0
 public PackageAdmin getPackageAdmin() {
   if (bundleTracker == null) {
     RuntimeLog.log(
         new Status(
             IStatus.ERROR,
             RegistryMessages.OWNER_NAME,
             0,
             RegistryMessages.bundle_not_activated,
             null));
     return null;
   }
   return (PackageAdmin) bundleTracker.getService();
 }
コード例 #4
0
 public boolean getBooleanDebugOption(String option, boolean defaultValue) {
   if (debugTracker == null) {
     RuntimeLog.log(
         new Status(
             IStatus.ERROR,
             RegistryMessages.OWNER_NAME,
             0,
             RegistryMessages.bundle_not_activated,
             null));
     return defaultValue;
   }
   DebugOptions options = (DebugOptions) debugTracker.getService();
   if (options != null) {
     String value = options.getOption(option);
     if (value != null) return value.equalsIgnoreCase("true"); // $NON-NLS-1$
   }
   return defaultValue;
 }
 protected void logError(String message) {
   // we log as an error to ensure it's shown
   RuntimeLog.log(new Status(IStatus.ERROR, "org.eclipse.e4.ui.css.core", message));
 }
 protected void tearDown() throws Exception {
   // remove log listener
   RuntimeLog.removeLogListener(logListener);
   super.tearDown();
 }
コード例 #7
0
 public void logError(String msg, Throwable e) {
   RuntimeLog.log(new Status(IStatus.ERROR, PI_AUTH, msg, e));
 }
コード例 #8
0
 public void logMessage(String msg) {
   RuntimeLog.log(new Status(IStatus.INFO, PI_AUTH, msg, null));
 }