Exemplo n.º 1
0
 /** @see org.eclipse.debug.ui.ILaunchConfigurationTab#getImage() */
 public Image getImage() {
   if (image == null) {
     image =
         JSDebugUIPlugin.getImageDescriptor("icons/full/obj16/launch-debug.gif")
             .createImage(); //$NON-NLS-1$
   }
   return image;
 }
Exemplo n.º 2
0
 /**
  * @see
  *     org.eclipse.debug.ui.ILaunchConfigurationTab#initializeFrom(org.eclipse.debug.core.ILaunchConfiguration)
  */
 public void initializeFrom(ILaunchConfiguration configuration) {
   this.launchConfiguration = configuration;
   try {
     overridePrefs.setSelection(
         configuration.getAttribute(
             ILaunchConfigurationConstants.CONFIGURATION_OVERRIDE_DEBUG_PREFERENCES, false));
     setValuesFrom(configuration);
   } catch (CoreException e) {
     JSDebugUIPlugin.log("Reading launch configuration fails", e); // $NON-NLS-1$
   } finally {
     updateEnablement();
   }
 }
Exemplo n.º 3
0
    /*
     * (non-Javadoc)
     * @see org.eclipse.ui.progress.UIJob#runInUIThread(org.eclipse.core.runtime .IProgressMonitor)
     */
    public IStatus runInUIThread(IProgressMonitor monitor) {
      ISourceLookupResult result = null;
      IWorkbenchPage page = null;
      synchronized (this) {
        result = fResult;
        page = fPage;
        setDisplayInfo(null, null);
      }
      if (!monitor.isCanceled() && result != null && page != null) {
        if (result.getEditorInput() == null) {
          MessageDialog.openError(
              page.getWorkbenchWindow().getShell(),
              Messages.getString("SourceDisplayAdapter.Error_Opening_Source"), // $NON-NLS-1$
              MessageFormat.format(
                  Messages.getString("SourceDisplayAdapter.Source_Not_Located"), // $NON-NLS-1$
                  JSDebugUIPlugin.getDefault()
                      .getModelPresentation()
                      .getText(result.getArtifact())));
          return Status.CANCEL_STATUS;
        }
        // Workaround for http://support.aptana.com/asap/browse/STU-3818
        if (result.getArtifact() instanceof ISourceLink) {
          boolean oldReuseValue =
              DebugUIPlugin.getDefault()
                  .getPreferenceStore()
                  .getBoolean(IDebugUIConstants.PREF_REUSE_EDITOR);
          DebugUIPlugin.getDefault()
              .getPreferenceStore()
              .setValue(IDebugUIConstants.PREF_REUSE_EDITOR, false);
          DebugUITools.displaySource(result, page);
          DebugUIPlugin.getDefault()
              .getPreferenceStore()
              .setValue(IDebugUIConstants.PREF_REUSE_EDITOR, oldReuseValue);
        } else {
          DebugUITools.displaySource(result, page);
        }
        if (result.getArtifact() instanceof IJSScriptElement) {
          int lineNumber = ((IJSScriptElement) result.getArtifact()).getBaseLine();
          IEditorInput editorInput = result.getEditorInput();
          if (editorInput != null && lineNumber > 0) {
            IEditorPart editorPart = SourceDisplayUtil.findEditor(editorInput);
            if (editorPart != null) {
              SourceDisplayUtil.revealLineInEditor(editorPart, lineNumber);
            }
          }
        }
      }

      return Status.OK_STATUS;
    }
Exemplo n.º 4
0
  private ISourceLocator getDefaultSourceLocator() {
    if (fDefaultSourceLocator == null) {
      try {
        fDefaultSourceLocator =
            DebugPlugin.getDefault().getLaunchManager().newSourceLocator(DEFAULT_SOURCE_LOCATOR_ID);
        if (fDefaultSourceLocator instanceof ISourceLookupDirector) {
          ISourceLookupDirector sourceLookupDirector =
              (ISourceLookupDirector) fDefaultSourceLocator;
          sourceLookupDirector.initializeParticipants();
          sourceLookupDirector.setSourceContainers(
              new ISourceContainer[] {
                new DefaultSourceContainer() {

                  /*
                   * (non-Javadoc)
                   * @see org.eclipse.debug.core.sourcelookup.containers.
                   * DefaultSourceContainer#createSourceContainers()
                   */
                  @Override
                  protected ISourceContainer[] createSourceContainers() throws CoreException {
                    ISourcePathComputer sourcePathComputer = null;
                    ISourceLookupDirector director = getDirector();
                    if (director != null) {
                      sourcePathComputer = director.getSourcePathComputer();
                    }
                    if (sourcePathComputer != null) {
                      return sourcePathComputer.computeSourceContainers(null, null);
                    }

                    return EMPTY_CONTAINERS;
                  }
                }
              });
          ISourcePathComputer sourcePathComputer =
              DebugPlugin.getDefault()
                  .getLaunchManager()
                  .getSourcePathComputer(DEFAULT_SOURCE_PATH_COMPUTER_ID);
          sourceLookupDirector.setSourcePathComputer(sourcePathComputer);
        }
      } catch (CoreException e) {
        IdeLog.logError(JSDebugUIPlugin.getDefault(), e);
      }
    }
    return fDefaultSourceLocator;
  }