org.eclipse.ui.ide_3.8.2.v20121106-165923

16:48:16.064 INFO  jd.cli.Main - Decompiling org.eclipse.ui.ide_3.8.2.v20121106-165923.jar
package org.eclipse.ui;

import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IAdaptable;

public abstract interface IContributorResourceAdapter
{
  public abstract IResource getAdaptedResource(IAdaptable paramIAdaptable);
}

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

import org.eclipse.core.resources.IFile;

public abstract interface IFileEditorInput
  extends IStorageEditorInput
{
  public abstract IFile getFile();
}

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

public abstract interface IMarkerActionFilter
  extends IActionFilter
{
  public static final String TYPE = "type";
  public static final String SUPER_TYPE = "superType";
  public static final String PRIORITY = "priority";
  public static final String SEVERITY = "severity";
  public static final String DONE = "done";
  public static final String MESSAGE = "message";
  public static final String RESOURCE_TYPE = "resourceType";
}

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

import org.eclipse.core.resources.IMarker;

public abstract interface IMarkerHelpRegistry
{
  public abstract String getHelp(IMarker paramIMarker);
  
  public abstract boolean hasResolutions(IMarker paramIMarker);
  
  public abstract IMarkerResolution[] getResolutions(IMarker paramIMarker);
}

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

import org.eclipse.core.resources.IMarker;

public abstract interface IMarkerResolution
{
  public abstract String getLabel();
  
  public abstract void run(IMarker paramIMarker);
}

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

import org.eclipse.swt.graphics.Image;

public abstract interface IMarkerResolution2
  extends IMarkerResolution
{
  public abstract String getDescription();
  
  public abstract Image getImage();
}

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

import org.eclipse.core.resources.IMarker;

public abstract interface IMarkerResolutionGenerator
{
  public abstract IMarkerResolution[] getResolutions(IMarker paramIMarker);
}

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

import org.eclipse.core.resources.IMarker;

public abstract interface IMarkerResolutionGenerator2
  extends IMarkerResolutionGenerator
{
  public abstract boolean hasResolutions(IMarker paramIMarker);
}

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

public abstract interface IProjectActionFilter
  extends IResourceActionFilter
{
  public static final String NATURE = "nature";
  public static final String OPEN = "open";
}

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

public abstract interface IResourceActionFilter
  extends IActionFilter
{
  public static final String NAME = "name";
  public static final String EXTENSION = "extension";
  public static final String PATH = "path";
  public static final String READ_ONLY = "readOnly";
  public static final String PROJECT_NATURE = "projectNature";
  public static final String PERSISTENT_PROPERTY = "persistentProperty";
  public static final String PROJECT_PERSISTENT_PROPERTY = "projectPersistentProperty";
  public static final String SESSION_PROPERTY = "sessionProperty";
  public static final String PROJECT_SESSION_PROPERTY = "projectSessionProperty";
  /**
   * @deprecated
   */
  public static final String XML_FIRST_TAG = "xmlFirstTag";
  /**
   * @deprecated
   */
  public static final String XML_DTD_NAME = "xmlDTDName";
  public static final String CONTENT_TYPE_ID = "contentTypeId";
}

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

import org.eclipse.core.resources.IStorage;
import org.eclipse.core.runtime.CoreException;

public abstract interface IStorageEditorInput
  extends IEditorInput
{
  public abstract IStorage getStorage()
    throws CoreException;
}

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

import java.net.URI;

public abstract interface IURIEditorInput
  extends IEditorInput
{
  public abstract URI getURI();
}

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

import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IPath;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerFilter;

