org.eclipse.wst.jsdt.web.ui_1.0.401.v201108152113_patch

16:49:21.941 INFO  jd.cli.Main - Decompiling org.eclipse.wst.jsdt.web.ui_1.0.401.v201108152113_patch.jar
package org.eclipse.wst.jsdt.web.ui;

import java.util.MissingResourceException;
import java.util.ResourceBundle;

public class Messages
{
  private static final String BUNDLE_NAME = "org.eclipse.wst.jsdt.web.ui.messages";
  private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle("org.eclipse.wst.jsdt.web.ui.messages");
  
  public static String getString(String key)
  {
    try
    {
      return RESOURCE_BUNDLE.getString(key);
    }
    catch (MissingResourceException localMissingResourceException) {}
    return '!' + key + '!';
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.jsdt.web.ui.Messages
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.jsdt.web.ui;

import java.lang.reflect.InvocationTargetException;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.operation.IRunnableWithProgress;

class SetupProjectsWizzard$1
  implements IRunnableWithProgress
{
  SetupProjectsWizzard$1(SetupProjectsWizzard paramSetupProjectsWizzard, IProject paramIProject, boolean paramBoolean) {}
  
  public void run(IProgressMonitor monitor)
    throws InvocationTargetException, InterruptedException
  {
    SetupProjectsWizzard.access$0(this$0, val$project, val$openProperties, monitor);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.jsdt.web.ui.SetupProjectsWizzard.1
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.jsdt.web.ui;

import java.util.List;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.preference.PreferenceDialog;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.dialogs.PreferencesUtil;

class SetupProjectsWizzard$2
  implements Runnable
{
  SetupProjectsWizzard$2(SetupProjectsWizzard paramSetupProjectsWizzard, Shell paramShell, IProject paramIProject, List paramList, IProgressMonitor paramIProgressMonitor) {}
  
  public void run()
  {
    PreferenceDialog dialog = PreferencesUtil.createPropertyDialogOn(val$finalShell, val$project, "org.eclipse.wst.jsdt.ui.propertyPages.BuildPathsPropertyPage", (String[])val$pageIds.toArray(new String[val$pageIds.size()]), null);
    if (dialog.open() == 1) {
      SetupProjectsWizzard.access$1(this$0, val$project, val$monitor);
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.jsdt.web.ui.SetupProjectsWizzard.2
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.jsdt.web.ui;

import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtension;
import org.eclipse.core.runtime.IExtensionPoint;
import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Platform;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.preference.PreferenceDialog;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IActionDelegate;
import org.eclipse.ui.IObjectActionDelegate;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchPartSite;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.dialogs.PreferencesUtil;
import org.eclipse.ui.progress.IProgressService;
import org.eclipse.wst.jsdt.core.IIncludePathEntry;
import org.eclipse.wst.jsdt.core.IJavaScriptProject;
import org.eclipse.wst.jsdt.core.JavaScriptCore;
import org.eclipse.wst.jsdt.core.JavaScriptModelException;
import org.eclipse.wst.jsdt.web.core.internal.Logger;
import org.eclipse.wst.jsdt.web.core.internal.project.JsWebNature;
import org.eclipse.wst.jsdt.web.ui.internal.JsUIPlugin;

public class SetupProjectsWizzard
  implements IObjectActionDelegate, IActionDelegate
{
  IWorkbenchPart fPart;
  Object[] fTarget;
  
  private void doInstall(IProject project, boolean openProperties, IProgressMonitor monitor)
  {
    boolean configured = false;
    JsWebNature nature = new JsWebNature(project, monitor);
    try
    {
      boolean hadBasicNature = JsWebNature.hasNature(project);
      
      nature.configure();
      if (!hadBasicNature)
      {
        IJavaScriptProject jp = JavaScriptCore.create(project);
        IIncludePathEntry[] oldEntries = (IIncludePathEntry[])null;
        try
        {
          oldEntries = jp.getRawIncludepath();
        }
        catch (JavaScriptModelException ex1)
        {
          Logger.log(204, null, ex1);
        }
        IPath projectPath = project.getFullPath();
        IIncludePathEntry projectPathEntry = JavaScriptCore.newSourceEntry(projectPath);
        if (!Arrays.asList(oldEntries).contains(projectPathEntry))
        {
          IIncludePathEntry[] newEntries = new IIncludePathEntry[oldEntries.length + 1];
          System.arraycopy(oldEntries, 0, newEntries, 0, oldEntries.length);
          
          newEntries[oldEntries.length] = projectPathEntry;
          jp.setRawIncludepath(newEntries, monitor);
        }
      }
      configured = true;
    }
    catch (CoreException ex)
    {
      Logger.logException(ex);
    }
    if ((configured) && (openProperties)) {
      showPropertiesOn(project, monitor);
    }
  }
  
  private void doUninstall(IProject project, IProgressMonitor monitor)
  {
    JsWebNature nature = new JsWebNature(project, monitor);
    try
    {
      nature.deconfigure();
    }
    catch (CoreException ex)
    {
      Logger.logException(ex);
    }
  }
  
  private void install(final IProject project, final boolean openProperties)
  {
    IProgressService service = null;
    if (fPart != null) {
      service = (IProgressService)fPart.getSite().getService(IProgressService.class);
    }
    if (service == null)
    {
      doInstall(project, openProperties, null);
    }
    else
    {
      IRunnableWithProgress runnable = new IRunnableWithProgress()
      {
        public void run(IProgressMonitor monitor)
          throws InvocationTargetException, InterruptedException
        {
          SetupProjectsWizzard.this.doInstall(project, openProperties, monitor);
        }
      };
      try
      {
        service.run(false, false, runnable);
      }
      catch (InvocationTargetException e)
      {
        Logger.logException(e);
      }
      catch (InterruptedException e)
      {
        Logger.logException(e);
      }
    }
  }
  
  public void run(IAction action)
  {
    if (fTarget == null) {
      return;
    }
    for (int i = 0; i < fTarget.length; i++) {
      if ((fTarget[i] instanceof IResource))
      {
        IProject project = ((IResource)fTarget[i]).getProject();
        if (!JsWebNature.hasNature(project))
        {
          install(project, i == fTarget.length - 1);
        }
        else
        {
          IJavaScriptProject jp = JavaScriptCore.create(project);
          IIncludePathEntry[] rawClasspath = (IIncludePathEntry[])null;
          try
          {
            rawClasspath = jp.getRawIncludepath();
          }
          catch (JavaScriptModelException ex1)
          {
            Logger.log(204, null, ex1);
          }
          boolean browserFound = false;
          for (int k = 0; (rawClasspath != null) && (!browserFound) && (k < rawClasspath.length); k++) {
            if (rawClasspath[k].getPath().equals(JsWebNature.VIRTUAL_BROWSER_CLASSPATH)) {
              browserFound = true;
            }
          }
          if (!browserFound) {
            install(project, false);
          }
        }
      }
    }
  }
  
  public void selectionChanged(IAction action, ISelection selection)
  {
    if ((selection instanceof IStructuredSelection)) {
      fTarget = ((IStructuredSelection)selection).toArray();
    } else {
      fTarget = null;
    }
  }
  
  public void setActivePart(IAction action, IWorkbenchPart targetPart)
  {
    fPart = targetPart;
  }
  
  private void showPropertiesOn(final IProject project, final IProgressMonitor monitor)
  {
    IExtension[] extensions = Platform.getExtensionRegistry().getExtensionPoint("org.eclipse.ui.propertyPages").getExtensions();
    final List pageIds = new ArrayList(8);
    for (int i = 0; i < extensions.length; i++) {
      if (extensions[i].getNamespaceIdentifier().startsWith("org.eclipse.wst.jsdt."))
      {
        IConfigurationElement[] configurationElements = extensions[i].getConfigurationElements();
        for (int j = 0; j < configurationElements.length; j++) {
          if ("page".equals(configurationElements[j].getName())) {
            pageIds.add(configurationElements[j].getAttribute("id"));
          }
        }
      }
    }
    Shell shell = (Shell)fPart.getAdapter(Shell.class);
    if (shell == null)
    {
      IWorkbenchWindow activeWorkbenchWindow = JsUIPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow();
      if (activeWorkbenchWindow != null) {
        shell = activeWorkbenchWindow.getShell();
      }
    }
    final Shell finalShell = shell;
    if (finalShell != null) {
      finalShell.getDisplay().asyncExec(new Runnable()
      {
        public void run()
        {
          PreferenceDialog dialog = PreferencesUtil.createPropertyDialogOn(finalShell, project, "org.eclipse.wst.jsdt.ui.propertyPages.BuildPathsPropertyPage", (String[])pageIds.toArray(new String[pageIds.size()]), null);
          if (dialog.open() == 1) {
            SetupProjectsWizzard.this.doUninstall(project, monitor);
          }
        }
      });
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.jsdt.web.ui.SetupProjectsWizzard
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.jsdt.web.ui;

import org.eclipse.jface.text.IAutoEditStrategy;
import org.eclipse.jface.text.source.ISourceViewer;
import org.eclipse.wst.html.ui.StructuredTextViewerConfigurationHTML;
import org.eclipse.wst.jsdt.web.ui.internal.autoedit.AutoEditStrategyForJs;

public class StructuredTextViewerConfigurationJSDT
  extends StructuredTextViewerConfigurationHTML
{
  public IAutoEditStrategy[] getAutoEditStrategies(ISourceViewer sourceViewer, String contentType)
  {
    if ((contentType.equals("org.eclipse.wst.html.SCRIPT")) || (contentType.equals("org.eclipse.wst.html.SCRIPT.EVENTHANDLER")))
    {
      IAutoEditStrategy[] strategies = new IAutoEditStrategy[1];
      strategies[0] = new AutoEditStrategyForJs();
      return strategies;
    }
    return super.getAutoEditStrategies(sourceViewer, contentType);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.jsdt.web.ui.StructuredTextViewerConfigurationJSDT
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.jsdt.web.ui;

import org.eclipse.core.runtime.IPath;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.wst.jsdt.core.IJavaScriptProject;
import org.eclipse.wst.jsdt.internal.ui.IJsGlobalScopeContainerInitializerExtension;

public class WebProjectJsGlobalScopeUIInitializer
  implements IJsGlobalScopeContainerInitializerExtension
{
  public ImageDescriptor getImage(IPath containerPath, String element, IJavaScriptProject project)
  {
    return ImageDescriptor.createFromFile(getClass(), "web1.JPG");
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.jsdt.web.ui.WebProjectJsGlobalScopeUIInitializer
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.jsdt.web.ui.actions;

import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IObjectActionDelegate;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchPartSite;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.progress.IProgressService;
import org.eclipse.wst.jsdt.core.IJavaScriptElement;
import org.eclipse.wst.jsdt.core.IJavaScriptUnit;
import org.eclipse.wst.jsdt.core.IMember;
import org.eclipse.wst.jsdt.internal.ui.actions.WorkbenchRunnableAdapter;
import org.eclipse.wst.jsdt.internal.ui.util.ExceptionHandler;
import org.eclipse.wst.jsdt.web.ui.views.contentoutline.JsJfaceNode;

public class AddJavaDocStubAction
  implements IObjectActionDelegate
{
  private ISelection selection;
  private IWorkbenchPart targetPart;
  
  public String getDialogTitle()
  {
    return Messages.getString("AddJavaDocStubAction.0");
  }
  
  public Shell getShell()
  {
    return getSite().getShell();
  }
  
  public IWorkbenchPartSite getSite()
  {
    return targetPart.getSite();
  }
  
  public void run(IAction action)
  {
    IJavaScriptElement[] elements = JsElementActionProxy.getJsElementsFromSelection(selection);
    if ((elements == null) || (elements.length < 1)) {
      return;
    }
    IJavaScriptElement parent = elements[0].getParent();
    while ((parent != null) && (!(parent instanceof IJavaScriptUnit))) {}
    if (parent != null)
    {
      ArrayList members = new ArrayList();
      for (int i = 0; i < elements.length; i++) {
        if ((elements[i] instanceof IMember)) {
          members.add(elements[i]);
        }
      }
      JsJfaceNode[] node = SimpleJSDTActionProxy.getJsJfaceNodesFromSelection(selection);
      
      run((IJavaScriptUnit)parent, (IMember[])members.toArray(new IMember[members.size()]), node[0]);
    }
  }
  
  public void run(IJavaScriptUnit cu, IMember[] members, JsJfaceNode node)
  {
    try
    {
      AddJavaDocStubOperation op = new AddJavaDocStubOperation(members, node);
      PlatformUI.getWorkbench().getProgressService().runInUI(PlatformUI.getWorkbench().getProgressService(), new WorkbenchRunnableAdapter(op, op.getScheduleRule()), op.getScheduleRule());
    }
    catch (InvocationTargetException e)
    {
      ExceptionHandler.handle(e, getShell(), getDialogTitle(), Messages.getString("AddJavaDocStubAction.1"));
    }
    catch (InterruptedException localInterruptedException) {}
  }
  
  public void selectionChanged(IAction action, ISelection selection)
  {
    this.selection = selection;
  }
  
  public void setActivePart(IAction action, IWorkbenchPart targetPart)
  {
    this.targetPart = targetPart;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.jsdt.web.ui.actions.AddJavaDocStubAction
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.jsdt.web.ui.actions;

import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.jface.text.Document;
import org.eclipse.jface.text.IDocument;
import org.eclipse.wst.jsdt.core.IJavaScriptUnit;
import org.eclipse.wst.jsdt.core.IMember;
import org.eclipse.wst.jsdt.web.core.javascript.DocumentChangeListenerToTextEdit;
import org.eclipse.wst.jsdt.web.core.javascript.IJsTranslation;
import org.eclipse.wst.jsdt.web.ui.views.contentoutline.JsJfaceNode;

public class AddJavaDocStubOperation
  extends org.eclipse.wst.jsdt.internal.corext.codemanipulation.AddJavaDocStubOperation
{
  private IDocument copy;
  private JsJfaceNode node;
  private DocumentChangeListenerToTextEdit textEditListener;
  
  public AddJavaDocStubOperation(IMember[] members, JsJfaceNode node)
  {
    super(members);
    this.node = node;
  }
  
  /* Error */
  protected void applyChanges()
  {
    // Byte code:
    //   0: invokestatic 27	org/eclipse/wst/sse/core/StructuredModelManager:getModelManager	()Lorg/eclipse/wst/sse/core/internal/provisional/IModelManager;
    //   3: astore_1
    //   4: aconst_null
    //   5: astore_2
    //   6: aload_0
    //   7: getfield 17	org/eclipse/wst/jsdt/web/ui/actions/AddJavaDocStubOperation:node	Lorg/eclipse/wst/jsdt/web/ui/views/contentoutline/JsJfaceNode;
    //   10: invokevirtual 33	org/eclipse/wst/jsdt/web/ui/views/contentoutline/JsJfaceNode:getStructuredDocument	()Lorg/eclipse/wst/sse/core/internal/provisional/text/IStructuredDocument;
    //   13: astore_3
    //   14: aload_0
    //   15: getfield 39	org/eclipse/wst/jsdt/web/ui/actions/AddJavaDocStubOperation:textEditListener	Lorg/eclipse/wst/jsdt/web/core/javascript/DocumentChangeListenerToTextEdit;
    //   18: invokevirtual 41	org/eclipse/wst/jsdt/web/core/javascript/DocumentChangeListenerToTextEdit:getTextEdits	()Lorg/eclipse/text/edits/MultiTextEdit;
    //   21: astore 4
    //   23: aload_1
    //   24: aload_3
    //   25: invokeinterface 47 2 0
    //   30: astore_2
    //   31: aload_2
    //   32: invokeinterface 53 1 0
    //   37: aload_2
    //   38: aload_0
    //   39: ldc 58
    //   41: invokestatic 60	org/eclipse/wst/jsdt/web/ui/actions/Messages:getString	(Ljava/lang/String;)Ljava/lang/String;
    //   44: ldc 66
    //   46: invokestatic 60	org/eclipse/wst/jsdt/web/ui/actions/Messages:getString	(Ljava/lang/String;)Ljava/lang/String;
    //   49: invokeinterface 68 4 0
    //   54: aload 4
    //   56: aload_3
    //   57: invokevirtual 72	org/eclipse/text/edits/MultiTextEdit:apply	(Lorg/eclipse/jface/text/IDocument;)Lorg/eclipse/text/edits/UndoEdit;
    //   60: pop
    //   61: goto +97 -> 158
    //   64: astore 4
    //   66: aload 4
    //   68: invokevirtual 78	org/eclipse/text/edits/MalformedTreeException:printStackTrace	()V
    //   71: aload_2
    //   72: ifnull +109 -> 181
    //   75: aload_2
    //   76: aload_0
    //   77: invokeinterface 83 2 0
    //   82: aload_2
    //   83: invokeinterface 87 1 0
    //   88: aload_2
    //   89: invokeinterface 90 1 0
    //   94: goto +87 -> 181
    //   97: astore 4
    //   99: aload 4
    //   101: invokevirtual 93	org/eclipse/jface/text/BadLocationException:printStackTrace	()V
    //   104: aload_2
    //   105: ifnull +76 -> 181
    //   108: aload_2
    //   109: aload_0
    //   110: invokeinterface 83 2 0
    //   115: aload_2
    //   116: invokeinterface 87 1 0
    //   121: aload_2
    //   122: invokeinterface 90 1 0
    //   127: goto +54 -> 181
    //   130: astore 5
    //   132: aload_2
    //   133: ifnull +22 -> 155
    //   136: aload_2
    //   137: aload_0
    //   138: invokeinterface 83 2 0
    //   143: aload_2
    //   144: invokeinterface 87 1 0
    //   149: aload_2
    //   150: invokeinterface 90 1 0
    //   155: aload 5
    //   157: athrow
    //   158: aload_2
    //   159: ifnull +22 -> 181
    //   162: aload_2
    //   163: aload_0
    //   164: invokeinterface 83 2 0
    //   169: aload_2
    //   170: invokeinterface 87 1 0
    //   175: aload_2
    //   176: invokeinterface 90 1 0
    //   181: return
    // Line number table:
    //   Java source line #59	-> byte code offset #0
    //   Java source line #60	-> byte code offset #4
    //   Java source line #61	-> byte code offset #6
    //   Java source line #63	-> byte code offset #14
    //   Java source line #64	-> byte code offset #23
    //   Java source line #65	-> byte code offset #31
    //   Java source line #66	-> byte code offset #37
    //   Java source line #67	-> byte code offset #54
    //   Java source line #68	-> byte code offset #64
    //   Java source line #70	-> byte code offset #66
    //   Java source line #75	-> byte code offset #71
    //   Java source line #76	-> byte code offset #75
    //   Java source line #77	-> byte code offset #82
    //   Java source line #78	-> byte code offset #88
    //   Java source line #71	-> byte code offset #97
    //   Java source line #73	-> byte code offset #99
    //   Java source line #75	-> byte code offset #104
    //   Java source line #76	-> byte code offset #108
    //   Java source line #77	-> byte code offset #115
    //   Java source line #78	-> byte code offset #121
    //   Java source line #74	-> byte code offset #130
    //   Java source line #75	-> byte code offset #132
    //   Java source line #76	-> byte code offset #136
    //   Java source line #77	-> byte code offset #143
    //   Java source line #78	-> byte code offset #149
    //   Java source line #80	-> byte code offset #155
    //   Java source line #75	-> byte code offset #158
    //   Java source line #76	-> byte code offset #162
    //   Java source line #77	-> byte code offset #169
    //   Java source line #78	-> byte code offset #175
    //   Java source line #81	-> byte code offset #181
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	182	0	this	AddJavaDocStubOperation
    //   3	21	1	modelManager	org.eclipse.wst.sse.core.internal.provisional.IModelManager
    //   5	171	2	model	org.eclipse.wst.sse.core.internal.provisional.IStructuredModel
    //   13	44	3	doc	org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument
    //   21	34	4	edits	org.eclipse.text.edits.MultiTextEdit
    //   64	3	4	ex	org.eclipse.text.edits.MalformedTreeException
    //   97	3	4	ex	org.eclipse.jface.text.BadLocationException
    //   130	26	5	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   14	61	64	org/eclipse/text/edits/MalformedTreeException
    //   14	61	97	org/eclipse/jface/text/BadLocationException
    //   14	71	130	finally
    //   97	104	130	finally
  }
  
  protected IDocument getDocument(IJavaScriptUnit cu, IProgressMonitor monitor)
    throws CoreException
  {
    return getJavaDocumentFromNode();
  }
  
  protected IDocument getJavaDocumentFromNode()
  {
    if (copy == null)
    {
      IJsTranslation tran = node.getTranslation();
      copy = new Document(tran.getJsText());
      textEditListener = new DocumentChangeListenerToTextEdit();
      copy.addDocumentListener(textEditListener);
    }
    return copy;
  }
  
  public void run(IProgressMonitor monitor)
    throws CoreException, OperationCanceledException
  {
    super.run(monitor);
    applyChanges();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.jsdt.web.ui.actions.AddJavaDocStubOperation
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.jsdt.web.ui.actions;

import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.wst.jsdt.core.IJavaScriptElement;

public class FindReferencesAction
  extends JsElementActionProxy
{
  public Object[] getRunArgs(IAction action)
  {
    IJavaScriptElement[] elements = JsElementActionProxy.getJsElementsFromSelection(getCurrentSelection());
    if ((elements != null) && (elements.length > 0)) {
      return new Object[] { elements[0] };
    }
    return new Object[0];
  }
  
  public Class[] getRunArgTypes()
  {
    return new Class[] { IJavaScriptElement.class };
  }
  
  public void selectionChanged(IAction action, ISelection selection)
  {
    setSelection(selection);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.jsdt.web.ui.actions.FindReferencesAction
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.jsdt.web.ui.actions;

import java.lang.reflect.InvocationTargetException;
import org.eclipse.jface.action.IAction;
import org.eclipse.wst.jsdt.core.IJavaScriptElement;

public class FindReferencesInWorkingSetAction
  extends FindReferencesAction
{
  public void run(IAction action)
  {
    try
    {
      Object handler = getActionHandler(action);
      IJavaScriptElement[] elements = JsElementActionProxy.getJsElementsFromSelection(getCurrentSelection());
      if ((elements == null) || (elements.length == 0)) {
        return;
      }
      SimpleJSDTActionProxy.executeMethod(handler, "run", new Class[] { IJavaScriptElement.class }, new Object[] { elements[0] });
    }
    catch (IllegalArgumentException ex)
    {
      ex.printStackTrace();
    }
    catch (SecurityException ex)
    {
      ex.printStackTrace();
    }
    catch (IllegalAccessException ex)
    {
      ex.printStackTrace();
    }
    catch (NoSuchMethodException ex)
    {
      ex.printStackTrace();
    }
    catch (InstantiationException ex)
    {
      ex.printStackTrace();
    }
    catch (InvocationTargetException localInvocationTargetException) {}
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.jsdt.web.ui.actions.FindReferencesInWorkingSetAction
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.jsdt.web.ui.actions;

import java.util.ArrayList;
import java.util.Iterator;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.wst.jsdt.core.IJavaScriptElement;
import org.eclipse.wst.jsdt.web.ui.views.contentoutline.IJavaWebNode;

public class JsElementActionProxy
  extends SimpleJSDTActionProxy
{
  public static IJavaScriptElement[] getJsElementsFromSelection(ISelection selection)
  {
    if (selection == null) {
      return new IJavaScriptElement[0];
    }
    ArrayList elements = new ArrayList();
    if ((selection instanceof IStructuredSelection))
    {
      Iterator itt = ((IStructuredSelection)selection).iterator();
      while (itt.hasNext())
      {
        Object element = itt.next();
        if ((element instanceof IJavaScriptElement)) {
          elements.add(element);
        }
        if ((element instanceof IJavaWebNode)) {
          elements.add(((IJavaWebNode)element).getJavaElement());
        }
      }
      return (IJavaScriptElement[])elements.toArray(new IJavaScriptElement[elements.size()]);
    }
    return new IJavaScriptElement[0];
  }
  
  public Object[] getRunArgs(IAction action)
  {
    return new Object[] { getJsElementsFromSelection(getCurrentSelection()) };
  }
  
  public Class[] getRunArgTypes()
  {
    return new Class[] { new IJavaScriptElement[0].getClass() };
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.jsdt.web.ui.actions.JsElementActionProxy
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.jsdt.web.ui.actions;

import java.util.MissingResourceException;
import java.util.ResourceBundle;

public class Messages
{
  private static final String BUNDLE_NAME = "org.eclipse.wst.jsdt.web.ui.actions.messages";
  private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle("org.eclipse.wst.jsdt.web.ui.actions.messages");
  
  public static String getString(String key)
  {
    try
    {
      return RESOURCE_BUNDLE.getString(key);
    }
    catch (MissingResourceException localMissingResourceException) {}
    return '!' + key + '!';
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.jsdt.web.ui.actions.Messages
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.jsdt.web.ui.actions;

import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.wst.jsdt.core.IJavaScriptElement;

public class OpenCallHierarchyAction
  extends JsElementActionProxy
{
  public void selectionChanged(IAction action, ISelection selection)
  {
    IJavaScriptElement[] elements = JsElementActionProxy.getJsElementsFromSelection(selection);
    for (int i = 0; i < elements.length; i++) {
      if (elements[i].getElementType() == 7)
      {
        action.setEnabled(false);
        return;
      }
    }
    super.selectionChanged(action, selection);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.jsdt.web.ui.actions.OpenCallHierarchyAction
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.jsdt.web.ui.actions;

import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.wst.jsdt.core.IJavaScriptElement;

public class OpenTypeHierarchy
  extends JsElementActionProxy
{
  public void selectionChanged(IAction action, ISelection selection)
  {
    IJavaScriptElement[] elements = JsElementActionProxy.getJsElementsFromSelection(selection);
    for (int i = 0; i < elements.length; i++) {
      if (elements[i].getElementType() != 7)
      {
        action.setEnabled(false);
        return;
      }
    }
    super.selectionChanged(action, selection);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.jsdt.web.ui.actions.OpenTypeHierarchy
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.jsdt.web.ui.actions;

import java.net.URI;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.ui.IViewPart;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchPartSite;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.part.ISetSelectionTarget;
import org.eclipse.wst.jsdt.core.IJavaScriptElement;
import org.eclipse.wst.jsdt.core.IJavaScriptProject;
import org.eclipse.wst.jsdt.internal.ui.util.ExceptionHandler;

public class ShowHistoryAction
  extends JsElementActionProxy
{
  private IResource getHostResource(IJavaScriptElement virtualElement)
  {
    IProject project = virtualElement.getJavaScriptProject().getProject();
    IPath path = new Path(virtualElement.getHostPath().getPath());
    IResource host = project.getWorkspace().getRoot().findMember(path);
    return host;
  }
  
  public void run(IAction action)
  {
    IJavaScriptElement[] elements = JsElementActionProxy.getJsElementsFromSelection(getCurrentSelection());
    if ((elements == null) || (elements.length == 0)) {
      return;
    }
    IResource resource = null;
    if (elements[0].isVirtual()) {
      resource = getHostResource(elements[0]);
    } else {
      resource = elements[0].getResource();
    }
    if (resource == null) {
      return;
    }
    try
    {
      IWorkbenchPage page = targetWorkbenchPart.getSite().getPage();
      IViewPart view = page.showView("org.eclipse.ui.views.ResourceNavigator");
      if ((view instanceof ISetSelectionTarget))
      {
        ISelection selection = new StructuredSelection(resource);
        ((ISetSelectionTarget)view).selectReveal(selection);
      }
    }
    catch (PartInitException e)
    {
      ExceptionHandler.handle(e, targetWorkbenchPart.getSite().getShell(), Messages.getString("ShowHistoryAction.0"), Messages.getString("ShowHistoryAction.1") + e);
    }
  }
  
  public void selectionChanged(IAction action, ISelection selection)
  {
    setSelection(selection);
    IJavaScriptElement[] elements = JsElementActionProxy.getJsElementsFromSelection(getCurrentSelection());
    for (int i = 0; i < elements.length; i++) {
      if (elements[i].isVirtual())
      {
        IResource resource = getHostResource(elements[i]);
        if ((resource == null) || (!resource.exists())) {
          action.setEnabled(false);
        }
      }
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.jsdt.web.ui.actions.ShowHistoryAction
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.jsdt.web.ui.actions;

import java.net.URI;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.ui.IViewPart;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchPartSite;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.part.ISetSelectionTarget;
import org.eclipse.wst.jsdt.core.IJavaScriptElement;
import org.eclipse.wst.jsdt.core.IJavaScriptProject;
import org.eclipse.wst.jsdt.internal.ui.util.ExceptionHandler;

public class ShowInNavigatorAction
  extends JsElementActionProxy
{
  private IResource getHostResource(IJavaScriptElement virtualElement)
  {
    IProject project = virtualElement.getJavaScriptProject().getProject();
    IPath path = new Path(virtualElement.getHostPath().getPath());
    IResource host = project.getWorkspace().getRoot().findMember(path);
    return host;
  }
  
  public void run(IAction action)
  {
    IJavaScriptElement[] elements = JsElementActionProxy.getJsElementsFromSelection(getCurrentSelection());
    if ((elements == null) || (elements.length == 0)) {
      return;
    }
    IResource resource = null;
    if (elements[0].isVirtual()) {
      resource = getHostResource(elements[0]);
    } else {
      resource = elements[0].getResource();
    }
    if (resource == null) {
      return;
    }
    try
    {
      IWorkbenchPage page = targetWorkbenchPart.getSite().getPage();
      IViewPart view = page.showView("org.eclipse.ui.views.ResourceNavigator");
      if ((view instanceof ISetSelectionTarget))
      {
        ISelection selection = new StructuredSelection(resource);
        ((ISetSelectionTarget)view).selectReveal(selection);
      }
    }
    catch (PartInitException e)
    {
      ExceptionHandler.handle(e, targetWorkbenchPart.getSite().getShell(), Messages.getString("ShowInNavigatorAction.0"), Messages.getString("ShowInNavigatorAction.1") + e);
    }
  }
  
  public void selectionChanged(IAction action, ISelection selection)
  {
    setSelection(selection);
    IJavaScriptElement[] elements = JsElementActionProxy.getJsElementsFromSelection(getCurrentSelection());
    for (int i = 0; i < elements.length; i++) {
      if (elements[i].isVirtual())
      {
        IResource resource = getHostResource(elements[i]);
        if ((resource == null) || (!resource.exists())) {
          action.setEnabled(false);
        }
      }
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.jsdt.web.ui.actions.ShowInNavigatorAction
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.jsdt.web.ui.actions;

import java.net.URI;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.ui.part.ISetSelectionTarget;
import org.eclipse.wst.jsdt.core.IJavaScriptElement;
import org.eclipse.wst.jsdt.core.IJavaScriptProject;
import org.eclipse.wst.jsdt.internal.ui.packageview.PackageExplorerPart;

public class ShowInScriptExplorerAction
  extends JsElementActionProxy
{
  private IResource getHostResource(IJavaScriptElement virtualElement)
  {
    IProject project = virtualElement.getJavaScriptProject().getProject();
    IPath path = new Path(virtualElement.getHostPath().getPath());
    IResource host = project.getWorkspace().getRoot().findMember(path);
    return host;
  }
  
  public Object[] getRunArgs(IAction action)
  {
    IJavaScriptElement[] elements = JsElementActionProxy.getJsElementsFromSelection(getCurrentSelection());
    if ((elements != null) && (elements.length > 0)) {
      return new Object[] { elements[0] };
    }
    return new Object[0];
  }
  
  public Class[] getRunArgTypes()
  {
    return new Class[] { IJavaScriptElement.class };
  }
  
  public void run(IAction action)
  {
    IJavaScriptElement[] elements = JsElementActionProxy.getJsElementsFromSelection(getCurrentSelection());
    if ((elements == null) || (elements.length == 0)) {
      return;
    }
    IResource resource = null;
    if (elements[0].isVirtual()) {
      resource = getHostResource(elements[0]);
    } else {
      resource = elements[0].getResource();
    }
    if (resource == null) {
      return;
    }
    try
    {
      PackageExplorerPart view = PackageExplorerPart.openInActivePerspective();
      view.tryToReveal(resource);
      if ((view instanceof ISetSelectionTarget))
      {
        ISelection selection = new StructuredSelection(resource);
        view.selectReveal(selection);
      }
    }
    catch (Exception localException) {}
  }
  
  public void selectionChanged(IAction action, ISelection selection)
  {
    setSelection(selection);
    IJavaScriptElement[] elements = JsElementActionProxy.getJsElementsFromSelection(getCurrentSelection());
    for (int i = 0; i < elements.length; i++) {
      if (elements[i].isVirtual())
      {
        IResource resource = getHostResource(elements[i]);
        if ((resource == null) || (!resource.exists())) {
          action.setEnabled(false);
        }
      }
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.jsdt.web.ui.actions.ShowInScriptExplorerAction
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.jsdt.web.ui.actions;

import java.io.PrintStream;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Iterator;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.ui.IObjectActionDelegate;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchSite;
import org.eclipse.wst.jsdt.web.ui.views.contentoutline.JsJfaceNode;

public class SimpleJSDTActionProxy
  implements IObjectActionDelegate
{
  protected Object actionHandlerTarget;
  private ISelection currentSelection;
  protected IAction handlerTargetAction;
  protected IWorkbenchPart targetWorkbenchPart;
  
  public static Object executeMethod(Object handler, String methodName, Class[] paramaterTypes, Object[] paramaterValues)
    throws SecurityException, NoSuchMethodException, IllegalArgumentException, IllegalAccessException, InvocationTargetException
  {
    Class target = handler.getClass();
    Method m = target.getMethod(methodName, paramaterTypes);
    return m.invoke(handler, paramaterValues);
  }
  
  public static JsJfaceNode[] getJsJfaceNodesFromSelection(ISelection selection)
  {
    if (selection == null) {
      return new JsJfaceNode[0];
    }
    ArrayList elements = new ArrayList();
    if ((selection instanceof IStructuredSelection))
    {
      Iterator itt = ((IStructuredSelection)selection).iterator();
      while (itt.hasNext())
      {
        Object element = itt.next();
        if ((element instanceof JsJfaceNode)) {
          elements.add(element);
        }
      }
      return (JsJfaceNode[])elements.toArray(new JsJfaceNode[elements.size()]);
    }
    return new JsJfaceNode[0];
  }
  
  protected Object getActionHandler(IAction action)
    throws IllegalAccessException, NoSuchMethodException, IllegalArgumentException, InstantiationException, InvocationTargetException
  {
    if ((handlerTargetAction == action) && (actionHandlerTarget != null)) {
      return actionHandlerTarget;
    }
    Class target = null;
    String className = getActionHandlerClassName(action);
    try
    {
      target = Class.forName(className);
    }
    catch (ClassNotFoundException ex)
    {
      System.out.println("Error.. Class target of action handler not found: " + action);
      System.out.println(Messages.getString("SimpleJSDTActionProxy.0") + ex);
   
1 2 3 4 5 6 7 8 9 10

Further reading...

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

New!JAR listings


Copyright 2006-2017. Infinite Loop Ltd