org.eclipse.wst.common.ui_1.1.500.v200911190730

16:48:55.633 INFO  jd.cli.Main - Decompiling org.eclipse.wst.common.ui_1.1.500.v200911190730.jar
package org.eclipse.wst.common.ui.internal;

import org.eclipse.osgi.util.NLS;

public class Messages
{
  private static final String BUNDLE_NAME = "org.eclipse.wst.common.ui.internal.CommonUIMessages";
  public static String _UI_LABEL_SOURCE_FILES;
  public static String _UI_LABEL_SELECTED_FILES;
  public static String _UI_POPUP_EXPAND_ALL;
  public static String _UI_POPUP_COLLAPSE_ALL;
  public static String _UI_IMPORT_BUTTON;
  public static String _UI_IMPORT_BUTTON_TOOL_TIP;
  public static String _UI_ADD_BUTTON_TOOL_TIP;
  public static String _UI_REMOVE_BUTTON_TOOL_TIP;
  public static String _UI_REMOVE_ALL_BUTTON_TOOL_TIP;
  public static String _UI_ADD_BUTTON;
  public static String _UI_REMOVE_BUTTON;
  public static String _UI_REMOVE_ALL_BUTTON;
  public static String _UI_LABEL_CHOOSE_FOLDER;
  public static String _UI_LABEL_FOLDER_SELECTION;
  public static String _UI_MENU_COPY;
  public static String _UI_MENU_CUT;
  public static String _UI_MENU_DELETE;
  public static String _UI_MENU_PASTE;
  public static String _UI_MENU_PREFIX;
  public static String _UI_MENU_REDO;
  public static String _UI_MENU_SELECT_ALL;
  public static String _UI_MENU_SHIFT_LEFT;
  public static String _UI_MENU_SHIFT_RIGHT;
  public static String _UI_MENU_STRIP_PREFIX;
  public static String _UI_MENU_UNDO;
  public static String _UI_MENU_GOTO_LINE;
  public static String _UI_GOTO_LINE_DIALOG_TITLE;
  public static String _UI_GOTO_LINE_DIALOG_TEXT;
  public static String _UI_FILE_CHANGED_TITLE;
  public static String _UI_FILE_DELETED_SAVE_CHANGES;
  public static String _UI_FILE_DELETED_EDITOR_CLOSED;
  public static String _UI_FILE_CHANGED_LOAD_CHANGES;
  public static String _UI_SAVE_BUTTON;
  public static String _UI_CLOSE_BUTTON;
  public static String _UI_XSLT_SELECT;
  public static String _UI_XSLT_STYLESHEET;
  public static String _UI_XSLT_TRANSFORM;
  public static String _UI_XSL_DEBUG_SELECT_LAUNCHER;
  public static String _UI_XSL_DEBUG_LOCAL;
  public static String _UI_XSL_DEBUG_REMOTE;
  public static String _UI_XSL_TILE_EDITOR;
  public static String _UI_XSL_DEBUG_AND_TRANSFORM;
  public static String _UI_XSL_CONTEXT_URI;
  public static String _UI_XSL_CONTEXT;
  public static String _UI_OVERRIDE_FILE;
  public static String _UI_JAVA_EXIST_FILE1;
  public static String _UI_JAVA_EXIST_FILE2;
  public static String _UI_ERROR_CREATING_FILE_TITLE;
  public static String _UI_ERROR_CREATING_FILE_SHORT_DESC;
  public static String _UI_ERROR_CREATING_FILE_LONG_DESC;
  public static String _UI_PARENT_FOLDER_IS_READ_ONLY;
  public static String _UI_UNKNOWN_ERROR_WITH_HINT;
  public static String _UI_UNKNOWN_ERROR;
  public static String _UI_LABEL_INCLUDE_URL_FILE;
  public static String _UI_RADIO_FILE;
  public static String _UI_RADIO_URL;
  public static String _UI_LABEL_COMPONENTS;
  public static String _UI_LABEL_QUALIFIER;
  public static String _UI_LABEL_COMPONENT_NAME;
  public static String _UI_LABEL_MATCHING_COMPONENTS;
  public static String _UI_LABEL_SPECIFIED_FILE;
  public static String _UI_LABEL_ENCLOSING_PROJECT;
  public static String _UI_LABEL_WORKSPACE;
  public static String _UI_LABEL_CURRENT_RESOURCE;
  public static String _UI_LABEL_SEARCH_SCOPE;
  public static String _UI_LABEL_NARROW_SEARCH_SCOPE_RESOURCE;
  public static String _UI_LABEL_AVAILABLE_TYPES;
  public static String _UI_LABEL_WORKING_SETS;
  public static String _UI_LABEL_New;
  public static String _UI_LABEL_DECLARATION_LOCATION;
  public static String _UI_LABEL_CHOOSE;
  public static String _ERROR_THE_CONTAINER_NAME;
  public static String _ERROR_LOCAL_LOCATION;
  public static String _ERROR_NOT_JAVA_PROJECT;
  public static String _ERROR_INVALID_JAVA_PACKAGE;
  public static String _ERROR_BAD_FILENAME_EXTENSION;
  public static String _ERROR_FILE_ALREADY_EXISTS;
  public static String _ERROR_CONTAINER_NOT_JAVA_BUILDPATH;
  public static String _ERROR_USE_PROJECT_JAVA_SOURCE_FOLDER;
  public static String _UI_ERROR;
  public static String _WARN_INVALID_JAVA_PACKAGE;
  public static String _ERROR_ROOT_ELEMENT;
  public static String _ERROR_SAVING_FILE;
  public static String _UI_ERROR_VALIDATE_FAIL_TITLE;
  public static String _UI_ERROR_VALIDATE_FAIL_MESSAGE;
  public static String _UI_ERROR_VALIDATE_EDIT_FAIL_ONE_FILE;
  public static String SaveFilesDialog_save_all_resources;
  public static String SaveFilesDialog_must_save;
  
