Exemple #1
0
  /**
   * Opens an {@link Dialogs}
   *
   * @param title - The title (if null it will be "Error")
   * @param body - The message (if null it will be e.getLocalizedMessage() )
   * @param e - A Throwable
   */
  public static void errorMsgb(String title, String body, Throwable e) {
    Plugin plugin = ResourcesPlugin.getPlugin();
    if (title == null) {
      title = "Error";
    }

    if (body == null) {
      body = e.getLocalizedMessage();
    }

    StringWriter sw = new StringWriter();
    PrintWriter pw = new PrintWriter(sw);
    e.printStackTrace(pw);

    final String trace = sw.toString(); // stack trace as a string

    // Temp holder of child statuses
    List<Status> childStatuses = new ArrayList<>();

    // Split output by OS-independend new-line
    for (String line : trace.split(System.getProperty("line.separator"))) {
      // build & add status
      childStatuses.add(new Status(IStatus.ERROR, plugin.getBundle().getSymbolicName(), line));
    }

    MultiStatus ms =
        new MultiStatus(
            plugin.getBundle().getSymbolicName(),
            IStatus.ERROR,
            childStatuses.toArray(new Status[] {}), // convert to array of statuses
            e.getLocalizedMessage(),
            e);
    ErrorDialog.openError(
        PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), title, body, ms);
  }
Exemple #2
0
 public static void log(Exception e) {
   if (e instanceof CoreException) {
     plugin.getLog().log(((CoreException) e).getStatus());
   } else {
     plugin.getLog().log(new Status(IStatus.ERROR, Activator.getId(), e.getLocalizedMessage(), e));
   }
 }
 @Override
 public void start(BundleContext context) throws Exception {
   super.start(context);
   overlayresourceChangeListener = new OverlayResourceChangeListener();
   IWorkspace workspace = ResourcesPlugin.getWorkspace();
   workspace.addResourceChangeListener(overlayresourceChangeListener);
 }
  /* (non-Javadoc)
   * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
   */
  public void stop(BundleContext context) throws Exception {
    // release plugin's singleton instance(s)
    ExtensionExplorer.releaseInstance();

    super.stop(context);
    sm_plugin = null;
  }
 /** {@inheritDoc} */
 @Override
 public void stop(final BundleContext context) throws Exception {
   super.stop(context);
   ScaFileCache.INSTANCE.clear();
   cleanOldFiles();
   ScaFileSystemPlugin.instance = null;
 }
Exemple #6
0
 /*
  * (non-Javadoc)
  * @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
  */
 public void start(BundleContext context) throws Exception {
   super.start(context);
   plugin = this;
   if ("true".equals(Platform.getDebugOption("com.aptana.filesystem.ftp/ftplib_debug"))) {
     Logger.setLevel(Level.DEBUG);
   }
 }
 /*
  * (non-Javadoc)
  *
  * @see
  * org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
  */
 public void stop(BundleContext bundleContext) throws Exception {
   super.stop(bundleContext);
   if (!"yes".equals(System.getProperty("junit-test-running"))) {
     Logger logCurrent = LoggerFactory.getLogger(this.getClass().getCanonicalName());
     logCurrent.info("XPT AgentManager FrameWork stopped.");
   }
 }
 @Override
 public void start(BundleContext bundleContext) throws Exception {
   super.start(bundleContext);
   // context = bundleContext;
   plugin = this;
   logger = new Logger(this);
 }
  @Override
  public void stop(BundleContext context) throws Exception {
    serversManager.save();

    super.stop(context);
    plugin = null;
  }
  public void start(BundleContext context) throws Exception {
    super.start(context);

    plugin = this;

    backgroundJob = new BackgroundProcessingJob();
  }
Exemple #11
0
  @Override
  public void stop(final BundleContext context) throws Exception {
    try {
      synchronized (this) {
        fStarted = false;

        fSshSessions = null;
      }

      try {
        for (final IDisposable listener : fStopListeners) {
          listener.dispose();
        }
      } finally {
        fStopListeners.clear();
      }

      if (fSshTracker != null) {
        fSshTracker.close();
        fSshTracker = null;
      }
    } finally {
      gPlugin = null;
      super.stop(context);
    }
  }
  /*
   * (non-Javadoc)
   * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext )
   */
  public void start(BundleContext context) throws Exception {
    super.start(context);

    plugin = this;

    ResourcesPlugin.getWorkspace()
        .addResourceChangeListener(pluginPackageResourceListener, IResourceChangeEvent.POST_CHANGE);
  }
 private Path findFileInPlugin(Plugin plugin, String file)
     throws MalformedURLException, IOException {
   // Plugin p = Platform.getPlugin(plugin);
   URL pluginURL = plugin.getBundle().getEntry("/");
   URL jarURL = new URL(pluginURL, file);
   URL localJarURL = FileLocator.toFileURL(jarURL); // Platform.asLocalURL(jarURL);
   return new Path(localJarURL.getPath());
 }