public class ResourceWorkingSetFilter
  extends ViewerFilter
{
  private IWorkingSet workingSet = null;
  private IAdaptable[] cachedWorkingSet = null;
  
  public IWorkingSet getWorkingSet()
  {
    return workingSet;
  }
  
  public void setWorkingSet(IWorkingSet workingSet)
  {
    this.workingSet = workingSet;
  }
  
  public boolean select(Viewer viewer, Object parentElement, Object element)
  {
    IResource resource = null;
    if ((workingSet == null) || ((workingSet.isAggregateWorkingSet()) && 
      (workingSet.isEmpty()))) {
      return true;
    }
    if ((element instanceof IResource))
    {
      resource = (IResource)element;
    }
    else if ((element instanceof IAdaptable))
    {
      IAdaptable adaptable = (IAdaptable)element;
      resource = (IResource)adaptable.getAdapter(IResource.class);
    }
    if (resource != null) {
      return isEnclosed(resource);
    }
    return true;
  }
  
  private boolean isEnclosed(IResource element)
  {
    IPath elementPath = element.getFullPath();
    IAdaptable[] workingSetElements = cachedWorkingSet;
    if (workingSetElements == null) {
      workingSetElements = workingSet.getElements();
    }
    for (int i = 0; i < workingSetElements.length; i++)
    {
      IAdaptable workingSetElement = workingSetElements[i];
      IContainmentAdapter containmentAdapter = (IContainmentAdapter)workingSetElement
        .getAdapter(IContainmentAdapter.class);
      if (containmentAdapter != null)
      {
        if (containmentAdapter.contains(workingSetElement, element, 
          15)) {
          return true;
        }
      }
      else if (isEnclosedResource(element, elementPath, 
        workingSetElement)) {
        return true;
      }
    }
    return false;
  }
  
  private boolean isEnclosedResource(IResource element, IPath elementPath, IAdaptable workingSetElement)
  {
    IResource workingSetResource = null;
    if (workingSetElement.equals(element)) {
      return true;
    }
    if ((workingSetElement instanceof IResource)) {
      workingSetResource = (IResource)workingSetElement;
    } else {
      workingSetResource = (IResource)workingSetElement
        .getAdapter(IResource.class);
    }
    if (workingSetResource != null)
    {
      IPath resourcePath = workingSetResource.getFullPath();
      if (resourcePath.isPrefixOf(elementPath)) {
        return true;
      }
      if (elementPath.isPrefixOf(resourcePath)) {
        return true;
      }
    }
    return false;
  }
  
  /* Error */
  public Object[] filter(Viewer viewer, Object parent, Object[] elements)
  {
    // Byte code:
    //   0: aconst_null
    //   1: astore 4
    //   3: aload_0
    //   4: getfield 118	org/eclipse/ui/ResourceWorkingSetFilter:workingSet	Lorg/eclipse/ui/IWorkingSet;
    //   7: ifnull +16 -> 23
    //   10: aload_0
    //   11: aload_0
    //   12: getfield 118	org/eclipse/ui/ResourceWorkingSetFilter:workingSet	Lorg/eclipse/ui/IWorkingSet;
    //   15: invokeinterface 133 1 0
    //   20: putfield 117	org/eclipse/ui/ResourceWorkingSetFilter:cachedWorkingSet	[Lorg/eclipse/core/runtime/IAdaptable;
    //   23: aload_0
    //   24: aload_1
    //   25: aload_2
    //   26: aload_3
    //   27: invokespecial 124	org/eclipse/jface/viewers/ViewerFilter:filter	(Lorg/eclipse/jface/viewers/Viewer;Ljava/lang/Object;[Ljava/lang/Object;)[Ljava/lang/Object;
    //   30: astore 4
    //   32: goto +13 -> 45
    //   35: astore 5
    //   37: aload_0
    //   38: aconst_null
    //   39: putfield 117	org/eclipse/ui/ResourceWorkingSetFilter:cachedWorkingSet	[Lorg/eclipse/core/runtime/IAdaptable;
    //   42: aload 5
    //   44: athrow
    //   45: aload_0
    //   46: aconst_null
    //   47: putfield 117	org/eclipse/ui/ResourceWorkingSetFilter:cachedWorkingSet	[Lorg/eclipse/core/runtime/IAdaptable;
    //   50: aload 4
    //   52: areturn
    // Line number table:
    //   Java source line #163	-> byte code offset #0
    //   Java source line #164	-> byte code offset #3
    //   Java source line #165	-> byte code offset #10
    //   Java source line #168	-> byte code offset #23
    //   Java source line #169	-> byte code offset #35
    //   Java source line #170	-> byte code offset #37
    //   Java source line #171	-> byte code offset #42
    //   Java source line #170	-> byte code offset #45
    //   Java source line #172	-> byte code offset #50
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	53	0	this	ResourceWorkingSetFilter
    //   0	53	1	viewer	Viewer
    //   0	53	2	parent	Object
    //   0	53	3	elements	Object[]
    //   1	50	4	result	Object[]
    //   35	8	5	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   23	35	35	finally
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ui.ResourceWorkingSetFilter
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.actions;

import org.eclipse.jface.window.IShellProvider;
import org.eclipse.swt.widgets.Shell;

class AddBookmarkAction$1
  implements IShellProvider
{
  final AddBookmarkAction this$0;
  private final Shell val$shell;
  
  AddBookmarkAction$1(AddBookmarkAction paramAddBookmarkAction, Shell paramShell)
  {
    this$0 = paramAddBookmarkAction;val$shell = paramShell;
  }
  
  public Shell getShell()
  {
    return val$shell;
  }
}

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

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.commands.operations.IOperationHistory;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.Assert;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.window.IShellProvider;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.help.IWorkbenchHelpSystem;
import org.eclipse.ui.ide.undo.CreateMarkersOperation;
import org.eclipse.ui.ide.undo.WorkspaceUndoUtil;
import org.eclipse.ui.internal.ide.IDEWorkbenchMessages;
import org.eclipse.ui.internal.ide.IDEWorkbenchPlugin;
import org.eclipse.ui.internal.views.bookmarkexplorer.BookmarkMessages;
import org.eclipse.ui.operations.IWorkbenchOperationSupport;
import org.eclipse.ui.views.bookmarkexplorer.BookmarkPropertiesDialog;

public class AddBookmarkAction
  extends SelectionListenerAction
{
  public static final String ID = "org.eclipse.ui.AddBookmarkAction";
  private IShellProvider shellProvider;
  private boolean promptForName = true;
  
  /**
   * @deprecated
   */
  public AddBookmarkAction(Shell shell)
  {
    this(shell, true);
  }
  
  /**
   * @deprecated
   */
  public AddBookmarkAction(Shell shell, boolean promptForName)
  {
    super(IDEWorkbenchMessages.AddBookmarkLabel);
    Assert.isNotNull(shell);
    shellProvider = new IShellProvider()
    {
      private final Shell val$shell;
      
      public Shell getShell()
      {
        return val$shell;
      }
    };
    initAction(promptForName);
  }
  
  public AddBookmarkAction(IShellProvider provider, boolean promptForName)
  {
    super(IDEWorkbenchMessages.AddBookmarkLabel);
    Assert.isNotNull(provider);
    shellProvider = provider;
    initAction(promptForName);
  }
  
  private void initAction(boolean promptForName)
  {
    this.promptForName = promptForName;
    setToolTipText(IDEWorkbenchMessages.AddBookmarkToolTip);
    PlatformUI.getWorkbench().getHelpSystem().setHelp(this, 
      "org.eclipse.ui.ide.add_bookmark_action_context");
    setId("org.eclipse.ui.AddBookmarkAction");
  }
  
  public void run()
  {
    if (getSelectedResources().isEmpty()) {
      return;
    }
    IResource resource = (IResource)getSelectedResources().get(0);
    if (resource != null) {
      if (promptForName)
      {
        BookmarkPropertiesDialog dialog = new BookmarkPropertiesDialog(shellProvider.getShell());
        dialog.setResource(resource);
        dialog.open();
      }
      else
      {
        Map attrs = new HashMap();
        attrs.put("message", resource.getName());
        CreateMarkersOperation op = new CreateMarkersOperation("org.eclipse.core.resources.bookmark", attrs, resource, BookmarkMessages.CreateBookmark_undoText);
        try
        {
          PlatformUI.getWorkbench().getOperationSupport().getOperationHistory().execute(op, null, WorkspaceUndoUtil.getUIInfoAdapter(shellProvider.getShell()));
        }
        catch (ExecutionException e)
        {
          IDEWorkbenchPlugin.log(null, e);
        }
      }
    }
  }
  
  protected boolean updateSelection(IStructuredSelection selection)
  {
    return (super.updateSelection(selection)) && (getSelectedResources().size() == 1);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ui.actions.AddBookmarkAction
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.actions;

import org.eclipse.jface.window.IShellProvider;
import org.eclipse.swt.widgets.Shell;

class AddTaskAction$1
  implements IShellProvider
{
  final AddTaskAction this$0;
  private final Shell val$shell;
  
  AddTaskAction$1(AddTaskAction paramAddTaskAction, Shell paramShell)
  {
    this$0 = paramAddTaskAction;val$shell = paramShell;
  }
  
  public Shell getShell()
  {
    return val$shell;
  }
}

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

import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.window.IShellProvider;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.help.IWorkbenchHelpSystem;
import org.eclipse.ui.internal.ide.IDEWorkbenchMessages;
import org.eclipse.ui.views.markers.internal.DialogTaskProperties;

public class AddTaskAction
  extends SelectionListenerAction
{
  public static final String ID = "org.eclipse.ui.AddTaskAction";
  private IShellProvider shellProvider;
  
  /**
   * @deprecated
   */
  public AddTaskAction(Shell shell)
  {
    super(IDEWorkbenchMessages.AddTaskLabel);
    Assert.isNotNull(shell);
    shellProvider = new IShellProvider()
    {
      private final Shell val$shell;
      
      public Shell getShell()
      {
        return val$shell;
      }
    };
    initAction();
  }
  
  public AddTaskAction(IShellProvider provider)
  {
    super(IDEWorkbenchMessages.AddTaskLabel);
    Assert.isNotNull(provider);
    shellProvider = provider;
    initAction();
  }
  
  private void initAction()
  {
    setId("org.eclipse.ui.AddTaskAction");
    setToolTipText(IDEWorkbenchMessages.AddTaskToolTip);
    PlatformUI.getWorkbench().getHelpSystem().setHelp(this, 
      "org.eclipse.ui.ide.add_task_action_context");
  }
  
  private IResource getElement(IStructuredSelection selection)
  {
    if (selection.size() != 1) {
      return null;
    }
    Object element = selection.getFirstElement();
    IResource resource = null;
    if ((element instanceof IResource)) {
      resource = (IResource)element;
    }
    if ((element instanceof IAdaptable)) {
      resource = (IResource)((IAdaptable)element)
        .getAdapter(IResource.class);
    }
    if ((resource != null) && ((resource instanceof IProject)))
    {
      IProject project = (IProject)resource;
      if (!project.isOpen()) {
        resource = null;
      }
    }
    return resource;
  }
  
  public void run()
  {
    IResource resource = getElement(getStructuredSelection());
    if (resource != null)
    {
      DialogTaskProperties dialog = new DialogTaskProperties(
        shellProvider.getShell());
      dialog.setResource(resource);
      dialog.open();
    }
  }
  
  protected boolean updateSelection(IStructuredSelection selection)
  {
    return (super.updateSelection(selection)) && (getElement(selection) != null);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ui.actions.AddTaskAction
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.actions;

import org.eclipse.core.resources.IBuildConfiguration;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.resources.WorkspaceJob;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.SubProgressMonitor;

class BuildAction$1
  extends WorkspaceJob
{
  final BuildAction this$0;
  private final IBuildConfiguration[] val$configs;
  private final int val$kind;
  
  BuildAction$1(BuildAction paramBuildAction, String $anonymous0, IBuildConfiguration[] paramArrayOfIBuildConfiguration, int paramInt)
  {
    super($anonymous0);this$0 = paramBuildAction;val$configs = paramArrayOfIBuildConfiguration;val$kind = paramInt;
  }
  
  public boolean belongsTo(Object family)
  {
    return ResourcesPlugin.FAMILY_MANUAL_BUILD.equals(family);
  }
  
  public IStatus runInWorkspace(IProgressMonitor monitor)
  {
    IStatus status = null;
    monitor.beginTask("", 10000);
    monitor.setTaskName(this$0.getOperationMessage());
    try
    {
      ResourcesPlugin.getWorkspace().build(val$configs, val$kind, this$0.shouldPerformResourcePruning(), new SubProgressMonitor(monitor, 10000));
    }
    catch (CoreException e)
    {
      status = e.getStatus();
    }
    if (monitor.isCanceled()) {
      throw new OperationCanceledException();
    }
    monitor.done();
    return status == null ? Status.OK_STATUS : status;
  }
}

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

import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import org.eclipse.core.resources.IBuildConfiguration;
import org.eclipse.core.resources.ICommand;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IProjectDescription;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.resources.WorkspaceJob;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.core.runtime.jobs.ISchedulingRule;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.window.IShellProvider;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.help.IWorkbenchHelpSystem;
import org.eclipse.ui.internal.ide.IDEWorkbenchMessages;
import org.eclipse.ui.internal.ide.IDEWorkbenchPlugin;
import org.eclipse.ui.internal.ide.actions.BuildUtilities;
import org.eclipse.ui.progress.IProgressConstants2;

public class BuildAction
  extends WorkspaceAction
{
  public static final String ID_BUILD = "org.eclipse.ui.BuildAction";
  public static final String ID_REBUILD_ALL = "org.eclipse.ui.RebuildAllAction";
  private int buildType;
  private List projectsToBuild = null;
  private List projectConfigsToBuild = null;
  
  /**
   * @deprecated
   */
  public BuildAction(Shell shell, int type)
  {
    super(shell, "");
    initAction(type);
  }
  
  public BuildAction(IShellProvider provider, int type)
  {
    super(provider, "");
    initAction(type);
  }
  
  private void initAction(int type)
  {
    if (type == 10)
    {
      setText(IDEWorkbenchMessages.BuildAction_text);
      setToolTipText(IDEWorkbenchMessages.BuildAction_toolTip);
      setId("org.eclipse.ui.BuildAction");
      PlatformUI.getWorkbench().getHelpSystem().setHelp(this, 
        "org.eclipse.ui.ide.incremental_build_action_context");
    }
    else
    {
      setText(IDEWorkbenchMessages.RebuildAction_text);
      setToolTipText(IDEWorkbenchMessages.RebuildAction_tooltip);
      setId("org.eclipse.ui.RebuildAllAction");
      PlatformUI.getWorkbench().getHelpSystem().setHelp(this, 
        "org.eclipse.ui.ide.full_build_action_context");
    }
    buildType = type;
  }
  
  protected List getActionResources()
  {
    return getProjectsToBuild();
  }
  
  protected String getOperationMessage()
  {
    return IDEWorkbenchMessages.BuildAction_operationMessage;
  }
  
  protected String getProblemsMessage()
  {
    return IDEWorkbenchMessages.BuildAction_problemMessage;
  }
  
  protected String getProblemsTitle()
  {
    return IDEWorkbenchMessages.BuildAction_problemTitle;
  }
  
  List getProjectsToBuild()
  {
    if (projectsToBuild == null)
    {
      Set projects = new HashSet(3);
      List configurations = getBuildConfigurationsToBuild();
      for (Iterator it = configurations.iterator(); it.hasNext();) {
        projects.add(((IBuildConfiguration)it.next()).getProject());
      }
      projectsToBuild = new ArrayList(projects);
    }
    return projectsToBuild;
  }
  
  protected List getBuildConfigurationsToBuild()
  {
    if (projectConfigsToBuild == null)
    {
      Set configs = new HashSet(3);
      for (Iterator i = getSelectedResources().iterator(); i.hasNext();)
      {
        IResource resource = (IResource)i.next();
        IProject project = resource.getProject();
        if ((project != null) && (hasBuilder(project))) {
          try
          {
            configs.add(project.getActiveBuildConfig());
          }
          catch (CoreException localCoreException) {}
        }
      }
      projectConfigsToBuild = new ArrayList(configs);
    }
    return projectConfigsToBuild;
  }
  
  boolean hasBuilder(IProject project)
  {
    if (!project.isAccessible()) {
      return false;
    }
    try
    {
      ICommand[] commands = project.getDescription().getBuildSpec();
      if (commands.length > 0) {
        return true;
      }
    }
    catch (CoreException localCoreException) {}
    return false;
  }
  
  public boolean isEnabled()
  {
    IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
    if (window != null) {
      selectionChanged(new StructuredSelection(BuildUtilities.findSelectedProjects(window)));
    }
    return super.isEnabled();
  }
  
  public static boolean isSaveAllSet()
  {
    IPreferenceStore store = IDEWorkbenchPlugin.getDefault()
      .getPreferenceStore();
    return store.getBoolean("SAVE_ALL_BEFORE_BUILD");
  }
  
  public void run()
  {
    List buildConfigurations = getBuildConfigurationsToBuild();
    if ((buildConfigurations == null) || (buildConfigurations.isEmpty())) {
      return;
    }
    BuildUtilities.saveEditors(getProjectsToBuild());
    runInBackground(null, ResourcesPlugin.FAMILY_MANUAL_BUILD);
  }
  
  public void runInBackground(ISchedulingRule rule, Object[] jobFamilies)
  {
    int kind = buildType;
    List buildConfigurations = getBuildConfigurationsToBuild();
    if ((buildConfigurations == null) || (buildConfigurations.isEmpty())) {
      return;
    }
    IBuildConfiguration[] configs = (IBuildConfiguration[])buildConfigurations.toArray(new IBuildConfiguration[buildConfigurations.size()]);
    
    Job job = new WorkspaceJob(removeMnemonics(getText()))
    {
      private final IBuildConfiguration[] val$configs;
      private final int val$kind;
      
      public boolean belongsTo(Object family)
      {
        return ResourcesPlugin.FAMILY_MANUAL_BUILD.equals(family);
      }
      
      public IStatus runInWorkspace(IProgressMonitor monitor)
      {
        IStatus status = null;
        monitor.beginTask("", 10000);
        monitor.setTaskName(getOperationMessage());
        try
        {
          ResourcesPlugin.getWorkspace().build(val$configs, val$kind, shouldPerformResourcePruning(), new SubProgressMonitor(monitor, 10000));
        }
        catch (CoreException e)
        {
          status = e.getStatus();
        }
        if (monitor.isCanceled()) {
          throw new OperationCanceledException();
        }
        monitor.done();
        return status == null ? Status.OK_STATUS : status;
      }
    };
    job.setProperty(IProgressConstants2.SHOW_IN_TASKBAR_ICON_PROPERTY, Boolean.TRUE);
    job.setUser(true);
    job.schedule();
  }
  
  protected boolean shouldPerformResourcePruning()
  {
    return true;
  }
  
  protected boolean updateSelection(IStructuredSelection s)
  {
    projectConfigsToBuild = null;
    projectsToBuild = null;
    IProject[] projects = (IProject[])getProjectsToBuild().toArray(new IProject[0]);
    return BuildUtilities.isEnabled(projects, 10);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ui.actions.BuildAction
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.actions;

import java.util.Iterator;
import java.util.List;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IResourceChangeEvent;
import org.eclipse.core.resources.IResourceChangeListener;
import org.eclipse.core.resources.IResourceDelta;
import org.eclipse.core.resources.IResourceRuleFactory;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.resources.mapping.IResourceChangeDescriptionFactory;
import org.eclipse.core.resources.mapping.ResourceChangeValidator;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.jobs.ISchedulingRule;
import org.eclipse.core.runtime.jobs.MultiRule;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.window.IShellProvider;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.help.IWorkbenchHelpSystem;
import org.eclipse.ui.ide.IDE;
import org.eclipse.ui.internal.ide.IDEWorkbenchMessages;

public class CloseResourceAction
  extends WorkspaceAction
  implements IResourceChangeListener
{
  public static final String ID = "org.eclipse.ui.CloseResourceAction";
  private String[] modelProviderIds;
  
  /**
   * @deprecated
   */
  public CloseResourceAction(Shell shell)
  {
    super(shell, IDEWorkbenchMessages.CloseResourceAction_text);
    initAction();
  }
  
  /**
   * @deprecated
   */
  protected CloseResourceAction(Shell shell, String text)
  {
    super(shell, text);
  }
  
  public CloseResourceAction(IShellProvider provider)
  {
    super(provider, IDEWorkbenchMessages.CloseResourceAction_text);
    initAction();
  }
  
  protected CloseResourceAction(IShellProvider provider, String text)
  {
    super(provider, text);
  }
  
  private void initAction()
  {
    setId("org.eclipse.ui.CloseResourceAction");
    setToolTipText(IDEWorkbenchMessages.CloseResourceAction_toolTip);
    PlatformUI.getWorkbench().getHelpSystem().setHelp(this, 
      "org.eclipse.ui.ide.close_resource_action_context");
  }
  
  protected String getOperationMessage()
  {
    return IDEWorkbenchMessages.CloseResourceAction_operationMessage;
  }
  
  protected String getProblemsMessage()
  {
    return IDEWorkbenchMessages.CloseResourceAction_problemMessage;
  }
  
  protected String getProblemsTitle()
  {
    return IDEWorkbenchMessages.CloseResourceAction_title;
  }
  
  protected void invokeOperation(IResource resource, IProgressMonitor monitor)
    throws CoreException
  {
    ((IProject)resource).close(monitor);
  }
  
  public void run()
  {
    List projects = getSelectedResources();
    if ((projects == null) || (projects.isEmpty())) {
      return;
    }
    IResource[] projectArray = (IResource[])projects
      .toArray(new IResource[projects.size()]);
    if (!IDE.saveAllEditors(projectArray, true)) {
      return;
    }
    if (!validateClose()) {
      return;
    }
    ISchedulingRule rule = null;
    IResourceRuleFactory factory = ResourcesPlugin.getWorkspace().getRuleFactory();
    Iterator resources = getSelectedResources().iterator();
    while (resources.hasNext())
    {
      IProject project = (IProject)resources.next();
      rule = MultiRule.combine(rule, factory.modifyRule(project));
    }
    runInBackground(rule);
  }
  
  protected boolean shouldPerformResourcePruning()
  {
    return false;
  }
  
  protected boolean updateSelection(IStructuredSelection s)
  {
    if (!selectionIsOfType(4)) {
      return false;
    }
    Iterator resources = getSelectedResources().iterator();
    while (resources.hasNext())
    {
      IProject currentResource = (IProject)resources.next();
      if (currentResource.isOpen()) {
        return true;
      }
    }
    return false;
  }
  
  public synchronized void resourceChanged(IResourceChangeEvent event)
  {
    List sel = getSelectedResources();
    if (selectionIsOfType(4))
    {
      IResourceDelta delta = event.getDelta();
      if (delta != null)
      {
        IResourceDelta[] projDeltas = delta
          .getAffectedChildren(4);
        for (int i = 0; i < projDeltas.length; i++)
        {
          IResourceDelta projDelta = projDeltas[i];
          if (((projDelta.getFlags() & 0x4000) != 0) && 
            (sel.contains(projDelta.getResource())))
          {
            selectionChanged(getStructuredSelection());
            return;
          }
        }
      }
    }
  }
  
  protected synchronized List getSelectedResources()
  {
    return super.getSelectedResources();
  }
  
  protected synchronized List getSelectedNonResources()
  {
    return super.getSelectedNonResources();
  }
  
  public String[] getModelProviderIds()
  {
    return modelProviderIds;
  }
  
  public void setModelProviderIds(String[] modelProviderIds)
  {
    this.modelProviderIds = modelProviderIds;
  }
  
  private boolean validateClose()
  {
    IResourceChangeDescriptionFactory factory = ResourceChangeValidator.getValidator().createDeltaFactory();
    List resources = getActionResources();
    for (Iterator iter = resources.iterator(); iter.hasNext();)
    {
      IResource resource = (IResource)iter.next();
      if ((resource instanceof IProject))
      {
        IProject project = (IProject)resource;
        factory.close(project);
      }
    }
    String message;
    String message;
    if (resources.size() == 1) {
      message = NLS.bind(IDEWorkbenchMessages.CloseResourceAction_warningForOne, ((IResource)resources.get(0)).getName());
    } else {
      message = IDEWorkbenchMessages.CloseResourceAction_warningForMultiple;
    }
    return IDE.promptToConfirm(getShell(), IDEWorkbenchMessages.CloseResourceAction_confirm, message, factory.getDelta(), getModelProviderIds(), false);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ui.actions.CloseResourceAction
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.actions;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResourceChangeEvent;
import org.eclipse.core.resources.IResourceDelta;
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.jface.dialogs.MessageDialogWithToggle;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.window.IShellProvider;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.help.IWorkbenchHelpSystem;
import org.eclipse.ui.internal.ide.IDEWorkbenchMessages;
import org.eclipse.ui.internal.ide.IDEWorkbenchPlugin;
import org.eclipse.ui.internal.ide.misc.DisjointSet;

public class CloseUnrelatedProjectsAction
  extends CloseResourceAction
{
  public static final String ID = "org.eclipse.ui.CloseUnrelatedProjectsAction";
  private final List projectsToClose = new ArrayList();
  private boolean selectionDirty = true;
  private List oldSelection = Collections.EMPTY_LIST;
  
  private static DisjointSet buildConnectedComponents(IProject[] projects)
  {
    DisjointSet set = new DisjointSet();
    for (int i = 0; i < projects.length; i++) {
      set.makeSet(projects[i]);
    }
    for (int i = 0; i < projects.length; i++) {
      try
      {
        IProject[] references = projects[i].getReferencedProjects();
        for (int j = 0; j < references.length; j++)
        {
          Object setOne = set.findSet(projects[i]);
          
          Object setTwo = set.findSet(references[j]);
          if ((setOne != null) && (setTwo != null) && (setOne != setTwo)) {
            set.union(setOne, setTwo);
          }
        }
      }
      catch (CoreException localCoreException) {}
    }
    return set;
  }
  
  /**
   * @deprecated
   */
  public CloseUnrelatedProjectsAction(Shell shell)
  {
    super(shell, IDEWorkbenchMessages.CloseUnrelatedProjectsAction_text);
    initAction();
  }
  
  public CloseUnrelatedProjectsAction(IShellProvider provider)
  {
    super(provider, IDEWorkbenchMessages.CloseUnrelatedProjectsAction_text);
    initAction();
  }
  
  public void run()
  {
    if (promptForConfirmation()) {
      super.run();
    }
  }
  
  private boolean promptForConfirmation()
  {
    IPreferenceStore store = IDEWorkbenchPlugin.getDefault().getPreferenceStore();
    if (store.getBoolean("CLOSE_UNRELATED_PROJECTS")) {
      return true;
    }
    List selection = super.getSelectedResources();
    int selectionSize = selection.size();
    if (selectionSize == 0) {
      return true;
    }
    String message = null;
    if (selectionSize == 1)
    {
      Object firstSelected = selection.get(0);
      String projectName = null;
      if ((firstSelected instanceof IProject)) {
        projectName = ((IProject)firstSelected).getName();
      }
      message = NLS.bind(IDEWorkbenchMessages.CloseUnrelatedProjectsAction_confirmMsg1, projectName);
    }
    else
    {
      message = NLS.bind(IDEWorkbenchMessages.CloseUnrelatedProjectsAction_confirmMsgN, 
        new Integer(selectionSize));
    }
    MessageDialogWithToggle dialog = MessageDialogWithToggle.openOkCancelConfirm(
      getShell(), IDEWorkbenchMessages.CloseUnrelatedProjectsAction_toolTip, 
      message, IDEWorkbenchMessages.CloseUnrelatedProjectsAction_AlwaysClose, 
      false, null, null);
    if (dialog.getReturnCode() != 0) {
      return false;
    }
    store.setValue("CLOSE_UNRELATED_PROJECTS", dialog.getToggleState());
    return true;
  }
  
  private void initAction()
  {
    setId("org.eclipse.ui.CloseUnrelatedProjectsAction");
    setToolTipText(IDEWorkbenchMessages.CloseUnrelatedProjectsAction_toolTip);
    PlatformUI.getWorkbench().getHelpSystem().setHelp(this, "org.eclipse.ui.ide.close_unrelated_projects_action_context");
  }
  
  protected void clearCache()
  {
    super.clearCache();
    oldSelection = Collections.EMPTY_LIST;
    selectionDirty = true;
  }
  
  private void computeRelated(List selection)
  {
    DisjointSet set = buildConnectedComponents(ResourcesPlugin.getWorkspace().getRoot().getProjects());
    for (Iterator it = selection.iterator(); it.hasNext();) {
      set.removeSet(it.next());
    }
    projectsToClose.clear();
    set.toList(projectsToClose);
  }
  
  protected List getSelectedResources()
  {
    if (selectionDirty)
    {
      List newSelection = super.getSelectedResources();
      if (!oldSelection.equals(newSelection))
      {
        oldSelection = newSelection;
        computeRelated(newSelection);
      }
      selectionDirty = false;
    }
    return projectsToClose;
  }
  
  public void resourceChanged(IResourceChangeEvent event)
  {
    if (selectionIsOfType(4))
    {
      IResourceDelta delta = event.getDelta();
      if (delta != null)
      {
        IResourceDelta[] projDeltas = delta.getAffectedChildren(4);
        for (int i = 0; i < projDeltas.length; i++)
        {
          IResourceDelta projDelta = projDeltas[i];
          if ((projDelta.getFlags() & 0x84000) != 0)
          {
            selectionChanged(getStructuredSelection());
            return;
          }
        }
      }
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ui.actions.CloseUnrelatedProjectsAction
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.actions;

import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IPath;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.osgi.util.NLS;
import org.eclipse.ui.internal.ide.IDEWorkbenchMessages;
import org.eclipse.ui.internal.ide.dialogs.IDEResourceInfoUtils;

class CopyFilesAndFoldersOperation$1
  implements Runnable
{
  final CopyFilesAndFoldersOperation this$0;
  private final IResource val$destination;
  private final IResource val$source;
  private final int[] val$result;
  
  CopyFilesAndFoldersOperation$1(CopyFilesAndFoldersOperation paramCopyFilesAndFoldersOperation, IResource paramIResource1, IResource paramIResource2, int[] paramArrayOfInt)
  {
    this$0 = paramCopyFilesAndFoldersOperation;val$destination = paramIResource1;val$source = paramIResource2;val$result = paramArrayOfInt;
  }
  
  public void run()
  {
    int[] resultId = { 2, 
      4, 3, 
      1 };
    String[] labels = { IDialogConstants.YES_LABEL, 
      IDialogConstants.YES_TO_ALL_LABEL, 
      IDialogConstants.NO_LABEL, 
      IDialogConstants.CANCEL_LABEL };
    String message;
    if (val$destination.getType() == 2)
    {
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104

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