org.eclipse.jdt.junit_3.7.0.v20110928-1453

16:45:10.149 INFO  jd.cli.Main - Decompiling org.eclipse.jdt.junit_3.7.0.v20110928-1453.jar
package org.eclipse.jdt.internal.junit.buildpath;

import org.eclipse.core.resources.IMarker;
import org.eclipse.core.runtime.IPath;
import org.eclipse.jdt.core.IClasspathEntry;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.internal.junit.ui.JUnitMessages;
import org.eclipse.jdt.internal.junit.ui.JUnitPlugin;
import org.eclipse.jdt.internal.ui.JavaPluginImages;
import org.eclipse.jdt.internal.ui.util.BusyIndicatorRunnableContext;
import org.eclipse.swt.graphics.Image;
import org.eclipse.ui.IMarkerResolution2;

class ClasspathVariableMarkerResolutionGenerator$1
  implements IMarkerResolution2
{
  ClasspathVariableMarkerResolutionGenerator$1(ClasspathVariableMarkerResolutionGenerator paramClasspathVariableMarkerResolutionGenerator, IJavaProject paramIJavaProject, IPath paramIPath) {}
  
  public Image getImage()
  {
    return JavaPluginImages.get("org.eclipse.jdt.ui.correction_change.gif");
  }
  
  public String getLabel()
  {
    return JUnitMessages.ClasspathVariableMarkerResolutionGenerator_use_JUnit3;
  }
  
  public String getDescription()
  {
    return JUnitMessages.ClasspathVariableMarkerResolutionGenerator_use_JUnit3_desc;
  }
  
  public void run(IMarker nonsenseArgument)
  {
    try
    {
      IClasspathEntry[] entries = val$project.getRawClasspath();
      int idx = ClasspathVariableMarkerResolutionGenerator.access$0(this$0, entries, val$path);
      if (idx == -1) {
        return;
      }
      entries[idx] = BuildPathSupport.getJUnit3ClasspathEntry();
      
      ClasspathVariableMarkerResolutionGenerator.access$1(val$project, entries, new BusyIndicatorRunnableContext());
    }
    catch (JavaModelException e)
    {
      JUnitPlugin.log(e);
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jdt.internal.junit.buildpath.ClasspathVariableMarkerResolutionGenerator.1
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jdt.internal.junit.buildpath;

import java.lang.reflect.InvocationTargetException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jdt.core.IClasspathEntry;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jface.operation.IRunnableWithProgress;

class ClasspathVariableMarkerResolutionGenerator$2
  implements IRunnableWithProgress
{
  ClasspathVariableMarkerResolutionGenerator$2(IJavaProject paramIJavaProject, IClasspathEntry[] paramArrayOfIClasspathEntry) {}
  
  public void run(IProgressMonitor monitor)
    throws InvocationTargetException, InterruptedException
  {
    try
    {
      val$project.setRawClasspath(val$entries, monitor);
    }
    catch (JavaModelException e)
    {
      throw new InvocationTargetException(e);
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jdt.internal.junit.buildpath.ClasspathVariableMarkerResolutionGenerator.2
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jdt.internal.junit.buildpath;

import java.lang.reflect.InvocationTargetException;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.jdt.core.CorrectionEngine;
import org.eclipse.jdt.core.IClasspathEntry;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.internal.junit.ui.JUnitMessages;
import org.eclipse.jdt.internal.junit.ui.JUnitPlugin;
import org.eclipse.jdt.internal.ui.JavaPluginImages;
import org.eclipse.jdt.internal.ui.util.BusyIndicatorRunnableContext;
import org.eclipse.jface.operation.IRunnableContext;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.swt.graphics.Image;
import org.eclipse.ui.IMarkerResolution;
import org.eclipse.ui.IMarkerResolution2;
import org.eclipse.ui.IMarkerResolutionGenerator2;

public class ClasspathVariableMarkerResolutionGenerator
  implements IMarkerResolutionGenerator2
{
  private static final IMarkerResolution[] NO_RESOLUTION = new IMarkerResolution[0];
  
  public boolean hasResolutions(IMarker marker)
  {
    int id = marker.getAttribute("id", -1);
    if (id == 1010)
    {
      String[] arguments = CorrectionEngine.getProblemArguments(marker);
      if ((arguments == null) || (arguments.length == 0)) {
        return false;
      }
      if ((arguments[0].startsWith("JUNIT_HOME/")) || 
        (arguments[0].startsWith("JUNIT_SRC_HOME/"))) {
        return true;
      }
    }
    return false;
  }
  
  public IMarkerResolution[] getResolutions(IMarker marker)
  {
    if (!hasResolutions(marker)) {
      return NO_RESOLUTION;
    }
    String[] arguments = CorrectionEngine.getProblemArguments(marker);
    final IPath path = new Path(arguments[0]);
    final IJavaProject project = getJavaProject(marker);
    
    new IMarkerResolution2[] {
      new IMarkerResolution2()
      {
        public Image getImage()
        {
          return JavaPluginImages.get("org.eclipse.jdt.ui.correction_change.gif");
        }
        
        public String getLabel()
        {
          return JUnitMessages.ClasspathVariableMarkerResolutionGenerator_use_JUnit3;
        }
        
        public String getDescription()
        {
          return JUnitMessages.ClasspathVariableMarkerResolutionGenerator_use_JUnit3_desc;
        }
        
        public void run(IMarker nonsenseArgument)
        {
          try
          {
            IClasspathEntry[] entries = project.getRawClasspath();
            int idx = ClasspathVariableMarkerResolutionGenerator.this.indexOfClasspath(entries, path);
            if (idx == -1) {
              return;
            }
            entries[idx] = BuildPathSupport.getJUnit3ClasspathEntry();
            
            ClasspathVariableMarkerResolutionGenerator.setClasspath(project, entries, new BusyIndicatorRunnableContext());
          }
          catch (JavaModelException e)
          {
            JUnitPlugin.log(e);
          }
        }
      } };
  }
  
  private IJavaProject getJavaProject(IMarker marker)
  {
    return JavaCore.create(marker.getResource().getProject());
  }
  
  private int indexOfClasspath(IClasspathEntry[] entries, IPath path)
  {
    for (int i = 0; i < entries.length; i++)
    {
      IClasspathEntry curr = entries[i];
      if ((curr.getEntryKind() == 4) && (curr.getPath().equals(path))) {
        return i;
      }
    }
    return -1;
  }
  
  private static void setClasspath(IJavaProject project, final IClasspathEntry[] entries, IRunnableContext context)
  {
    try
    {
      context.run(true, false, new IRunnableWithProgress()
      {
        public void run(IProgressMonitor monitor)
          throws InvocationTargetException, InterruptedException
        {
          try
          {
            setRawClasspath(entries, monitor);
          }
          catch (JavaModelException e)
          {
            throw new InvocationTargetException(e);
          }
        }
      });
    }
    catch (InvocationTargetException e)
    {
      JUnitPlugin.log(e);
    }
    catch (InterruptedException localInterruptedException) {}
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jdt.internal.junit.buildpath.ClasspathVariableMarkerResolutionGenerator
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jdt.internal.junit.buildpath;

import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;

class JUnitContainerWizardPage$1
  implements ModifyListener
{
  JUnitContainerWizardPage$1(JUnitContainerWizardPage paramJUnitContainerWizardPage) {}
  
  public void modifyText(ModifyEvent e)
  {
    this$0.doSelectionChanged();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jdt.internal.junit.buildpath.JUnitContainerWizardPage.1
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jdt.internal.junit.buildpath;

import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IPath;
import org.eclipse.jdt.core.IClasspathContainer;
import org.eclipse.jdt.core.IClasspathEntry;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.internal.junit.BasicElementLabels;
import org.eclipse.jdt.internal.junit.ui.JUnitMessages;
import org.eclipse.jdt.internal.junit.util.ExceptionHandler;
import org.eclipse.jdt.internal.junit.util.JUnitStatus;
import org.eclipse.jdt.internal.junit.util.JUnitStubUtility;
import org.eclipse.jdt.internal.ui.JavaPluginImages;
import org.eclipse.jdt.junit.JUnitCore;
import org.eclipse.jdt.ui.JavaElementLabels;
import org.eclipse.jdt.ui.wizards.IClasspathContainerPage;
import org.eclipse.jdt.ui.wizards.IClasspathContainerPageExtension;
import org.eclipse.jdt.ui.wizards.NewElementWizardPage;
import org.eclipse.jface.layout.PixelConverter;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;

public class JUnitContainerWizardPage
  extends NewElementWizardPage
  implements IClasspathContainerPage, IClasspathContainerPageExtension
{
  private IJavaProject fProject;
  private IClasspathEntry fContainerEntryResult;
  private Combo fVersionCombo;
  private Text fResolvedPath;
  private Text fResolvedSourcePath;
  
  public JUnitContainerWizardPage()
  {
    super("JUnitContainerPage");
    setTitle(JUnitMessages.JUnitContainerWizardPage_wizard_title);
    setDescription(JUnitMessages.JUnitContainerWizardPage_wizard_description);
    setImageDescriptor(JavaPluginImages.DESC_WIZBAN_ADD_LIBRARY);
    
    fContainerEntryResult = JavaCore.newContainerEntry(JUnitCore.JUNIT3_CONTAINER_PATH);
  }
  
  public static IJavaProject getPlaceholderProject()
  {
    String name = "####internal";
    IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
    for (;;)
    {
      IProject project = root.getProject(name);
      if (!project.exists()) {
        return JavaCore.create(project);
      }
      name = name + '1';
    }
  }
  
  public boolean finish()
  {
    try
    {
      IJavaProject[] javaProjects = { getPlaceholderProject() };
      IClasspathContainer[] containers = new IClasspathContainer[1];
      JavaCore.setClasspathContainer(fContainerEntryResult.getPath(), javaProjects, containers, null);
    }
    catch (JavaModelException e)
    {
      ExceptionHandler.handle(e, getShell(), JUnitMessages.JUnitContainerWizardPage_error_title, JUnitMessages.JUnitContainerWizardPage_error_problem_configuring_container);
      return false;
    }
    return true;
  }
  
  public IClasspathEntry getSelection()
  {
    return fContainerEntryResult;
  }
  
  public void setSelection(IClasspathEntry containerEntry)
  {
    fContainerEntryResult = containerEntry;
  }
  
  public void createControl(Composite parent)
  {
    PixelConverter converter = new PixelConverter(parent);
    
    Composite composite = new Composite(parent, 0);
    composite.setFont(parent.getFont());
    
    composite.setLayout(new GridLayout(2, false));
    
    Label label = new Label(composite, 0);
    label.setFont(composite.getFont());
    label.setLayoutData(new GridData(4, 2, false, false, 1, 1));
    label.setText(JUnitMessages.JUnitContainerWizardPage_combo_label);
    
    fVersionCombo = new Combo(composite, 8);
    fVersionCombo.setItems(new String[] {
      JUnitMessages.JUnitContainerWizardPage_option_junit3, 
      JUnitMessages.JUnitContainerWizardPage_option_junit4 });
    
    fVersionCombo.setFont(composite.getFont());
    
    GridData data = new GridData(1, 2, false, false, 1, 1);
    widthHint = converter.convertWidthInCharsToPixels(15);
    fVersionCombo.setLayoutData(data);
    if ((fContainerEntryResult != null) && (JUnitCore.JUNIT4_CONTAINER_PATH.equals(fContainerEntryResult.getPath()))) {
      fVersionCombo.select(1);
    } else {
      fVersionCombo.select(0);
    }
    fVersionCombo.addModifyListener(new ModifyListener()
    {
      public void modifyText(ModifyEvent e)
      {
        doSelectionChanged();
      }
    });
    label = new Label(composite, 0);
    label.setFont(composite.getFont());
    label.setText(JUnitMessages.JUnitContainerWizardPage_resolved_label);
    label.setLayoutData(new GridData(4, 1, false, false, 1, 1));
    
    fResolvedPath = new Text(composite, 72);
    data = new GridData(4, 4, true, false, 1, 1);
    widthHint = converter.convertWidthInCharsToPixels(60);
    fResolvedPath.setFont(composite.getFont());
    fResolvedPath.setLayoutData(data);
    
    label = new Label(composite, 0);
    label.setFont(composite.getFont());
    label.setText(JUnitMessages.JUnitContainerWizardPage_source_location_label);
    label.setLayoutData(new GridData(4, 1, false, false, 1, 1));
    
    fResolvedSourcePath = new Text(composite, 72);
    data = new GridData(4, 4, true, false, 1, 1);
    widthHint = converter.convertWidthInCharsToPixels(60);
    fResolvedSourcePath.setFont(composite.getFont());
    fResolvedSourcePath.setLayoutData(data);
    
    doSelectionChanged();
    
    setControl(composite);
  }
  
  public void setVisible(boolean visible)
  {
    super.setVisible(visible);
    if (visible) {
      fVersionCombo.setFocus();
    }
  }
  
  protected void doSelectionChanged()
  {
    JUnitStatus status = new JUnitStatus();
    IClasspathEntry libEntry;
    IPath containerPath;
    IClasspathEntry libEntry;
    if ((fVersionCombo != null) && (fVersionCombo.getSelectionIndex() == 1))
    {
      IPath containerPath = JUnitCore.JUNIT4_CONTAINER_PATH;
      libEntry = BuildPathSupport.getJUnit4LibraryEntry();
    }
    else
    {
      containerPath = JUnitCore.JUNIT3_CONTAINER_PATH;
      libEntry = BuildPathSupport.getJUnit3LibraryEntry();
    }
    if (libEntry == null) {
      status.setError(JUnitMessages.JUnitContainerWizardPage_error_version_not_available);
    } else if ((JUnitCore.JUNIT4_CONTAINER_PATH.equals(containerPath)) && 
      (fProject != null) && (!JUnitStubUtility.is50OrHigher(fProject))) {
      status.setWarning(JUnitMessages.JUnitContainerWizardPage_warning_java5_required);
    }
    fContainerEntryResult = JavaCore.newContainerEntry(containerPath);
    if ((fResolvedPath != null) && (!fResolvedPath.isDisposed())) {
      if (libEntry != null) {
        fResolvedPath.setText(getPathLabel(libEntry.getPath()));
      } else {
        fResolvedPath.setText(JUnitMessages.JUnitContainerWizardPage_lib_not_found);
      }
    }
    if ((fResolvedSourcePath != null) && (!fResolvedSourcePath.isDisposed())) {
      if ((libEntry != null) && (libEntry.getSourceAttachmentPath() != null)) {
        fResolvedSourcePath.setText(getPathLabel(libEntry.getSourceAttachmentPath()));
      } else {
        fResolvedSourcePath.setText(JUnitMessages.JUnitContainerWizardPage_source_not_found);
      }
    }
    updateStatus(status);
  }
  
  private String getPathLabel(IPath path)
  {
    StringBuffer buf = new StringBuffer(BasicElementLabels.getResourceName(path.lastSegment()));
    buf.append(JavaElementLabels.CONCAT_STRING);
    buf.append(BasicElementLabels.getPathLabel(path.removeLastSegments(1), true));
    return buf.toString();
  }
  
  public void initialize(IJavaProject project, IClasspathEntry[] currentEntries)
  {
    fProject = project;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jdt.internal.junit.buildpath.JUnitContainerWizardPage
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jdt.internal.junit.launcher;

import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.core.runtime.preferences.IPreferencesService;
import org.eclipse.core.runtime.preferences.IScopeContext;
import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;

public class AssertionVMArg
{
  private static final String LONG_VM_ARG_TEXT = "-enableassertions";
  private static final String SHORT_VM_ARG_TEXT = "-ea";
  public static final int ASSERT_ARG_NOT_FOUND = -1;
  
  public static void setArgDefault(ILaunchConfigurationWorkingCopy config)
  {
    String argText = getEnableAssertionsPreference() ? "-ea" : "";
    config.setAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS, argText);
  }
  
  public static String enableAssertInArgString(String currentArgs)
  {
    String[] argArray = DebugPlugin.parseArguments(currentArgs);
    boolean assertAlreadyEnabled = findAssertEnabledArg(argArray) != -1;
    String result = currentArgs;
    if ((!assertAlreadyEnabled) && (getEnableAssertionsPreference())) {
      result = setAssertInArgString(currentArgs);
    }
    return result;
  }
  
  public static int findAssertEnabledArg(String[] argArray)
  {
    int assertArgIndex = -1;
    for (int i = 0; i < argArray.length; i++)
    {
      String arg = argArray[i].toLowerCase();
      if ((arg.startsWith("-ea")) || (arg.startsWith("-enableassertions")))
      {
        assertArgIndex = i;
        break;
      }
    }
    return assertArgIndex;
  }
  
  public static String setAssertInArgString(String currentArgs)
  {
    return 
    
      currentArgs + " " + "-ea";
  }
  
  public static boolean getEnableAssertionsPreference()
  {
    return Platform.getPreferencesService().getBoolean("org.eclipse.jdt.junit.core", "org.eclipse.jdt.junit.enable_assertions", false, null);
  }
  
  public static void setEnableAssertionsPreference(boolean preference)
  {
    InstanceScope.INSTANCE.getNode("org.eclipse.jdt.junit.core").putBoolean("org.eclipse.jdt.junit.enable_assertions", preference);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jdt.internal.junit.launcher.AssertionVMArg
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jdt.internal.junit.launcher;

import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.debug.ui.AbstractLaunchConfigurationTabGroup;
import org.eclipse.debug.ui.CommonTab;
import org.eclipse.debug.ui.EnvironmentTab;
import org.eclipse.debug.ui.ILaunchConfigurationDialog;
import org.eclipse.debug.ui.ILaunchConfigurationTab;
import org.eclipse.debug.ui.sourcelookup.SourceLookupTab;
import org.eclipse.jdt.debug.ui.launchConfigurations.JavaArgumentsTab;
import org.eclipse.jdt.debug.ui.launchConfigurations.JavaClasspathTab;
import org.eclipse.jdt.debug.ui.launchConfigurations.JavaJRETab;
import org.eclipse.jdt.junit.launcher.JUnitLaunchConfigurationTab;

public class JUnitTabGroup
  extends AbstractLaunchConfigurationTabGroup
{
  public void createTabs(ILaunchConfigurationDialog dialog, String mode)
  {
    ILaunchConfigurationTab[] tabs = {
      new JUnitLaunchConfigurationTab(), 
      new JavaArgumentsTab(), 
      new JavaClasspathTab(), 
      new JavaJRETab(), 
      new SourceLookupTab(), 
      new EnvironmentTab(), 
      new CommonTab() };
    
    setTabs(tabs);
  }
  
  public void setDefaults(ILaunchConfigurationWorkingCopy config)
  {
    super.setDefaults(config);
    AssertionVMArg.setArgDefault(config);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jdt.internal.junit.launcher.JUnitTabGroup
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jdt.internal.junit.launcher;

import org.eclipse.core.runtime.IStatus;
import org.eclipse.jdt.internal.junit.ui.JUnitMessages;
import org.eclipse.jdt.internal.junit.ui.JUnitPlugin;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;

class LaunchErrorStatusHandler$1
  implements Runnable
{
  LaunchErrorStatusHandler$1(LaunchErrorStatusHandler paramLaunchErrorStatusHandler, IStatus paramIStatus, Boolean[] paramArrayOfBoolean) {}
  
  public void run()
  {
    Shell shell = JUnitPlugin.getActiveWorkbenchShell();
    if (shell == null) {
      shell = LaunchErrorStatusHandler.access$0(this$0).getActiveShell();
    }
    if (shell != null)
    {
      MessageDialog.openInformation(shell, JUnitMessages.JUnitLaunchConfigurationDelegate_dialog_title, val$status.getMessage());
      val$success[0] = Boolean.TRUE;
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jdt.internal.junit.launcher.LaunchErrorStatusHandler.1
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jdt.internal.junit.launcher;

import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.debug.core.IStatusHandler;
import org.eclipse.jdt.internal.junit.ui.JUnitMessages;
import org.eclipse.jdt.internal.junit.ui.JUnitPlugin;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;

public class LaunchErrorStatusHandler
  implements IStatusHandler
{
  public Object handleStatus(final IStatus status, Object source)
    throws CoreException
  {
    final Boolean[] success = { Boolean.FALSE };
    getDisplay().syncExec(
      new Runnable()
      {
        public void run()
        {
          Shell shell = JUnitPlugin.getActiveWorkbenchShell();
          if (shell == null) {
            shell = LaunchErrorStatusHandler.this.getDisplay().getActiveShell();
          }
          if (shell != null)
          {
            MessageDialog.openInformation(shell, JUnitMessages.JUnitLaunchConfigurationDelegate_dialog_title, status.getMessage());
            success[0] = Boolean.TRUE;
          }
        }
      });
    if (success[0] == Boolean.TRUE) {
      return null;
    }
    throw new CoreException(status);
  }
  
  private Display getDisplay()
  {
    Display display = Display.getCurrent();
    if (display == null) {
      display = Display.getDefault();
    }
    return display;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jdt.internal.junit.launcher.LaunchErrorStatusHandler
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jdt.internal.junit.launcher;

import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.ui.JavaElementLabelProvider;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.swt.graphics.Image;

class TestSelectionDialog$PackageRenderer
  extends LabelProvider
{
  private JavaElementLabelProvider fBaseLabelProvider;
  
  public TestSelectionDialog$PackageRenderer()
  {
    fBaseLabelProvider = new JavaElementLabelProvider(2114);
  }
  
  public Image getImage(Object element)
  {
    return fBaseLabelProvider.getImage(((IType)element).getPackageFragment());
  }
  
  public String getText(Object element)
  {
    return fBaseLabelProvider.getText(((IType)element).getPackageFragment());
  }
  
  public void dispose()
  {
    fBaseLabelProvider.dispose();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jdt.internal.junit.launcher.TestSelectionDialog.PackageRenderer
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jdt.internal.junit.launcher;

import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.ui.JavaElementLabelProvider;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.dialogs.TwoPaneElementSelector;

/**
 * @deprecated
 */
public class TestSelectionDialog
  extends TwoPaneElementSelector
{
  private final IType[] fTypes;
  
  private static class PackageRenderer
    extends LabelProvider
  {
    private JavaElementLabelProvider fBaseLabelProvider;
    
    public PackageRenderer()
    {
      fBaseLabelProvider = new JavaElementLabelProvider(2114);
    }
    
    public Image getImage(Object element)
    {
      return fBaseLabelProvider.getImage(((IType)element).getPackageFragment());
    }
    
    public String getText(Object element)
    {
      return fBaseLabelProvider.getText(((IType)element).getPackageFragment());
    }
    
    public void dispose()
    {
      fBaseLabelProvider.dispose();
    }
  }
  
  public TestSelectionDialog(Shell shell, IType[] types)
  {
    super(shell, new JavaElementLabelProvider(16), new PackageRenderer());
    fTypes = types;
  }
  
  protected void configureShell(Shell newShell)
  {
    super.configureShell(newShell);
  }
  
  public int open()
  {
    setElements(fTypes);
    return super.open();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jdt.internal.junit.launcher.TestSelectionDialog
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jdt.internal.junit.refactoring;

import org.eclipse.core.runtime.CoreException;

public abstract interface IChangeAdder
{
  public abstract void createChangeForConfig(JUnitRenameParticipant.ChangeList paramChangeList, LaunchConfigurationContainer paramLaunchConfigurationContainer)
    throws CoreException;
}

/* Location:
 * Qualified Name:     org.eclipse.jdt.internal.junit.refactoring.IChangeAdder
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jdt.internal.junit.refactoring;

import java.util.List;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchManager;
import org.eclipse.ltk.core.refactoring.Change;
import org.eclipse.ltk.core.refactoring.participants.RenameArguments;

public class JUnitRenameParticipant$ChangeList
{
  private final RenameArguments fArguments;
  private List<Change> fChanges;
  private final ILaunchManager fLaunchManager;
  private boolean fShouldFlagWarnings = true;
  
  public JUnitRenameParticipant$ChangeList(RenameArguments arguments, ILaunchManager manager, List<Change> changes)
  {
    fArguments = arguments;
    fLaunchManager = manager;
    fChanges = changes;
  }
  
  public void addChange(Change change)
  {
    if (change != null)
    {
      fChanges.add(change);
      fShouldFlagWarnings = false;
    }
  }
  
  public void createChangeForConfigs(ILaunchConfiguration[] configs, IChangeAdder changeCreator)
    throws CoreException
  {
    ILaunchConfiguration[] arrayOfILaunchConfiguration;
    int j = (arrayOfILaunchConfiguration = configs).length;
    for (int i = 0; i < j; i++)
    {
      ILaunchConfiguration config = arrayOfILaunchConfiguration[i];
      fShouldFlagWarnings = true;
      changeCreator.createChangeForConfig(this, new LaunchConfigurationContainer(config));
    }
  }
  
  public boolean shouldFlagWarnings()
  {
    return fShouldFlagWarnings;
  }
  
  public void addRenameChangeIfNeeded(LaunchConfigurationContainer config, String oldName)
  {
    if (config.getName().equals(oldName))
    {
      LaunchConfigRenameChange renameChange = new LaunchConfigRenameChange(config, fArguments.getNewName(), fLaunchManager, shouldFlagWarnings());
      addChange(renameChange);
    }
  }
  
  public void addAttributeChangeIfNeeded(LaunchConfigurationContainer config, String attributeName, String oldValue, String newValue)
    throws CoreException
  {
    String currentValue = config.getAttribute(attributeName, null);
    if ((currentValue != null) && (oldValue.equals(currentValue))) {
      addAttributeChange(config, attributeName, newValue);
    }
  }
  
  public void addAttributeChange(LaunchConfigurationContainer config, String attributeName, String newValue)
  {
    addChange(new LaunchConfigSetAttributeChange(config, attributeName, newValue, shouldFlagWarnings()));
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jdt.internal.junit.refactoring.JUnitRenameParticipant.ChangeList
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jdt.internal.junit.refactoring;

import java.util.ArrayList;
import java.util.List;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationType;
import org.eclipse.debug.core.ILaunchManager;
import org.eclipse.jdt.internal.junit.ui.JUnitMessages;
import org.eclipse.jdt.internal.junit.ui.JUnitPlugin;
import org.eclipse.ltk.core.refactoring.Change;
import org.eclipse.ltk.core.refactoring.CompositeChange;
import org.eclipse.ltk.core.refactoring.RefactoringStatus;
import org.eclipse.ltk.core.refactoring.participants.CheckConditionsContext;
import org.eclipse.ltk.core.refactoring.participants.RenameArguments;
import org.eclipse.ltk.core.refactoring.participants.RenameParticipant;

public abstract class JUnitRenameParticipant
  extends RenameParticipant
  implements IChangeAdder
{
  public static class ChangeList
  {
    private final RenameArguments fArguments;
    private List<Change> fChanges;
    private final ILaunchManager fLaunchManager;
    private boolean fShouldFlagWarnings = true;
    
    public ChangeList(RenameArguments arguments, ILaunchManager manager, List<Change> changes)
    {
      fArguments = arguments;
      fLaunchManager = manager;
      fChanges = changes;
    }
    
    public void addChange(Change change)
    {
      if (change != null)
      {
        fChanges.add(change);
        fShouldFlagWarnings = false;
      }
    }
    
    public void createChangeForConfigs(ILaunchConfiguration[] configs, IChangeAdder changeCreator)
      throws CoreException
    {
      ILaunchConfiguration[] arrayOfILaunchConfiguration;
      int j = (arrayOfILaunchConfiguration = configs).length;
      for (int i = 0; i < j; i++)
      {
        ILaunchConfiguration config = arrayOfILaunchConfiguration[i];
        fShouldFlagWarnings = true;
        changeCreator.createChangeForConfig(this, new LaunchConfigurationContainer(config));
      }
    }
    
    public boolean shouldFlagWarnings()
    {
      return fShouldFlagWarnings;
    }
    
    public void addRenameChangeIfNeeded(LaunchConfigurationContainer config, String oldName)
    {
      if (config.getName().equals(oldName))
      {
        LaunchConfigRenameChange renameChange = new LaunchConfigRenameChange(config, fArguments.getNewName(), fLaunchManager, shouldFlagWarnings());
        addChange(renameChange);
      }
    }
    
    public void addAttributeChangeIfNeeded(LaunchConfigurationContainer config, String attributeName, String oldValue, String newValue)
      throws CoreException
    {
      String currentValue = config.getAttribute(attributeName, null);
      if ((currentValue != null) && (oldValue.equals(currentValue))) {
        addAttributeChange(config, attributeName, newValue);
      }
    }
    
    public void addAttributeChange(LaunchConfigurationContainer config, String attributeName, String newValue)
    {
      addChange(new LaunchConfigSetAttributeChange(config, attributeName, newValue, shouldFlagWarnings()));
    }
  }
  
  public RefactoringStatus checkConditions(IProgressMonitor pm, CheckConditionsContext context)
  {
    return new RefactoringStatus();
  }
  
  public Change createChange(IProgressMonitor pm)
    throws CoreException
  {
    if (!getArguments().getUpdateReferences()) {
      return null;
    }
    ILaunchManager manager = getLaunchManager();
    List<String> launchConfigTypes = getLaunchConfigTypes();
    List<Change> changes = new ArrayList();
    for (String typeId : launchConfigTypes)
    {
      ILaunchConfigurationType type = manager.getLaunchConfigurationType(typeId);
      ILaunchConfiguration[] configs = manager.getLaunchConfigurations(type);
      new ChangeList(getArguments(), getLaunchManager(), changes).createChangeForConfigs(configs, this);
      if (pm.isCanceled()) {
        throw new OperationCanceledException();
      }
    }
    if (changes.size() > 0) {
      return new CompositeChange(getChangeName(), (Change[])changes.toArray(new Change[changes.size()]));
    }
    return null;
  }
  
  public abstract void createChangeForConfig(ChangeList paramChangeList, LaunchConfigurationContainer paramLaunchConfigurationContainer)
    throws CoreException;
  
  protected String getChangeName()
  {
    return JUnitMessages.TypeRenameParticipant_change_name;
  }
  
  protected List<String> getLaunchConfigTypes()
  {
    return JUnitPlugin.getDefault().getJUnitLaunchConfigTypeIDs();
  }
  
  protected ILaunchManager getLaunchManager()
  {
    return DebugPlugin.getDefault().getLaunchManager();
  }
  
  protected String getNewName()
  {
    return getArguments().getNewName();
  }
  
  public String getName()
  {
    return JUnitMessages.TypeRenameParticipant_name;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jdt.internal.junit.refactoring.JUnitRenameParticipant
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jdt.internal.junit.refactoring;

import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.jdt.internal.junit.BasicElementLabels;
import org.eclipse.jdt.internal.junit.Messages;
import org.eclipse.jdt.internal.junit.ui.JUnitMessages;
import org.eclipse.ltk.core.refactoring.Change;
import org.eclipse.ltk.core.refactoring.NullChange;
import org.eclipse.ltk.core.refactoring.RefactoringStatus;

public abstract class LaunchConfigChange
  extends Change
{
  protected LaunchConfigurationContainer fConfig;
  private final boolean fShouldFlagWarning;
  
  public LaunchConfigChange(LaunchConfigurationContainer config, boolean shouldFlagWarning)
  {
    fConfig = config;
    fShouldFlagWarning = shouldFlagWarning;
  }
  
  public Object getModifiedElement()
  {
    return fConfig;
  }
  
  public void initializeValidationData(IProgressMonitor pm) {}
  
  public RefactoringStatus isValid(IProgressMonitor pm)
    throws CoreException
  {
    RefactoringStatus refactoringStatus = new RefactoringStatus();
    if ((!fConfig.getConfiguration().exists()) && (fShouldFlagWarning)) {
      refactoringStatus.addError(Messages.format(JUnitMessages.LaunchConfigChange_configDeleted, BasicElementLabels.getJavaElementName(fConfig.getName())));
    }
    return refactoringStatus;
  }
  
  public Change perform(IProgressMonitor pm)
    throws CoreException
  {
    if (!fConfig.getConfiguration().exists()) {
      return new NullChange();
    }
    pm.beginTask("", 1);
    String oldValue = getOldValue(fConfig.getConfiguration());
    
    ILaunchConfigurationWorkingCopy copy = fConfig.getConfiguration().getWorkingCopy();
    alterLaunchConfiguration(copy);
    fConfig.setConfiguration(copy.doSave());
    
    Change undo = getUndo(oldValue);
    
    pm.worked(1);
    return undo;
  }
  
  public boolean shouldFlagWarning()
  {
    return fShouldFlagWarning;
  }
  
  protected abstract void alterLaunchConfiguration(ILaunchConfigurationWorkingCopy paramILaunchConfigurationWorkingCopy)
    throws CoreException;
  
  protected abstract String getOldValue(ILaunchConfiguration paramILaunchConfiguration)
    throws CoreException;
  
  protected abstract Change getUndo(String paramString)
    throws CoreException;
}

/* Location:
 * Qualified Name:     org.eclipse.jdt.internal.junit.refactoring.LaunchConfigChange
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jdt.internal.junit.refactoring;

import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.debug.core.ILaunchManager;
import org.eclipse.jdt.internal.junit.Messages;
import org.eclipse.jdt.internal.junit.ui.JUnitMessages;
import org.eclipse.ltk.core.refactoring.Change;

public class LaunchConfigRenameChange
  extends LaunchConfigChange
{
  private final String fNewName;
  private final ILaunchManager fLaunchManager;
  
  public LaunchConfigRenameChange(LaunchConfigurationContainer config, String newName, ILaunchManager lm, boolean shouldFlagWarning)
  {
    super(config, shouldFlagWarning);
    fNewName = newName;
    fLaunchManager = lm;
  }
  
  protected void alterLaunchConfiguration(ILaunchConfigurationWorkingCopy copy)
    throws CoreException
  {
    if (!fLaunchManager.isExistingLaunchConfigurationName(fNewName)) {
      copy.rename(fNewName);
    }
  }
  
  protected String getOldValue(ILaunchConfiguration config)
  {
    return fConfig.getName();
  }
  
  public Change getUndo(String oldValue)
    throws CoreException
  {
    return new LaunchConfigRenameChange(fConfig, oldValue, fLaunchManager, 
      shouldFlagWarning());
  }
  
  public String getName()
  {
    return Messages.format(JUnitMessages.LaunchConfigRenameChange_name, 
      new Object[] { fConfig.getName(), fNewName });
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jdt.internal.junit.refactoring.LaunchConfigRenameChange
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jdt.internal.junit.refactoring;

import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.jdt.internal.junit.Messages;
import org.eclipse.jdt.internal.junit.ui.JUnitMessages;
import org.eclipse.ltk.core.refactoring.Change;

public class LaunchConfigSetAttributeChange
  extends LaunchConfigChange
{
  private String fNewValue;
  private final String fAttributeName;
  
  public LaunchConfigSetAttributeChange(LaunchConfigurationContainer config, String attributeName, String newValue, boolean shouldFlagWarning)
  {
    super(config, shouldFlagWarning);
    fNewValue = newValue;
    fAttributeName = attributeName;
  }
  
  protected Change getUndo(String oldValue)
    throws CoreException
  {
    return new LaunchConfigSetAttributeChange(fConfig, fAttributeName, oldValue, shouldFlagWarning());
  }
  
  public String getChangedAttributeName()
  {
    return fAttributeName;
  }
  
  protected void alterLaunchConfiguration(ILaunchConfigurationWorkingCopy copy)
    throws CoreException
  {
    copy.setAttribute(fAttributeName, fNewValue);
  }
  
  protected String getOldValue(ILaunchConfiguration config)
    throws CoreException
  {
    return config.getAttribute(fAttributeName, null);
  }
  
  public String getName()
  {
    return Messages.format(JUnitMessages.LaunchConfigSetAttributeChange_name, new Object[] { fAttributeName, fConfig.getName() });
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jdt.internal.junit.refactoring.LaunchConfigSetAttributeChange
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jdt.internal.junit.refactoring;

import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.ILaunchConfiguration;

public class LaunchConfigurationContainer
{
  private ILaunchConfiguration fConfiguration;
  
  public LaunchConfigurationContainer(ILaunchConfiguration configuration)
  {
    fConfiguration = configuration;
  }
  
  public String getName()
  {
    return fConfiguration.getName();
  }
  
  public ILaunchConfiguration getConfiguration()
  {
    return fConfiguration;
  }
  
  public void setConfiguration(ILaunchConfiguration configuration)
  {
    fConfiguration = configuration;
  }
  
  public String getAttribute(String attribute, String defaultValue)
    thro
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2017. Infinite Loop Ltd