org.eclipse.ui.externaltools_3.2.0.v20111007_r372

16:48:08.975 INFO  jd.cli.Main - Decompiling org.eclipse.ui.externaltools_3.2.0.v20111007_r372.jar
package org.eclipse.ui.externaltools.internal.launchConfigurations;

import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;

class ExternalToolsBuildTab$1
  extends SelectionAdapter
{
  final ExternalToolsBuildTab this$0;
  
  ExternalToolsBuildTab$1(ExternalToolsBuildTab paramExternalToolsBuildTab)
  {
    this$0 = paramExternalToolsBuildTab;
  }
  
  public void widgetSelected(SelectionEvent e)
  {
    ExternalToolsBuildTab.access$0(this$0);
    ExternalToolsBuildTab.access$1(this$0);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ui.externaltools.internal.launchConfigurations.ExternalToolsBuildTab.1
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.externaltools.internal.launchConfigurations;

import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.widgets.Button;

class ExternalToolsBuildTab$2
  extends SelectionAdapter
{
  final ExternalToolsBuildTab this$0;
  
  ExternalToolsBuildTab$2(ExternalToolsBuildTab paramExternalToolsBuildTab)
  {
    this$0 = paramExternalToolsBuildTab;
  }
  
  public void widgetSelected(SelectionEvent e)
  {
    if (((Button)e.getSource()).getSelection())
    {
      ExternalToolsBuildTab.access$0(this$0);
      ExternalToolsBuildTab.access$1(this$0);
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ui.externaltools.internal.launchConfigurations.ExternalToolsBuildTab.2
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.externaltools.internal.launchConfigurations;

import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;

class ExternalToolsBuildTab$3
  extends SelectionAdapter
{
  final ExternalToolsBuildTab this$0;
  
  ExternalToolsBuildTab$3(ExternalToolsBuildTab paramExternalToolsBuildTab)
  {
    this$0 = paramExternalToolsBuildTab;
  }
  
  public void widgetSelected(SelectionEvent e)
  {
    ExternalToolsBuildTab.access$2(this$0);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ui.externaltools.internal.launchConfigurations.ExternalToolsBuildTab.3
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.externaltools.internal.launchConfigurations;

import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.jface.viewers.IStructuredContentProvider;
import org.eclipse.jface.viewers.Viewer;

class ExternalToolsBuildTab$ProjectsContentProvider
  implements IStructuredContentProvider
{
  final ExternalToolsBuildTab this$0;
  
  ExternalToolsBuildTab$ProjectsContentProvider(ExternalToolsBuildTab paramExternalToolsBuildTab)
  {
    this$0 = paramExternalToolsBuildTab;
  }
  
  public Object[] getElements(Object inputElement)
  {
    return ((IWorkspace)inputElement).getRoot().getProjects();
  }
  
  public void dispose() {}
  
  public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {}
}

/* Location:
 * Qualified Name:     org.eclipse.ui.externaltools.internal.launchConfigurations.ExternalToolsBuildTab.ProjectsContentProvider
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.externaltools.internal.launchConfigurations;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.eclipse.core.externaltools.internal.launchConfigurations.ExternalToolsCoreUtil;
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.CoreException;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.debug.ui.AbstractLaunchConfigurationTab;
import org.eclipse.jface.viewers.IStructuredContentProvider;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Group;
import org.eclipse.ui.dialogs.ListSelectionDialog;
import org.eclipse.ui.externaltools.internal.model.ExternalToolsImages;
import org.eclipse.ui.externaltools.internal.model.ExternalToolsPlugin;
import org.eclipse.ui.model.WorkbenchLabelProvider;

public class ExternalToolsBuildTab
  extends AbstractLaunchConfigurationTab
{
  private Button fBuildButton;
  private Group fGroup;
  private Button fProjectButton;
  private Button fSpecificProjectsButton;
  private Button fWorkspaceButton;
  private Button fSelectButton;
  private Button fReferencedProjects;
  private List fProjects = new ArrayList();
  
  class ProjectsContentProvider
    implements IStructuredContentProvider
  {
    ProjectsContentProvider() {}
    
    public Object[] getElements(Object inputElement)
    {
      return ((IWorkspace)inputElement).getRoot().getProjects();
    }
    
    public void dispose() {}
    
    public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {}
  }
  
  public void createControl(Composite parent)
  {
    Composite mainComposite = new Composite(parent, 0);
    setControl(mainComposite);
    
    GridLayout layout = new GridLayout();
    GridData gd = new GridData(768);
    mainComposite.setLayout(layout);
    mainComposite.setLayoutData(gd);
    mainComposite.setFont(parent.getFont());
    
    fBuildButton = createCheckButton(mainComposite, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuildTab_1);
    fBuildButton.addSelectionListener(new SelectionAdapter()
    {
      public void widgetSelected(SelectionEvent e)
      {
        ExternalToolsBuildTab.this.updateEnabledState();
        updateLaunchConfigurationDialog();
      }
    });
    fGroup = new Group(mainComposite, 0);
    fGroup.setFont(mainComposite.getFont());
    layout = new GridLayout();
    numColumns = 2;
    makeColumnsEqualWidth = false;
    fGroup.setLayout(layout);
    gd = new GridData(768);
    horizontalSpan = 2;
    fGroup.setLayoutData(gd);
    
    SelectionAdapter adapter = new SelectionAdapter()
    {
      public void widgetSelected(SelectionEvent e)
      {
        if (((Button)e.getSource()).getSelection())
        {
          ExternalToolsBuildTab.this.updateEnabledState();
          updateLaunchConfigurationDialog();
        }
      }
    };
    fWorkspaceButton = createRadioButton(fGroup, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuildTab_2);
    gd = new GridData(768);
    horizontalSpan = 2;
    fWorkspaceButton.setLayoutData(gd);
    fWorkspaceButton.addSelectionListener(adapter);
    
    fProjectButton = createRadioButton(fGroup, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuildTab_3);
    gd = new GridData(768);
    horizontalSpan = 2;
    fProjectButton.setLayoutData(gd);
    fProjectButton.addSelectionListener(adapter);
    
    fSpecificProjectsButton = createRadioButton(fGroup, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuildTab_4);
    gd = new GridData(768);
    horizontalSpan = 1;
    fSpecificProjectsButton.setLayoutData(gd);
    fSpecificProjectsButton.addSelectionListener(adapter);
    
    fSelectButton = createPushButton(fGroup, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuildTab_5, null);
    gd = (GridData)fSelectButton.getLayoutData();
    horizontalAlignment = 128;
    fSelectButton.addSelectionListener(new SelectionAdapter()
    {
      public void widgetSelected(SelectionEvent e)
      {
        ExternalToolsBuildTab.this.selectResources();
      }
    });
    createVerticalSpacer(mainComposite, 1);
    fReferencedProjects = createCheckButton(mainComposite, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuildTab_6);
  }
  
  private void selectResources()
  {
    ListSelectionDialog dialog = new ListSelectionDialog(getShell(), ResourcesPlugin.getWorkspace(), new ProjectsContentProvider(), new WorkbenchLabelProvider(), ExternalToolsLaunchConfigurationMessages.ExternalToolsBuildTab_7);
    dialog.setInitialElementSelections(fProjects);
    if (dialog.open() == 1) {
      return;
    }
    Object[] res = dialog.getResult();
    fProjects = new ArrayList(res.length);
    for (int i = 0; i < res.length; i++) {
      fProjects.add(res[i]);
    }
    updateLaunchConfigurationDialog();
  }
  
  public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {}
  
  public void initializeFrom(ILaunchConfiguration configuration)
  {
    updateScope(configuration);
    updateReferencedProjects(configuration);
    updateEnabledState();
  }
  
  private void updateReferencedProjects(ILaunchConfiguration configuration)
  {
    boolean ref = false;
    try
    {
      ref = configuration.getAttribute("org.eclipse.ui.externaltools.ATTR_INCLUDE_REFERENCED_PROJECTS", true);
    }
    catch (CoreException e)
    {
      ExternalToolsPlugin.getDefault().log("Exception reading launch configuration", e);
    }
    fReferencedProjects.setSelection(ref);
  }
  
  private void updateScope(ILaunchConfiguration configuration)
  {
    String scope = null;
    try
    {
      scope = configuration.getAttribute("org.eclipse.ui.externaltools.ATTR_LAUNCH_CONFIGURATION_BUILD_SCOPE", null);
    }
    catch (CoreException ce)
    {
      ExternalToolsPlugin.getDefault().log("Exception reading launch configuration", ce);
    }
    fBuildButton.setSelection(scope != null);
    fWorkspaceButton.setSelection(false);
    fProjectButton.setSelection(false);
    fSpecificProjectsButton.setSelection(false);
    fProjects.clear();
    if (scope == null)
    {
      fBuildButton.setSelection(true);
      fWorkspaceButton.setSelection(true);
    }
    else if (scope.equals("${none}"))
    {
      fBuildButton.setSelection(false);
    }
    else if (scope.equals("${project}"))
    {
      fProjectButton.setSelection(true);
    }
    else if (scope.startsWith("${projects:"))
    {
      fSpecificProjectsButton.setSelection(true);
      IProject[] projects = getBuildProjects(configuration, "org.eclipse.ui.externaltools.ATTR_LAUNCH_CONFIGURATION_BUILD_SCOPE");
      fProjects = new ArrayList(projects.length);
      for (int i = 0; i < projects.length; i++) {
        fProjects.add(projects[i]);
      }
    }
  }
  
  public void performApply(ILaunchConfigurationWorkingCopy configuration)
  {
    String scope = generateScopeMemento();
    configuration.setAttribute("org.eclipse.ui.externaltools.ATTR_LAUNCH_CONFIGURATION_BUILD_SCOPE", scope);
    if (fReferencedProjects.getSelection()) {
      configuration.setAttribute("org.eclipse.ui.externaltools.ATTR_INCLUDE_REFERENCED_PROJECTS", null);
    } else {
      configuration.setAttribute("org.eclipse.ui.externaltools.ATTR_INCLUDE_REFERENCED_PROJECTS", false);
    }
  }
  
  private String generateScopeMemento()
  {
    if (fBuildButton.getSelection())
    {
      if (fWorkspaceButton.getSelection()) {
        return null;
      }
      if (fProjectButton.getSelection()) {
        return "${project}";
      }
      if (fSpecificProjectsButton.getSelection()) {
        return getBuildScopeAttribute(fProjects);
      }
      return null;
    }
    return "${none}";
  }
  
  public String getName()
  {
    return ExternalToolsLaunchConfigurationMessages.ExternalToolsBuildTab_8;
  }
  
  private void updateEnabledState()
  {
    boolean enabled = fBuildButton.getSelection();
    fGroup.setEnabled(enabled);
    fWorkspaceButton.setEnabled(enabled);
    fProjectButton.setEnabled(enabled);
    fSpecificProjectsButton.setEnabled(enabled);
    fSelectButton.setEnabled((enabled) && (fSpecificProjectsButton.getSelection()));
    if (!enabled) {
      super.setErrorMessage(null);
    }
    if ((enabled) && 
      (!fWorkspaceButton.getSelection()) && (!fProjectButton.getSelection()) && 
      (!fSpecificProjectsButton.getSelection())) {
      fWorkspaceButton.setSelection(true);
    }
    fReferencedProjects.setEnabled((fBuildButton.getSelection()) && ((fProjectButton.getSelection()) || (fSpecificProjectsButton.getSelection())));
  }
  
  public Image getImage()
  {
    return ExternalToolsImages.getImage("org.eclipse.ui.externaltools.IMG_TAB_BUILD");
  }
  
  public boolean isValid(ILaunchConfiguration launchConfig)
  {
    setErrorMessage(null);
    setMessage(null);
    if ((fBuildButton.getSelection()) && (fSpecificProjectsButton.getSelection()) && (fProjects.isEmpty()))
    {
      setErrorMessage(ExternalToolsLaunchConfigurationMessages.ExternalToolsBuildTab_9);
      return false;
    }
    return true;
  }
  
  public static IProject[] getBuildProjects(ILaunchConfiguration configuration, String buildScopeId)
  {
    return ExternalToolsCoreUtil.getBuildProjects(configuration, 
      buildScopeId);
  }
  
  public static boolean isIncludeReferencedProjects(ILaunchConfiguration configuration, String includeReferencedProjectsId)
    throws CoreException
  {
    return ExternalToolsCoreUtil.isIncludeReferencedProjects(configuration, 
      includeReferencedProjectsId);
  }
  
  public static String getBuildScopeAttribute(List projects)
  {
    StringBuffer buf = new StringBuffer();
    buf.append("${projects:");
    Iterator iterator = projects.iterator();
    while (iterator.hasNext())
    {
      IProject project = (IProject)iterator.next();
      buf.append(project.getName());
      if (iterator.hasNext()) {
        buf.append(",");
      }
    }
    buf.append("}");
    return buf.toString();
  }
  
  public void activated(ILaunchConfigurationWorkingCopy workingCopy) {}
  
  public void deactivated(ILaunchConfigurationWorkingCopy workingCopy) {}
}

/* Location:
 * Qualified Name:     org.eclipse.ui.externaltools.internal.launchConfigurations.ExternalToolsBuildTab
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.externaltools.internal.launchConfigurations;

import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.widgets.Button;

class ExternalToolsBuilderTab$1
  extends SelectionAdapter
{
  final ExternalToolsBuilderTab this$0;
  
  ExternalToolsBuilderTab$1(ExternalToolsBuilderTab paramExternalToolsBuilderTab)
  {
    this$0 = paramExternalToolsBuilderTab;
  }
  
  public void widgetSelected(SelectionEvent e)
  {
    boolean enabled = (!ExternalToolsBuilderTab.access$0(this$0)) || (this$0.autoBuildButton.getSelection()) || (this$0.manualBuild.getSelection());
    this$0.workingSetButton.setEnabled(enabled);
    this$0.specifyResources.setEnabled((enabled) && (this$0.workingSetButton.getSelection()));
    ExternalToolsBuilderTab.access$1(this$0);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ui.externaltools.internal.launchConfigurations.ExternalToolsBuilderTab.1
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.externaltools.internal.launchConfigurations;

import org.eclipse.debug.ui.StringVariableSelectionDialog;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.widgets.Text;

class ExternalToolsBuilderTab$10
  implements SelectionListener
{
  final ExternalToolsBuilderTab this$0;
  
  ExternalToolsBuilderTab$10(ExternalToolsBuilderTab paramExternalToolsBuilderTab)
  {
    this$0 = paramExternalToolsBuilderTab;
  }
  
  public void widgetSelected(SelectionEvent e)
  {
    StringVariableSelectionDialog dialog = new StringVariableSelectionDialog(ExternalToolsBuilderTab.access$9(this$0));
    dialog.open();
    String variable = dialog.getVariableExpression();
    if (variable != null) {
      ExternalToolsBuilderTab.access$4(this$0).insert(variable);
    }
  }
  
  public void widgetDefaultSelected(SelectionEvent e) {}
}

/* Location:
 * Qualified Name:     org.eclipse.ui.externaltools.internal.launchConfigurations.ExternalToolsBuilderTab.10
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.externaltools.internal.launchConfigurations;

import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;

class ExternalToolsBuilderTab$2
  extends SelectionAdapter
{
  final ExternalToolsBuilderTab this$0;
  
  ExternalToolsBuilderTab$2(ExternalToolsBuilderTab paramExternalToolsBuilderTab)
  {
    this$0 = paramExternalToolsBuilderTab;
  }
  
  public void widgetSelected(SelectionEvent e)
  {
    ExternalToolsBuilderTab.access$1(this$0);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ui.externaltools.internal.launchConfigurations.ExternalToolsBuilderTab.2
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.externaltools.internal.launchConfigurations;

import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;

class ExternalToolsBuilderTab$3
  extends SelectionAdapter
{
  final ExternalToolsBuilderTab this$0;
  
  ExternalToolsBuilderTab$3(ExternalToolsBuilderTab paramExternalToolsBuilderTab)
  {
    this$0 = paramExternalToolsBuilderTab;
  }
  
  public void widgetSelected(SelectionEvent e)
  {
    ExternalToolsBuilderTab.access$2(this$0);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ui.externaltools.internal.launchConfigurations.ExternalToolsBuilderTab.3
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.externaltools.internal.launchConfigurations;

import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;

class ExternalToolsBuilderTab$4
  extends SelectionAdapter
{
  final ExternalToolsBuilderTab this$0;
  
  ExternalToolsBuilderTab$4(ExternalToolsBuilderTab paramExternalToolsBuilderTab)
  {
    this$0 = paramExternalToolsBuilderTab;
  }
  
  public void widgetSelected(SelectionEvent e)
  {
    ExternalToolsBuilderTab.access$1(this$0);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ui.externaltools.internal.launchConfigurations.ExternalToolsBuilderTab.4
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.externaltools.internal.launchConfigurations;

import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Text;

class ExternalToolsBuilderTab$5
  extends SelectionAdapter
{
  final ExternalToolsBuilderTab this$0;
  
  ExternalToolsBuilderTab$5(ExternalToolsBuilderTab paramExternalToolsBuilderTab)
  {
    this$0 = paramExternalToolsBuilderTab;
  }
  
  public void widgetSelected(SelectionEvent e)
  {
    boolean enabled = ExternalToolsBuilderTab.access$3(this$0).getSelection();
    ExternalToolsBuilderTab.access$4(this$0).setEnabled(enabled);
    ExternalToolsBuilderTab.access$5(this$0).setEnabled(enabled);
    ExternalToolsBuilderTab.access$6(this$0).setEnabled(enabled);
    ExternalToolsBuilderTab.access$7(this$0).setEnabled(enabled);
    ExternalToolsBuilderTab.access$8(this$0).setEnabled(enabled);
    ExternalToolsBuilderTab.access$1(this$0);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ui.externaltools.internal.launchConfigurations.ExternalToolsBuilderTab.5
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.externaltools.internal.launchConfigurations;

import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;

class ExternalToolsBuilderTab$6
  extends SelectionAdapter
{
  final ExternalToolsBuilderTab this$0;
  
  ExternalToolsBuilderTab$6(ExternalToolsBuilderTab paramExternalToolsBuilderTab)
  {
    this$0 = paramExternalToolsBuilderTab;
  }
  
  public void widgetSelected(SelectionEvent e)
  {
    ExternalToolsBuilderTab.access$1(this$0);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ui.externaltools.internal.launchConfigurations.ExternalToolsBuilderTab.6
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.externaltools.internal.launchConfigurations;

import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.variables.IStringVariableManager;
import org.eclipse.core.variables.VariablesPlugin;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.dialogs.ElementTreeSelectionDialog;
import org.eclipse.ui.model.WorkbenchContentProvider;
import org.eclipse.ui.model.WorkbenchLabelProvider;
import org.eclipse.ui.views.navigator.ResourceComparator;

class ExternalToolsBuilderTab$7
  extends SelectionAdapter
{
  final ExternalToolsBuilderTab this$0;
  
  ExternalToolsBuilderTab$7(ExternalToolsBuilderTab paramExternalToolsBuilderTab)
  {
    this$0 = paramExternalToolsBuilderTab;
  }
  
  public void widgetSelected(SelectionEvent e)
  {
    ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(ExternalToolsBuilderTab.access$9(this$0), new WorkbenchLabelProvider(), new WorkbenchContentProvider());
    dialog.setTitle(ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_24);
    dialog.setMessage(ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_25);
    dialog.setInput(ResourcesPlugin.getWorkspace().getRoot());
    dialog.setComparator(new ResourceComparator(1));
    int buttonId = dialog.open();
    if (buttonId == 0)
    {
      IResource resource = (IResource)dialog.getFirstResult();
      String arg = resource.getFullPath().toString();
      String fileLoc = VariablesPlugin.getDefault().getStringVariableManager().generateVariableExpression("workspace_loc", arg);
      ExternalToolsBuilderTab.access$4(this$0).setText(fileLoc);
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ui.externaltools.internal.launchConfigurations.ExternalToolsBuilderTab.7
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.externaltools.internal.launchConfigurations;

import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.swt.widgets.Text;

class ExternalToolsBuilderTab$8
  extends SelectionAdapter
{
  final ExternalToolsBuilderTab this$0;
  
  ExternalToolsBuilderTab$8(ExternalToolsBuilderTab paramExternalToolsBuilderTab)
  {
    this$0 = paramExternalToolsBuilderTab;
  }
  
  public void widgetSelected(SelectionEvent e)
  {
    String filePath = ExternalToolsBuilderTab.access$4(this$0).getText();
    FileDialog dialog = new FileDialog(ExternalToolsBuilderTab.access$9(this$0), 8192);
    
    filePath = dialog.open();
    if (filePath != null) {
      ExternalToolsBuilderTab.access$4(this$0).setText(filePath);
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ui.externaltools.internal.launchConfigurations.ExternalToolsBuilderTab.8
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.externaltools.internal.launchConfigurations;

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

class ExternalToolsBuilderTab$9
  implements ModifyListener
{
  final ExternalToolsBuilderTab this$0;
  
  ExternalToolsBuilderTab$9(ExternalToolsBuilderTab paramExternalToolsBuilderTab)
  {
    this$0 = paramExternalToolsBuilderTab;
  }
  
  public void modifyText(ModifyEvent e)
  {
    ExternalToolsBuilderTab.access$1(this$0);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ui.externaltools.internal.launchConfigurations.ExternalToolsBuilderTab.9
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.externaltools.internal.launchConfigurations;

import org.eclipse.core.externaltools.internal.launchConfigurations.ExternalToolsCoreUtil;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.variables.IStringVariableManager;
import org.eclipse.core.variables.VariablesPlugin;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.debug.ui.AbstractLaunchConfigurationTab;
import org.eclipse.debug.ui.RefreshTab;
import org.eclipse.debug.ui.StringVariableSelectionDialog;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.ISharedImages;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkingSet;
import org.eclipse.ui.IWorkingSetManager;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.dialogs.ElementTreeSelectionDialog;
import org.eclipse.ui.dialogs.IWorkingSetEditWizard;
import org.eclipse.ui.externaltools.internal.model.BuilderUtils;
import org.eclipse.ui.externaltools.internal.model.ExternalToolsPlugin;
import org.eclipse.ui.help.IWorkbenchHelpSystem;
import org.eclipse.ui.model.WorkbenchContentProvider;
import org.eclipse.ui.model.WorkbenchLabelProvider;
import org.eclipse.ui.views.navigator.ResourceComparator;

public class ExternalToolsBuilderTab
  extends AbstractLaunchConfigurationTab
{
  protected Button afterClean;
  protected Button fDuringClean;
  protected Button autoBuildButton;
  protected Button manualBuild;
  protected Button workingSetButton;
  protected Button specifyResources;
  protected Button fLaunchInBackgroundButton;
  protected IWorkingSet workingSet;
  protected ILaunchConfiguration fConfiguration;
  private boolean fCreateBuildScheduleComponent = true;
  private Button fConsoleOutput;
  private Button fFileOutput;
  private Button fFileBrowse;
  private Text fFileText;
  private Button fVariables;
  private Button fAppend;
  private Button fWorkspaceBrowse;
  
  public ExternalToolsBuilderTab() {}
  
  public ExternalToolsBuilderTab(boolean createBuildScheduleComponent)
  {
    fCreateBuildScheduleComponent = createBuildScheduleComponent;
  }
  
  protected SelectionListener selectionListener = new SelectionAdapter()
  {
    public void widgetSelected(SelectionEvent e)
    {
      boolean enabled = (!fCreateBuildScheduleComponent) || (autoBuildButton.getSelection()) || (manualBuild.getSelection());
      workingSetButton.setEnabled(enabled);
      specifyResources.setEnabled((enabled) && (workingSetButton.getSelection()));
      updateLaunchConfigurationDialog();
    }
  };
  
  public void createControl(Composite parent)
  {
    Composite mainComposite = new Composite(parent, 0);
    setControl(mainComposite);
    PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), "org.eclipse.ui.externaltools.builders_tab_context");
    
    GridLayout layout = new GridLayout();
    GridData gridData = new GridData(768);
    horizontalSpan = 2;
    numColumns = 2;
    makeColumnsEqualWidth = false;
    mainComposite.setLayout(layout);
    mainComposite.setLayoutData(gridData);
    mainComposite.setFont(parent.getFont());
    createOutputCaptureComponent(mainComposite);
    createLaunchInBackgroundComposite(mainComposite);
    createBuildScheduleComponent(mainComposite);
  }
  
  protected void createLaunchInBackgroundComposite(Composite parent)
  {
    fLaunchInBackgroundButton = createCheckButton(parent, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_14);
    GridData data = new GridData(256);
    horizontalSpan = 2;
    fLaunchInBackgroundButton.setLayoutData(data);
    fLaunchInBackgroundButton.addSelectionListener(new SelectionAdapter()
    {
      public void widgetSelected(SelectionEvent e)
      {
        updateLaunchConfigurationDialog();
      }
    });
  }
  
  protected void createBuildScheduleComponent(Composite parent)
  {
    if (fCreateBuildScheduleComponent)
    {
      Label label = new Label(parent, 0);
      label.setText(ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_Run_this_builder_for__1);
      label.setFont(parent.getFont());
      afterClean = createButton(parent, selectionListener, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab__Full_builds_2, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_Full, 2);
      manualBuild = createButton(parent, selectionListener, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab__Incremental_builds_4, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_Inc, 2);
      autoBuildButton = createButton(parent, selectionListener, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab__Auto_builds__Not_recommended__6, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_Auto, 2);
      fDuringClean = createButton(parent, selectionListener, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_0, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_1, 2);
      
      createVerticalSpacer(parent, 2);
    }
    workingSetButton = createButton(parent, selectionListener, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_workingSet_label, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_workingSet_tooltip, 1);
    specifyResources = createPushButton(parent, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_13, null);
    GridData gd = new GridData(128);
    specifyResources.setLayoutData(gd);
    specifyResources.addSelectionListener(new SelectionAdapter()
    {
      public void widgetSelected(SelectionEvent e)
      {
        ExternalToolsBuilderTab.this.selectResources();
      }
    });
    Label label = new Label(parent, 0);
    label.setText(ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_2);
    label.setFont(parent.getFont());
  }
  
  private void createOutputCaptureComponent(Composite parent)
  {
    Group group = new Group(parent, 0);
    group.setText(ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_17);
    GridData gd = new GridData(4, 0, true, false);
    horizontalSpan = 2;
    group.setLayoutData(gd);
    GridLayout layout = new GridLayout(5, false);
    group.setLayout(layout);
    group.setFont(parent.getFont());
    
    fConsoleOutput = createCheckButton(group, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_18);
    gd = new GridData(1, 0, true, false);
    horizontalSpan = 5;
    fConsoleOutput.setLayoutData(gd);
    
    fConsoleOutput.addSelectionListener(new SelectionAdapter()
    {
      public void widgetSelected(SelectionEvent e)
      {
        updateLaunchConfigurationDialog();
      }
    });
    fFileOutput = createCheckButton(group, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_19);
    fFileOutput.setLayoutData(new GridData(1, 0, false, false));
    
    fFileText = new Text(group, 2052);
    gd = new GridData(4, 0, true, false);
    horizontalSpan = 4;
    fFileText.setLayoutData(gd);
    fFileText.setFont(parent.getFont());
    
    Label spacer = new Label(group, 0);
    gd = new GridData(4, 0, true, false);
    horizontalSpan = 2;
    spacer.setLayoutData(gd);
    fWorkspaceBrowse = createPushButton(group, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_20, null);
    fFileBrowse = createPushButton(group, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_21, null);
    fVariables = createPushButton(group, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_22, null);
    
    spacer = new Label(group, 0);
    spacer.setLayoutData(new GridData(4, 0, false, false));
    fAppend = createCheckButton(group, ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_23);
    gd = new GridData(16384, 128, true, false);
    horizontalSpan = 4;
    fAppend.setLayoutData(gd);
    
    fFileOutput.addSelectionListener(new SelectionAdapter()
    {
      public void widgetSelected(SelectionEvent e)
      {
        boolean enabled = fFileOutput.getSelection();
        fFileText.setEnabled(enabled);
        fFileBrowse.setEnabled(enabled);
        fWorkspaceBrowse.setEnabled(enabled);
        fVariables.setEnabled(enabled);
        fAppend.setEnabled(enabled);
        updateLaunchConfigurationDialog();
      }
    });
    fAppend.addSelectionListener(new SelectionAdapter()
    {
      public void widgetSelected(SelectionEvent e)
      {
        updateLaunchConfigurationDialog();
      }
    });
    fWorkspaceBrowse.addSelectionListener(new SelectionAdapter()
    {
      public void widgetSelected(SelectionEvent e)
      {
        ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(getShell(), new WorkbenchLabelProvider(), new WorkbenchContentProvider());
        dialog.setTitle(ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_24);
        dialog.setMessage(ExternalToolsLaunchConfigurationMessages.ExternalToolsBuilderTab_25);
        dialog.setInput(ResourcesPlugin.getWorkspace().getRoot());
        dialog.setComparator(new ResourceComparator(1));
        int buttonId = dialog.open();
        if (buttonId == 0)
        {
          IResource resource = (IResource)dialog.getFirstResult();
          String arg = resource.getFullPath().toString();
          String fileLoc = VariablesPlugin.getDefault().getStringVariableManager().generateVariableExpression("workspace_loc", arg);
          fFileText.setText(fileLoc);
        }
      }
    });
    fFileBrowse.addSelectionListener(new SelectionAdapter()
    {
      public void widgetSelected(SelectionEvent e)
      {
        String filePath = fFileText.getText();
        FileDialog dialog = new FileDialog(getShell(), 8192);
        
        filePath = dialog.open();
        if (filePath != null) {
          fFileText.setText(filePath);
        }
      }
    });
    fFileText.addModifyListener(new ModifyListener()
    {
      public void modifyText(ModifyEvent e)
      {
        updateLaunchConfigurationDialog();
      }
    });
    fVariables.addSelectionListener(new SelectionListener()
    {
      public void widgetSelected(SelectionEvent e)
      {
        StringVariableSelectionDialog dialog = new StringVariableSelectionDialog(getShell());
        dialog.open();
        String variable = dialog.getVariableExpression();
        if (variable != null) {
          fFileText.insert(variable);
        }
      }
      
      public void widgetDefaultSelected(SelectionEvent e) {}
    });
  }
  
  protected Button createButton(Composite parent, SelectionListener listener, String text, String tooltipText, int columns)
  {
    Button button = createCheckButton(parent, text);
    button.setToolTipText(tooltipText);
    button.addSelectionListener(listener);
    GridData gd = new GridData(768);
    horizontalSpan = columns;
    button.setLayoutData(gd);
    return button;
  }
  
  public void setDefaults(ILaunchConfigurationWorkingCopy configuration)
  {
    StringBuffer buffer = new StringBuffer("full");
    buffer.append(',');
    buffer.append("incremental");
    buffer.append(',');
    configuration.setAttribute("org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS", buffer.toString());
    configuration.setAttribute("org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND", false);
    configuration.setAttribute("org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED", true);
  }
  
  public void initializeFrom(ILaunchConfiguration configuration)
  {
    fConfiguration = configuration;
    if (fCreateBuildScheduleComponent)
    {
      afterClean.setSelection(false);
      manualBuild.setSelection(false);
      autoBuildButton.setSelection(false);
      fDuringClean.setSelection(false);
    }
    String buildKindString = null;
    String buildScope = null;
    try
    {
      buildKindString = configuration.getAttribute("org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS", "");
      buildScope = configuration.getAttribute("org.eclipse.ui.externaltools.ATTR_BUILD_SCOPE", null);
    }
    catch (CoreException localCoreException) {}
    workingSetButton.setSelection(buildScope != null);
    workingSetButton.setEnabled(buildScope != null);
    if (buildScope != null) {
      workingSet = RefreshTab.getWorkingSet(buildScope);
    }
    if (fCreateBuildScheduleComponent)
    {
      int[] buildTypes = BuilderUtils.buildTypesToArray(buildKindString);
      for (int i = 0; i < buildTypes.length; i++) {
        switch (buildTypes[i])
        {
        case 6: 
          afterClean.setSelection(true);
          break;
        case 10: 
          manualBuild.setSelection(true);
          break;
        case 9: 
          autoBuildButton.setSelection(true);
          break;
        case 15: 
          fDuringClean.setSelection(true);
        }
      }
    }
    boolean enabled = true;
    if (fCreateBuildScheduleComponent) {
      enabled = (autoBuildButton.getSelection()) || (manualBuild.getSelection());
    }
    workingSetButton.setEnabled(enabled);
    specifyResources.setEnabled((enabled) && (workingSetButton.getSelection()));
    updateRunInBackground(configuration);
    updateConsoleOutput(configuration);
  }
  
  protected void updateRunInBackground(ILaunchConfiguration configuration)
  {
    fLaunchInBackgroundButton.setSelection(ExternalToolsCoreUtil.isAsynchronousBuild(configuration));
  }
  
  private void updateConsoleOutput(ILaunchConfiguration configuration)
  {
    boolean outputToConsole = true;
    String outputFile = null;
    boolean append = false;
    try
    {
      outputToConsole = configuration.getAttribute("org.eclipse.debug.ui.ATTR_CONSOLE_OUTPUT_ON", true);
      outputFile = configuration.getAttribute("org.eclipse.debug.ui.ATTR_CAPTURE_IN_FILE", null);
      append = configuration.getAttribute("org.eclipse.debug.ui.ATTR_APPEND_TO_FILE", false);
    }
    catch (CoreException localCoreException) {}
    fConsoleOutput.setSelection(outputToConsole);
    fAppend.setSelection(append);
    boolean haveOutputFile = outputFile != null;
    if (haveOutputFile) {
      fFileText.setText(outputFile);
    }
    fFileOutput.setSelection(haveOutputFile);
    fFileText.setEnabled(haveOutputFile);
    fFileBrowse.setEnabled(haveOutputFile);
    fWorkspaceBrowse.setEnabled(haveOutputFile);
    fVariables.setEnabled(haveOutputFile);
    fAppend.setEnabled(haveOutputFile);
  }
  
  public void performApply(ILaunchConfigurationWorkingCopy configuration)
  {
    if (fCreateBuildScheduleComponent)
    {
      StringBuffer buffer = new StringBuffer();
      if (afterClean.getSelection()) {
        buffer.append("full").append(',');
      }
      if (manualBuild.getSelection()) {
        buffer.append("incremental").append(',');
      }
      if (autoBuildButton.getSelection()) {
        buffer.append("auto").append(',');
      }
      if (fDuringClean.getSelection()) {
        buffer.append("clean");
      }
      configuration.setAttribute("org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS", buffer.toString());
    }
    if (workingSetButton.getSelection())
    {
      String scope = RefreshTab.getRefreshAttribute(workingSet);
      configuration.setAttribute("org.eclipse.ui.
1 2 3 4 5 6

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-2019. Infinite Loop Ltd