Exemple #14
0
 @Override
 public void stop(BundleContext context) throws Exception {
   super.stop(context);
   if (directory != null) directory.close();
   INSTANCE = null;
   directory = null;
   logger.info("Stopping Lucene Index");
 }
 @Override
 public void stop(BundleContext context) throws Exception {
   if (overlayresourceChangeListener != null) {
     IWorkspace workspace = ResourcesPlugin.getWorkspace();
     workspace.removeResourceChangeListener(overlayresourceChangeListener);
   }
   super.stop(context);
 }
  @Override
  public void start(BundleContext context) throws Exception {
    super.start(context);
    plugin = this;

    serversManager = new ServersManager();
    serversManager.load();
  }
 @Override
 public void start(BundleContext context) throws Exception {
   super.start(context);
   instance = this;
   bundleContext = context;
   ((PluginUtilImpl) CoreModelerPlugin.Util).initializePlatformLogger(instance);
   ((PluginUtilImpl) UiConstants.Util).initializePlatformLogger(instance);
 }
  /*
   * (non-Javadoc)
   * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext )
   */
  public void stop(BundleContext context) throws Exception {
    plugin = null;

    super.stop(context);

    if (pluginPackageResourceListener != null) {
      ResourcesPlugin.getWorkspace().removeResourceChangeListener(pluginPackageResourceListener);
    }
  }
Exemple #19
0
 /**
  * This method is called upon plug-in activation
  *
  * @param context The bundle context.
  */
 public void start(BundleContext context) throws Exception {
   super.start(context);
   URL url = FileLocator.toFileURL(getBundle().getResource(PLUGIN_XML));
   String home = url.toString();
   home = home.substring(FILE_PREFIX.length(), home.length() - PLUGIN_XML.length());
   // handle windows edge case
   home = home.replaceFirst("^/([A-Za-z]:)", "$1");
   System.setProperty("eclim.home", home);
 }
 /** {@inheritDoc} */
 @Override
 public void start(BundleContext context) throws Exception {
   super.start(context);
   plugin = this;
   StringBuffer buf = new StringBuffer();
   buf.append("SOAPlugin.start - ");
   buf.append(JDTUtil.getBundleInfo(context.getBundle(), SOALogger.DEBUG));
   SOALogger.getLogger().info(buf);
 }
 @Override
 @SuppressWarnings("PMD.SignatureDeclareThrowsException")
 // @SuppressWarnings("PMD.SignatureDeclareThrowsException") We have to use
 // this signature because this is an override of an Eclipse framework's
 // method.
 public void start(final BundleContext bundleContext) throws Exception {
   super.start(bundleContext);
   Activator.plugin = this;
 }
  @Override
  public void start(final BundleContext context) throws Exception {
    super.start(context);
    instance = this;

    synchronized (this) {
      this.started = true;
    }
  }
  @Override
  public void stop(BundleContext context) throws Exception {
    if (connector != null) {
      connector.stop();
      connector = null;
    }

    INSTANCE = null;
    super.stop(context);
  }
Exemple #24
0
  @Override
  public void start(final BundleContext context) throws Exception {
    super.start(context);

    fSshTracker =
        new ServiceTracker(context, "org.eclipse.jsch.core.IJSchService", null); // $NON-NLS-1$
    fSshTracker.open();

    fStarted = true;
  }
 public void start(BundleContext context) throws Exception {
   super.start(context);
   tracker =
       new ServiceTracker(getBundle().getBundleContext(), IProxyService.class.getName(), null);
   tracker.open();
   jschService =
       getBundle()
           .getBundleContext()
           .registerService(
               IJSchService.class.getName(), JSchProvider.getInstance(), new Hashtable());
 }
 @Override
 public void start(BundleContext context) throws Exception {
   super.start(context);
   contextStore = new LocalContextStore(commonContextScaling);
   File storeFile = getDefaultContextLocation().toFile();
   if (!storeFile.exists()) {
     storeFile.mkdirs();
   }
   contextStore.setContextDirectory(storeFile);
   contextManager = new InteractionContextManager(contextStore);
 }
 @Override
 @SuppressWarnings({"PMD.SignatureDeclareThrowsException", "PMD.NullAssignment"})
 // @SuppressWarnings("PMD.SignatureDeclareThrowsException") We have to use
 // this signature because this is an override of an Eclipse framework's
 // method.
 // @SuppressWarnings("PMD.NullAssignment")
 // No choice to right it in another way : this is an Eclipse pattern.
 public void stop(final BundleContext bundleContext) throws Exception {
   Activator.plugin = null;
   super.stop(bundleContext);
 }
  /*
   * (non-Javadoc)
   * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
   */
  @Override
  public void start(BundleContext bundleContext) throws Exception {
    super.start(bundleContext);

    RedmineCorePlugin.context = bundleContext;

    if (spentTimeManager != null) {
      spentTimeManager.start();
    }
    plugin = this;
  }
 @Override
 public void stop(final BundleContext context) throws Exception {
   try {
     synchronized (this) {
       this.started = false;
     }
   } finally {
     instance = null;
     super.stop(context);
   }
 }
  public void stop(BundleContext context) throws Exception {
    backgroundJob.cancel();
    backgroundJob = null;

    javaProjectSources.close();
    javaProjectSources = null;

    plugin = null;

    super.stop(context);
  }