  static
  {
    NLS.initializeMessages("org.eclipse.wst.common.ui.internal.CommonUIMessages", Messages.class);
  }
}

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

import java.net.MalformedURLException;
import java.net.URL;
import java.text.MessageFormat;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.ILog;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.resource.ImageRegistry;
import org.eclipse.swt.graphics.Image;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;

public class UIPlugin
  extends AbstractUIPlugin
{
  private static UIPlugin plugin;
  
  public UIPlugin()
  {
    plugin = this;
  }
  
  public static UIPlugin getDefault()
  {
    return plugin;
  }
  
  public static IWorkspace getWorkspace()
  {
    return ResourcesPlugin.getWorkspace();
  }
  
  public static String getResourceString(String key)
  {
    ResourceBundle aResourceBundle = getDefault().getResourceBundle();
    try
    {
      return aResourceBundle != null ? aResourceBundle.getString(key) : key;
    }
    catch (MissingResourceException localMissingResourceException) {}
    return key;
  }
  
  public static String getString(String key)
  {
    return getResourceString(key);
  }
  
  public static String getString(String key, Object s1)
  {
    return MessageFormat.format(getResourceString(key), new Object[] { s1 });
  }
  
  public static String getString(String key, Object s1, Object s2)
  {
    return MessageFormat.format(getResourceString(key), new Object[] { s1, s2 });
  }
  
  public ResourceBundle getResourceBundle()
  {
    try
    {
      return Platform.getResourceBundle(plugin.getBundle());
    }
    catch (MissingResourceException x)
    {
      log(x);
    }
    return null;
  }
  
  public ImageDescriptor getImageDescriptor(String name)
  {
    try
    {
      URL url = new URL(getBundle().getEntry("/"), name);
      return ImageDescriptor.createFromURL(url);
    }
    catch (MalformedURLException localMalformedURLException) {}
    return ImageDescriptor.getMissingImageDescriptor();
  }
  
  public Image getImage(String iconName)
  {
    ImageRegistry imageRegistry = getImageRegistry();
    if (imageRegistry.get(iconName) != null) {
      return imageRegistry.get(iconName);
    }
    imageRegistry.put(iconName, ImageDescriptor.createFromFile(getClass(), iconName));
    return imageRegistry.get(iconName);
  }
  
  public static String getPluginId()
  {
    return getDefault().getBundle().getSymbolicName();
  }
  
  public static void log(IStatus status)
  {
    getDefault().getLog().log(status);
  }
  
  public static void log(String message, Throwable e)
  {
    log(new Status(4, getPluginId(), 4, message, e));
  }
  
  public static void log(String message)
  {
    log(new Status(4, getPluginId(), 4, message, null));
  }
  
  public static void log(Throwable e)
  {
    log(new Status(4, getPluginId(), 4, e.getLocalizedMessage(), e));
  }
  
  public void start(BundleContext context)
    throws Exception
  {
    super.start(context);
  }
  
  public void stop(BundleContext context)
    throws Exception
  {
    super.stop(context);
  }
  
  public static IWorkbenchPage getActivePage()
  {
    return getDefault().internalGetActivePage();
  }
  
  private IWorkbenchPage internalGetActivePage()
  {
    IWorkbenchWindow window = getWorkbench().getActiveWorkbenchWindow();
    if (window == null) {
      return null;
    }
    return getWorkbench().getActiveWorkbenchWindow().getActivePage();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.common.ui.internal.UIPlugin
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.common.ui.internal.dialogs;

import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.swt.graphics.Image;
import org.eclipse.ui.IEditorPart;

class SaveDirtyFilesDialog$1
  extends LabelProvider
{
  final SaveDirtyFilesDialog this$0;
  
  SaveDirtyFilesDialog$1(SaveDirtyFilesDialog paramSaveDirtyFilesDialog)
  {
    this$0 = paramSaveDirtyFilesDialog;
  }
  
  public Image getImage(Object element)
  {
    return ((IEditorPart)element).getTitleImage();
  }
  
  public String getText(Object element)
  {
    return ((IEditorPart)element).getTitle();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.common.ui.internal.dialogs.SaveDirtyFilesDialog.1
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.common.ui.internal.dialogs;

import java.util.List;
import org.eclipse.jface.viewers.IStructuredContentProvider;
import org.eclipse.jface.viewers.Viewer;

class SaveDirtyFilesDialog$ListContentProvider
  implements IStructuredContentProvider
{
  List fContents;
  
  public Object[] getElements(Object input)
  {
    if ((fContents != null) && (fContents == input)) {
      return fContents.toArray();
    }
    return new Object[0];
  }
  
  public void inputChanged(Viewer viewer, Object oldInput, Object newInput)
  {
    if ((newInput instanceof List)) {
      fContents = ((List)newInput);
    } else {
      fContents = null;
    }
  }
  
  public void dispose() {}
  
  public boolean isDeleted(Object o)
  {
    return (fContents != null) && (!fContents.contains(o));
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.common.ui.internal.dialogs.SaveDirtyFilesDialog.ListContentProvider
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.common.ui.internal.dialogs;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.IStructuredContentProvider;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.dialogs.ListDialog;
import org.eclipse.wst.common.ui.internal.Messages;

public class SaveDirtyFilesDialog
  extends ListDialog
{
  public static boolean saveDirtyFiles()
  {
    boolean result = true;
    
    Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
    IEditorPart[] dirtyEditors = getDirtyEditors();
    if (dirtyEditors.length > 0)
    {
      result = false;
      SaveDirtyFilesDialog saveDirtyFilesDialog = new SaveDirtyFilesDialog(shell);
      saveDirtyFilesDialog.setInput(Arrays.asList(dirtyEditors));
      if (saveDirtyFilesDialog.open() == 0)
      {
        result = true;
        int numDirtyEditors = dirtyEditors.length;
        for (int i = 0; i < numDirtyEditors; i++) {
          dirtyEditors[i].doSave(null);
        }
      }
    }
    return result;
  }
  
  private static IEditorPart[] getDirtyEditors()
  {
    List result = new ArrayList(0);
    IWorkbench workbench = PlatformUI.getWorkbench();
    IWorkbenchWindow[] windows = workbench.getWorkbenchWindows();
    for (int i = 0; i < windows.length; i++)
    {
      IWorkbenchPage[] pages = windows[i].getPages();
      for (int x = 0; x < pages.length; x++)
      {
        IEditorPart[] editors = pages[x].getDirtyEditors();
        for (int z = 0; z < editors.length; z++)
        {
          IEditorPart ep = editors[z];
          result.add(ep);
        }
      }
    }
    return (IEditorPart[])result.toArray(new IEditorPart[result.size()]);
  }
  
  public SaveDirtyFilesDialog(Shell parent)
  {
    super(parent);
    setTitle(Messages.SaveFilesDialog_save_all_resources);
    setAddCancelButton(true);
    setLabelProvider(createDialogLabelProvider());
    setMessage(Messages.SaveFilesDialog_must_save);
    setContentProvider(new ListContentProvider());
  }
  
  protected Control createDialogArea(Composite container)
  {
    Composite result = (Composite)super.createDialogArea(container);
    
    return result;
  }
  
  private ILabelProvider createDialogLabelProvider()
  {
    new LabelProvider()
    {
      public Image getImage(Object element)
      {
        return ((IEditorPart)element).getTitleImage();
      }
      
      public String getText(Object element)
      {
        return ((IEditorPart)element).getTitle();
      }
    };
  }
  
  private static class ListContentProvider
    implements IStructuredContentProvider
  {
    List fContents;
    
    public Object[] getElements(Object input)
    {
      if ((fContents != null) && (fContents == input)) {
        return fContents.toArray();
      }
      return new Object[0];
    }
    
    public void inputChanged(Viewer viewer, Object oldInput, Object newInput)
    {
      if ((newInput instanceof List)) {
        fContents = ((List)newInput);
      } else {
        fContents = null;
      }
    }
    
    public void dispose() {}
    
    public boolean isDeleted(Object o)
    {
      return (fContents != null) && (!fContents.contains(o));
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.common.ui.internal.dialogs.SaveDirtyFilesDialog
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.common.ui.internal.dialogs;

import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.wst.common.ui.internal.viewers.SelectSingleFileView;

class SelectSingleFileDialog$1
  extends SelectSingleFileView
{
  final SelectSingleFileDialog this$0;
  
  SelectSingleFileDialog$1(SelectSingleFileDialog paramSelectSingleFileDialog, IStructuredSelection $anonymous0, boolean $anonymous1)
  {
    super($anonymous0, $anonymous1);this$0 = paramSelectSingleFileDialog;
  }
  
  public void createFilterControl(Composite composite)
  {
    this$0.createFilterControl(composite);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.common.ui.internal.dialogs.SelectSingleFileDialog.1
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.common.ui.internal.dialogs;

import org.eclipse.swt.widgets.Button;
import org.eclipse.wst.common.ui.internal.viewers.SelectSingleFileView.Listener;

class SelectSingleFileDialog$2
  implements SelectSingleFileView.Listener
{
  final SelectSingleFileDialog this$0;
  
  SelectSingleFileDialog$2(SelectSingleFileDialog paramSelectSingleFileDialog)
  {
    this$0 = paramSelectSingleFileDialog;
  }
  
  public void setControlComplete(boolean isComplete)
  {
    this$0.okButton.setEnabled(isComplete);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.common.ui.internal.dialogs.SelectSingleFileDialog.2
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.common.ui.internal.dialogs;

import org.eclipse.core.resources.IFile;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.TitleAreaDialog;
import org.eclipse.jface.resource.DeviceResourceException;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.StructuredSelection;
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.Control;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.wst.common.ui.internal.UIPlugin;
import org.eclipse.wst.common.ui.internal.viewers.SelectSingleFileView;
import org.eclipse.wst.common.ui.internal.viewers.SelectSingleFileView.Listener;

public class SelectSingleFileDialog
  extends TitleAreaDialog
{
  protected SelectSingleFileView selectSingleFileView;
  protected Button okButton;
  protected Image image;
  private ImageDescriptor imageDescriptor;
  
  public SelectSingleFileDialog(Shell parentShell, IStructuredSelection selection, boolean isFileMandatory)
  {
    super(parentShell);
    setShellStyle(getShellStyle() | 0x10);
    if (selection == null) {
      selection = new StructuredSelection();
    }
    selectSingleFileView = new SelectSingleFileView(selection, isFileMandatory)
    {
      public void createFilterControl(Composite composite)
      {
        SelectSingleFileDialog.this.createFilterControl(composite);
      }
    };
  }
  
  protected Control createDialogArea(Composite parent)
  {
    Composite dialogArea = (Composite)super.createDialogArea(parent);
    
    Composite composite = new Composite(dialogArea, 0);
    composite.setLayout(new GridLayout());
    GridData gd = new GridData(1808);
    widthHint = 350;
    heightHint = 350;
    composite.setLayoutData(gd);
    
    SelectSingleFileView.Listener listener = new SelectSingleFileView.Listener()
    {
      public void setControlComplete(boolean isComplete)
      {
        okButton.setEnabled(isComplete);
      }
    };
    selectSingleFileView.setListener(listener);
    selectSingleFileView.createControl(composite);
    return dialogArea;
  }
  
  protected void createButtonsForButtonBar(Composite parent)
  {
    okButton = createButton(parent, 0, IDialogConstants.OK_LABEL, true);
    okButton.setEnabled(false);
    createButton(parent, 1, IDialogConstants.CANCEL_LABEL, false);
  }
  
  public void create()
  {
    super.create();
    selectSingleFileView.setVisibleHelper(true);
    image = getSaveAsImage();
    setTitleImage(image);
  }
  
  private Image getSaveAsImage()
  {
    Image localimage = null;
    try
    {
      if (imageDescriptor == null) {
        imageDescriptor = UIPlugin.getDefault().getImageDescriptor("icons/saveas_wiz.png");
      }
      localimage = (Image)imageDescriptor.createResource(getContents().getDisplay());
    }
    catch (DeviceResourceException localDeviceResourceException)
    {
      localimage = ImageDescriptor.getMissingImageDescriptor().createImage();
    }
    return localimage;
  }
  
  public void createFilterCombo(Composite composite) {}
  
  public IFile getFile()
  {
    return selectSingleFileView.getFile();
  }
  
  public void addFilterExtensions(String[] filterExtensions)
  {
    selectSingleFileView.addFilterExtensions(filterExtensions);
  }
  
  public void addFilterExtensions(String[] filterExtensions, IFile[] excludedFiles)
  {
    selectSingleFileView.addFilterExtensions(filterExtensions, excludedFiles);
  }
  
  public void createFilterControl(Composite composite) {}
  
  public boolean close()
  {
    if ((image != null) && (imageDescriptor != null))
    {
      imageDescriptor.destroyResource(image);
      image = null;
    }
    return super.close();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.common.ui.internal.dialogs.SelectSingleFileDialog
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.common.ui.internal.dnd;

import java.util.ArrayList;
import java.util.Collection;

public abstract class DefaultDragAndDropCommand
  implements DragAndDropCommand
{
  protected Object target;
  protected float location;
  protected float lowerLocationBound;
  protected float upperLocationBound;
  protected int operations;
  protected int operation;
  protected int feedback;
  protected Collection sources;
  
  public DefaultDragAndDropCommand(Object target, float location, int operations, int operation, Collection sources)
  {
    this.target = target;
    this.location = location;
    this.operations = operations;
    this.operation = operation;
    this.sources = new ArrayList(sources);
    if (!canExecute()) {
      this.operation = 0;
    }
  }
  
  public int getFeedback()
  {
    if (isAfter()) {
      return 4;
    }
    return 2;
  }
  
  public boolean isAfter()
  {
    return location > 0.5D;
  }
  
  public int getOperation()
  {
    return operation;
  }
  
  public void reinitialize(Object target, float location, int operations, int operation, Collection sources)
  {
    this.target = target;
    this.location = location;
    this.operations = operations;
    this.operation = operation;
    this.sources = new ArrayList(sources);
    if (!canExecute()) {
      this.operation = 0;
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.common.ui.internal.dnd.DefaultDragAndDropCommand
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.common.ui.internal.dnd;

import java.util.Collection;

public abstract interface DragAndDropCommand
{
  public abstract boolean canExecute();
  
  public abstract void execute();
  
  public abstract int getFeedback();
  
  public abstract int getOperation();
  
  public abstract void reinitialize(Object paramObject, float paramFloat, int paramInt1, int paramInt2, Collection paramCollection);
}

/* Location:
 * Qualified Name:     org.eclipse.wst.common.ui.internal.dnd.DragAndDropCommand
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.common.ui.internal.dnd;

import java.util.Collection;

public abstract interface DragAndDropManager
{
  public abstract DragAndDropCommand createCommand(Object paramObject, float paramFloat, int paramInt1, int paramInt2, Collection paramCollection);
}

/* Location:
 * Qualified Name:     org.eclipse.wst.common.ui.internal.dnd.DragAndDropManager
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.common.ui.internal.dnd;

import org.eclipse.swt.dnd.ByteArrayTransfer;
import org.eclipse.swt.dnd.TransferData;

public class ObjectTransfer
  extends ByteArrayTransfer
{
  protected static final String TYPE_NAME = "local-transfer-format";
  protected static final int TYPE_ID = registerType("local-transfer-format");
  protected static ObjectTransfer instance;
  protected long startTime;
  protected Object object;
  
  public static ObjectTransfer getInstance()
  {
    if (instance == null) {
      instance = new ObjectTransfer();
    }
    return instance;
  }
  
  protected int[] getTypeIds()
  {
    return new int[] { TYPE_ID };
  }
  
  public String[] getTypeNames()
  {
    return new String[] { "local-transfer-format" };
  }
  
  public void javaToNative(Object object, TransferData transferData)
  {
    startTime = System.currentTimeMillis();
    this.object = object;
    if (transferData != null) {
      super.javaToNative(String.valueOf(startTime).getBytes(), transferData);
    }
  }
  
  public Object nativeToJava(TransferData transferData)
  {
    long startTime = Long.valueOf(new String((byte[])super.nativeToJava(transferData))).longValue();
    return 
      this.startTime == startTime ? 
      object : 
      null;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.common.ui.internal.dnd.ObjectTransfer
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.common.ui.internal.dnd;

import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.swt.dnd.DragSourceEvent;
import org.eclipse.swt.dnd.DragSourceListener;

public class ViewerDragAdapter
  implements DragSourceListener
{
  protected Viewer viewer;
  protected ISelection selection;
  
  public ViewerDragAdapter(Viewer viewer)
  {
    this.viewer = viewer;
  }
  
  public void dragStart(DragSourceEvent event)
  {
    selection = viewer.getSelection();
  }
  
  public void dragFinished(DragSourceEvent event)
  {
    selection = null;
  }
  
  public void dragSetData(DragSourceEvent event)
  {
    if (ObjectTransfer.getInstance().isSupportedType(dataType)) {
      data = selection;
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.common.ui.internal.dnd.ViewerDragAdapter
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.common.ui.internal.dnd;

import java.util.ArrayList;
import java.util.Collection;

public class ViewerDropAdapter$DragAndDropCommandInformation
{
  protected Object target;
  protected float location;
  protected int operations;
  protected int operation;
  protected Collection source;
  final ViewerDropAdapter this$0;
  
  public ViewerDropAdapter$DragAndDropCommandInformation(ViewerDropAdapter paramViewerDropAdapter, Object target, float location, int operations, int operation, Collection source)
  {
    this$0 = paramViewerDropAdapter;
    
    this.target = target;
    this.location = location;
    this.operations = operations;
    this.operation = operation;
    this.source = new ArrayList(source);
  }
  
  public DragAndDropCommand createCommand()
  {
    return this$0.dragAndDropManager.createCommand(target, location, operations, operation, source);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.common.ui.internal.dnd.ViewerDropAdapter.DragAndDropCommandInformation
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.common.ui.internal.dnd;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
import org.eclipse.jface.viewers.AbstractTreeViewer;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.swt.custom.TableTreeItem;
import org.eclipse.swt.dnd.DropTargetAdapter;
import org.eclipse.swt.dnd.DropTargetEvent;
import org.eclipse.swt.dnd.TransferData;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.ScrollBar;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableItem;
import org.eclipse.swt.widgets.Tree;
import org.eclipse.swt.widgets.TreeItem;
import org.eclipse.swt.widgets.Widget;

public class ViewerDropAdapter
  extends DropTargetAdapter
{
  protected Viewer viewer;
  protected Collection source;
  protected DragAndDropCommand command;
  protected Object commandTarget;
  protected int hoverThreshold = 1500;
  protected long hoverStart = 0L;
  protected Widget previousItem;
  protected int originalOperation;
  protected DragAndDropCommandInformation dragAndDropCommandInformation;
  protected DragAndDropManager dragAndDropManager;
  
  public ViewerDropAdapter(Viewer viewer, DragAndDropManager dragAndDropManager)
  {
    this.viewer = viewer;
    this.dragAndDropManager = dragAndDropManager;
  }
  
  public void dragEnter(DropTargetEvent event)
  {
    originalOperation = detail;
    helper(event);
  }
  
  public void dragLeave(DropTargetEvent event)
  {
    if (command != null)
    {
      command = null;
      commandTarget = null;
    }
    previousItem = null;
    hoverStart = 0L;
    source = null;
  }
  
  public void dragOperationChanged(DropTargetEvent event)
  {
    originalOperation = detail;
    helper(event);
  }
  
  public void dragOver(DropTargetEvent event)
  {
    helper(event);
  }
  
  public void dropAccept(DropTargetEvent event) {}
  
  public void drop(DropTargetEvent event)
  {
    if (dragAndDropCommandInformation != null)
    {
      command = dragAndDropCommandInformation.createCommand();
      
      command.execute();
      
      command = null;
      commandTarget = null;
      previousItem = null;
      hoverStart = 0L;
      source = null;
    }
  }
  
  protected void helper(DropTargetEvent event)
  {
    if (source == null) {
      source = getDragSource(event);
    } else if (currentDataType == null) {
      setCurrentDataType(event);
    }
    if (source == null)
    {
      detail = 0;
      feedback = 1;
    }
    else if (scrollIfNeeded(event))
    {
      feedback = 1;
    }
    else
    {
      Object target = item == null ? null : item.getData();
      if ((target instanceof TableTreeItem)) {
        target = ((TableTreeItem)target).getData();
      }
      if (item != previousItem)
      {
        previousItem = item;
        hoverStart = time;
      }
      else if (target != null)
      {
        if (time - hoverStart > hoverThreshold)
        {
          hover(target);
          
          hoverStart = 2147483647L;
        }
      }
      boolean valid = false;
      if (command == null)
      {
        commandTarget = target;
        command = dragAndDropManager.createCommand(target, getLocation(event), operations, detail, source);
        if (command != null) {
          valid = command.canExecute();
        }
      }
      else
      {
        int operation = originalOperation != detail ? originalOperation : detail;
        if (target == commandTarget)
        {
          float location = getLocation(event);
          
          dragAndDropCommandInformation = 
            new DragAndDropCommandInformation(target, location, operations, operation, source);
          
          command.reinitialize(target, location, operations, operation, source);
          if (command != null) {
            valid = command.canExecute();
          }
        }
        else
        {
          commandTarget = target;
          
          dragAndDropCommandInformation = 
            new DragAndDropCommandInformation(target, getLocation(event), operations, operation, source);
          
          command = dragAndDropCommandInformation.createCommand();
          if (command != null) {
            valid = command.canExecute();
          }
        }
      }
      if (command != null)
      {
        detail = command.getOperation();
        feedback = command.getFeedback();
      }
      else if (valid)
      {
        feedback = 1;
      }
      else
      {
        detail = 0;
        feedback = 1;
      }
    }
  }
  
  protected void setCurrentDataType(DropTargetEvent event)
  {
    ObjectTransfer objectTransfer = ObjectTransfer.getInstance();
    TransferData[] dataTypes = dataTypes;
    for (int i = 0; i < dataTypes.length; i++)
    {
      TransferData transferData = dataTypes[i];
      if (objectTransfer.isSupportedType(transferData)) {
        currentDataType = transferData;
      }
    }
  }
  
  protected Collection getDragSource(DropTargetEvent event)
  {
    ObjectTransfer objectTransfer = ObjectTransfer.getInstance();
    if (!objectTransfer.isSupportedType(currentDataType))
    {
      setCurrentDataType(event);
      return null;
    }
    Object object = objectTransfer.nativeToJava(currentDataType);
    if (object == null) {
      return null;
    }
    return extractDragSource(object);
  }
  
  protected Collection extractDragSource(Object object)
  {
    if ((object instanceof IStructuredSelection))
    {
      Collection result = new ArrayList();
      for (Iterator elements = ((IStructuredSelection)object).iterator(); elements.hasNext();) {
        result.add(elements.next());
      }
      return result;
    }
    return Collections.EMPTY_LIST;
  }
  
  public int getHoverThreshold()
  {
    return hoverThreshold;
  }
  
  public void setHoverThreshold(int hoverThreshold)
  {
    this.hoverThreshold = hoverThreshold;
  }
  
  protected void hover(Object target)
  {
    if ((viewer instanceof AbstractTreeViewer)) {
      ((AbstractTreeViewer)viewer).expandToLevel(target, 1);
    }
  }
  
  protected boolean scrollIfNeeded(DropTargetEvent event)
  {
    boolean result = false;
    if ((item instanceof TreeItem))
    {
      TreeItem treeItem = (TreeItem)item;
      
      Tree tree = treeItem.getParent();
      Point point = tree.toControl(new Point(x, y));
      Rectangle bounds = tree.getClientArea();
      
      int scrollEpsilon = Math.min(getBoundsheight, height / 3);
      
      TreeItem scrollTreeItem = null;
      if (y < scrollEpsilon)
      {
        TreeItem parent = treeItem.getParentItem();
        
        TreeItem[] children = parent == null ? tree.getItems() : parent.getItems();
        for (int i = 0; i < children.length; i++) {
          if (children[i] == treeItem)
          {
            if (i > 0)
            {
              scrollTreeItem = children[(i - 1)];
              for (;;)
              {
                children = scrollTreeItem.getItems();
                if ((children == null) || (children.length == 0) || (!scrollTreeItem.getExpanded())) {
                  break;
                }
                scrollTreeItem = children[(children.length - 1)];
              }
            }
            scrollTreeItem = parent;
            
            break;
          }
        }
      }
      else if (height - y < scrollEpsilon)
      {
        TreeItem[] children = treeItem.getItems();
        if ((children != null) && (children.length != 0) && (treeItem.getExpanded())) {
          scrollTreeItem = children[0];
        } else {
          while (scrollTreeItem == null)
          {
            TreeItem parent = treeItem.getParentItem();
            
            children = parent == null ? tree.getItems() : parent.getItems();
            for (int i = 0; i < children.length; i++) {
              if (children[i] == treeItem)
              {
                i++;
                if (i >= children.length) {
                  break;
                }
                scrollTreeItem = children[i];
                
                break;
              }
            }
            if (parent == null) {
              break;
            }
            treeItem = parent;
          }
        }
      }
      if (scrollTreeItem != null) {
        if ((previousItem != null) && (time - hoverStart > 200L))
        {
          ScrollBar verticalScrollBar = tree.getVerticalBar();
          if (verticalScrollBar != null)
          {
            int before = verticalScrollBar.getSelection();
            
            tree.showItem(scrollTreeItem);
            
            previousItem = null;
            
            result = before != verticalScrollBar.getSelection();
          }
        }
        else if (item != previousItem)
        {
          previousItem = item;
          hoverStart = time;
        }
      }
    }
    else if ((item instanceof TableItem))
    {
      TableItem tableItem = (TableItem)item;
      
      Table table = tableItem.getParent();
      Point point = table.toControl(new Point(x, y));
      Rectangle bounds = table.getClientArea();
      if (table.getHeaderVisible())
      {
        int offset = table.getItemHeight();
        y += offset;
        height -= offset;
        y -= offset;
      }
      int index = table.indexOf(tableItem);
      
      int scrollEpsilon = Math.min(getBounds0height, height / 3);
      
      TableItem scrollTableItem = null;
      if (y < scrollEpsilon)
      {
        if (index > 0) {
          scrollTableItem = table.getItems()[(index - 1)];
        }
      }
      else if (height - y < scrollEpsilon) {
        if (index + 1 < table.getItems().length) {
          scrollTableItem = table.getItems()[(index + 1)];
        }
      }
      if (scrollTableItem != null) {
        if ((previousItem != null) && (time - hoverStart > 200L))
        {
          ScrollBar verticalScrollBar = table.getVerticalBar();
          if (verticalScrollBar != null)
          {
            int before = verticalScrollBar.getSelection();
            
            table.showItem(scrollTableItem);
            
            previousItem = null;
            
            result = before != verticalScrollBar.getSelection();
          }
        }
        else if (item != previousItem)
        {
          previousItem = item;
          hoverStart = time;
        }
      }
    }
    return result;
  }
  
  protected static float getLocation(DropTargetEvent event)
  {
    if ((item instanceof TreeItem))
    {
      TreeItem treeItem = (TreeItem)item;
      Control control = treeItem.getParent();
      Point point = control.toControl(new Point(x, y));
      Rectangle bounds = treeItem.getBounds();
      return (y - y) / height;
    }
    if ((item instanceof TableItem))
    {
      TableItem tableItem = (TableItem)item;
      Control control = tableItem.getParent();
      Point point = control.toControl(new Point(x, y));
      Rectangle bounds = tableItem.getBounds(0);
      return (y - y) / height;
    }
    return 0.0F;
  }
  
  protected class DragAndDropCommandInformation
  {
    protected Object target;
    protected float location;
    protected int operations;
    protected int operation;
    protected Collection source;
    
    public DragAndDropCommandInformation(Object target, float location, int operations, int operation, Collection source)
    {
      this.target = target;
      this.location = location;
      this.operations = operations;
      this.operation = operation;
      this.source = new ArrayList(source);
    }
    
    public DragAndDropCommand createCommand()
    {
      return dragAndDropManager.createCommand(target, location, operations, operation, source);
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.common.ui.internal.dnd.ViewerDropAdapter
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.common.ui.internal.navigator;

import org.eclipse.swt.graphics.Image;

public abstract interface ILoadingDDNode
{
  public abstract String getText();
  
  public abstract Image getImage();
}

/* Location:
 * Qualified Name:     org.eclipse.wst.common.ui.internal.navigator.ILoadingDDNode
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.common.ui.internal.search;

import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IResourceDelta;
import org.eclipse.core.resources.IResourceDeltaVisitor;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.search.ui.text.Match;

class AbstractSearchQuery$1
  implements IResourceDeltaVisitor
{
  final AbstractSearchQuery.SearchResultUpdater this$1;
  
  AbstractSearchQuery$1(AbstractSearchQuery.SearchResultUpdater paramSearchResultUpdater)
  {
    this$1 = paramSearchResultUpdater;
  }
  
  public boolean visit(IResourceDelta delta)
    throws CoreException
  {
    switch (delta.getKind())
    {
    case 1: 
      return false;
    case 2: 
      IResource res = delta.getResource();
      if ((res instanceof IFile))
      {
        Match[] matches = this$1.fResult.getMatches(res);
        this$1.fResult.removeMatches(matches);
      }
      break;
    }
    return true;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.common.ui.internal.search.AbstractSearchQuery.1
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.common.ui.internal.search;

import org.eclipse.core.resources.IResourceChangeEvent;
import org.eclipse.core.resources.IResourceChangeListener;
import org.eclipse.core.resources.IResourceDelta;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.search.ui.IQueryListener;
import org.eclipse.search.ui.ISearchQuery;
import org.eclipse.search.ui.NewSearchUI;

public class AbstractSearchQuery$SearchRe
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