diff options
Diffstat (limited to 'tests/org.eclipse.wst.xml.xpath2.processor.tests/coverageReport/_files/c42.html')
-rw-r--r-- | tests/org.eclipse.wst.xml.xpath2.processor.tests/coverageReport/_files/c42.html | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/tests/org.eclipse.wst.xml.xpath2.processor.tests/coverageReport/_files/c42.html b/tests/org.eclipse.wst.xml.xpath2.processor.tests/coverageReport/_files/c42.html deleted file mode 100644 index d04a3cbc..00000000 --- a/tests/org.eclipse.wst.xml.xpath2.processor.tests/coverageReport/_files/c42.html +++ /dev/null @@ -1 +0,0 @@ -<HTML><HEAD><META CONTENT="text/html; charset=UTF-8" HTTP-EQUIV="Content-Type"/><TITLE>EMMA Coverage Report</TITLE><STYLE TYPE="text/css"> TABLE,TD,TH {border-style:solid; border-color:black;} TD,TH {background:white;margin:0;line-height:100%;padding-left:0.5em;padding-right:0.5em;} TD {border-width:0 1px 0 0;} TH {border-width:1px 1px 1px 0;} TR TD.h {color:red;} TABLE {border-spacing:0; border-collapse:collapse;border-width:0 0 1px 1px;} P,H1,H2,H3,TH {font-family:verdana,arial,sans-serif;font-size:10pt;} TD {font-family:courier,monospace;font-size:10pt;} TABLE.hdft {border-spacing:0;border-collapse:collapse;border-style:none;} TABLE.hdft TH,TABLE.hdft TD {border-style:none;line-height:normal;} TABLE.hdft TH.tl,TABLE.hdft TD.tl {background:#6699CC;color:white;} TABLE.hdft TD.nv {background:#6633DD;color:white;} .nv A:link {color:white;} .nv A:visited {color:white;} .nv A:active {color:yellow;} TABLE.hdft A:link {color:white;} TABLE.hdft A:visited {color:white;} TABLE.hdft A:active {color:yellow;} .in {color:#356085;} TABLE.s TD {padding-left:0.25em;padding-right:0.25em;} TABLE.s TD.l {padding-left:0.25em;padding-right:0.25em;text-align:right;background:#F0F0F0;} TABLE.s TR.z TD {background:#FF9999;} TABLE.s TR.p TD {background:#FFFF88;} TABLE.s TR.c TD {background:#CCFFCC;} A:link {color:#0000EE;text-decoration:none;} A:visited {color:#0000EE;text-decoration:none;} A:hover {color:#0000EE;text-decoration:underline;} TABLE.cn {border-width:0 0 1px 0;} TABLE.s {border-width:1px 0 1px 1px;} TD.h {color:red;border-width:0 1px 0 0;} TD.f {border-width:0 1px 0 1px;} TD.hf {color:red;border-width:0 1px 0 1px;} TH.f {border-width:1px 1px 1px 1px;} TR.cis TD {background:#F0F0F0;} TR.cis TD {border-width:1px 1px 1px 0;} TR.cis TD.h {color:red;border-width:1px 1px 1px 0;} TR.cis TD.f {border-width:1px 1px 1px 1px;} TR.cis TD.hf {color:red;border-width:1px 1px 1px 1px;} TD.b {border-style:none;background:transparent;line-height:50%;} TD.bt {border-width:1px 0 0 0;background:transparent;line-height:50%;} TR.o TD {background:#F0F0F0;}TABLE.it {border-style:none;}TABLE.it TD,TABLE.it TH {border-style:none;}</STYLE></HEAD><BODY><TABLE CLASS="hdft" CELLSPACING="0" WIDTH="100%"><TR><TH CLASS="tl"><A HREF="http://www.eclemma.org/">EMMA</A> Coverage Report (generated Tue Jun 09 19:59:05 GMT 2009)</TH></TR><TR><TD CLASS="nv">[<A HREF="../xslUnitTestCoverage.html">all classes</A>][<A HREF="124.html">org.eclipse.wst.jsdt.internal.core</A>]</TD></TR></TABLE><H2>COVERAGE SUMMARY FOR SOURCE FILE [<SPAN CLASS="in">JavaModelOperation.java</SPAN>]</H2><TABLE CELLSPACING="0" WIDTH="100%"><TR><TH>name</TH><TH>class, %</TH><TH>method, %</TH><TH>block, %</TH><TH>line, %</TH></TR><TR><TD>JavaModelOperation.java</TD><TD CLASS="h">0% (0/1)</TD><TD CLASS="h">0% (0/61)</TD><TD CLASS="h">0% (0/1406)</TD><TD CLASS="h">0% (0/341)</TD></TR></TABLE><H3>COVERAGE BREAKDOWN BY CLASS AND METHOD</H3><TABLE CLASS="cn" CELLSPACING="0" WIDTH="100%"><TR><TH CLASS="f">name</TH><TH>class, %</TH><TH>method, %</TH><TH>block, %</TH><TH>line, %</TH></TR><TR><TD CLASS="b"> </TD><TD CLASS="b"> </TD><TD CLASS="b"> </TD><TD CLASS="b"> </TD><TD CLASS="b"> </TD></TR><TR CLASS="cis"><TD CLASS="f">class <A HREF="#0">JavaModelOperation</A></TD><TD CLASS="h">0% (0/1)</TD><TD CLASS="h">0% (0/61)</TD><TD CLASS="h">0% (0/1406)</TD><TD CLASS="h">0% (0/341)</TD></TR><TR><TD CLASS="f"><A HREF="#0"><static initializer></A></TD><TD> </TD><TD CLASS="h">0% (0/1)</TD><TD CLASS="h">0% (0/8)</TD><TD CLASS="h">0% (0/3)</TD></TR><TR CLASS="o"><TD CLASS="f"><A HREF="#2">JavaModelOperation (): void</A></TD><TD> </TD><TD CLASS="h">0% (0/1)</TD><TD CLASS="h">0% (0/21)</TD><TD CLASS="h">0% (0/8)</TD></TR><TR><TD CLASS="f"><A HREF="#3">JavaModelOperation (IJavaScriptElement []): void</A></TD><TD> </TD><TD CLASS="h">0% (0/1)</TD><TD CLASS="h">0% (0/24)</TD><TD CLASS="h">0% (0/9)</TD></TR><TR CLASS="o"><TD CLASS="f"><A HREF="#4">JavaModelOperation (IJavaScriptElement [], IJavaScriptElement []): void</A></TD><TD> </TD><TD CLASS="h">0% (0/1)</TD><TD CLASS="h">0% (0/27)</TD><TD CLASS="h">0% (0/10)</TD></TR><TR><TD CLASS="f"><A HREF="#5">JavaModelOperation (IJavaScriptElement [], IJavaScriptElement [], boolean): void</A></TD><TD> </TD><TD CLASS="h">0% (0/1)</TD><TD CLASS="h">0% (0/30)</TD><TD CLASS="h">0% (0/11)</TD></TR><TR CLASS="o"><TD CLASS="f"><A HREF="#6">JavaModelOperation (IJavaScriptElement [], boolean): void</A></TD><TD> </TD><TD CLASS="h">0% (0/1)</TD><TD CLASS="h">0% (0/27)</TD><TD CLASS="h">0% (0/10)</TD></TR><TR><TD CLASS="f"><A HREF="#7">JavaModelOperation (IJavaScriptElement): void</A></TD><TD> </TD><TD CLASS="h">0% (0/1)</TD><TD CLASS="h">0% (0/29)</TD><TD CLASS="h">0% (0/9)</TD></TR><TR CLASS="o"><TD CLASS="f"><A HREF="#8">JavaModelOperation (IJavaScriptElement, boolean): void</A></TD><TD> </TD><TD CLASS="h">0% (0/1)</TD><TD CLASS="h">0% (0/32)</TD><TD CLASS="h">0% (0/10)</TD></TR><TR><TD CLASS="f"><A HREF="#9">addAction (JavaModelOperation$IPostAction): void</A></TD><TD> </TD><TD CLASS="h">0% (0/1)</TD><TD CLASS="h">0% (0/33)</TD><TD CLASS="h">0% (0/5)</TD></TR><TR CLASS="o"><TD CLASS="f"><A HREF="#a">addDelta (IJavaScriptElementDelta): void</A></TD><TD> </TD><TD CLASS="h">0% (0/1)</TD><TD CLASS="h">0% (0/5)</TD><TD CLASS="h">0% (0/2)</TD></TR><TR><TD CLASS="f"><A HREF="#b">addReconcileDelta (IJavaScriptUnit, IJavaScriptElementDelta): void</A></TD><TD> </TD><TD CLASS="h">0% (0/1)</TD><TD CLASS="h">0% (0/50)</TD><TD CLASS="h">0% (0/11)</TD></TR><TR CLASS="o"><TD CLASS="f"><A HREF="#c">beginTask (String, int): void</A></TD><TD> </TD><TD CLASS="h">0% (0/1)</TD><TD CLASS="h">0% (0/9)</TD><TD CLASS="h">0% (0/3)</TD></TR><TR><TD CLASS="f"><A HREF="#d">canModifyRoots (): boolean</A></TD><TD> </TD><TD CLASS="h">0% (0/1)</TD><TD CLASS="h">0% (0/2)</TD><TD CLASS="h">0% (0/1)</TD></TR><TR CLASS="o"><TD CLASS="f"><A HREF="#e">checkCanceled (): void</A></TD><TD> </TD><TD CLASS="h">0% (0/1)</TD><TD CLASS="h">0% (0/9)</TD><TD CLASS="h">0% (0/3)</TD></TR><TR><TD CLASS="f"><A HREF="#f">commonVerify (): IJavaScriptModelStatus</A></TD><TD> </TD><TD CLASS="h">0% (0/1)</TD><TD CLASS="h">0% (0/33)</TD><TD CLASS="h">0% (0/6)</TD></TR><TR CLASS="o"><TD CLASS="f"><A HREF="#10">copyResources (IResource [], IPath): void</A></TD><TD> </TD><TD CLASS="h">0% (0/1)</TD><TD CLASS="h">0% (0/28)</TD><TD CLASS="h">0% (0/7)</TD></TR><TR><TD CLASS="f"><A HREF="#11">createFile (IContainer, String, InputStream, boolean): void</A></TD><TD> </TD><TD CLASS="h">0% (0/1)</TD><TD CLASS="h">0% (0/29)</TD><TD CLASS="h">0% (0/9)</TD></TR><TR CLASS="o"><TD CLASS="f"><A HREF="#12">createFolder (IContainer, String, boolean): void</A></TD><TD> </TD><TD CLASS="h">0% (0/1)</TD><TD CLASS="h">0% (0/29)</TD><TD CLASS="h">0% (0/9)</TD></TR><TR><TD CLASS="f"><A HREF="#13">deleteEmptyPackageFragment (IPackageFragment, boolean, IResource): void</A></TD><TD> </TD><TD CLASS="h">0% (0/1)</TD><TD CLASS="h">0% (0/53)</TD><TD CLASS="h">0% (0/15)</TD></TR><TR CLASS="o"><TD CLASS="f"><A HREF="#14">deleteResource (IResource, int): void</A></TD><TD> </TD><TD CLASS="h">0% (0/1)</TD><TD CLASS="h">0% (0/17)</TD><TD CLASS="h">0% (0/5)</TD></TR><TR><TD CLASS="f"><A HREF="#15">deleteResources (IResource [], boolean): void</A></TD><TD> </TD><TD CLASS="h">0% (0/1)</TD><TD CLASS="h">0% (0/37)</TD><TD CLASS="h">0% (0/11)</TD></TR><TR CLASS="o"><TD CLASS="f"><A HREF="#16">done (): void</A></TD><TD> </TD><TD CLASS="h">0% (0/1)</TD><TD CLASS="h">0% (0/7)</TD><TD CLASS="h">0% (0/3)</TD></TR><TR><TD CLASS="f"><A HREF="#17">equalsOneOf (IPath, IPath []): boolean</A></TD><TD> </TD><TD CLASS="h">0% (0/1)</TD><TD CLASS="h">0% (0/20)</TD><TD CLASS="h">0% (0/4)</TD></TR><TR CLASS="o"><TD CLASS="f"><A HREF="#18">executeNestedOperation (JavaModelOperation, int): void</A></TD><TD> </TD><TD CLASS="h">0% (0/1)</TD><TD CLASS="h">0% (0/50)</TD><TD CLASS="h">0% (0/15)</TD></TR><TR><TD CLASS="f"><A HREF="#19">firstActionWithID (String, int): int</A></TD><TD> </TD><TD CLASS="h">0% (0/1)</TD><TD CLASS="h">0% (0/20)</TD><TD CLASS="h">0% (0/4)</TD></TR><TR CLASS="o"><TD CLASS="f"><A HREF="#1a">getAttribute (Object): Object</A></TD><TD> </TD><TD CLASS="h">0% (0/1)</TD><TD CLASS="h">0% (0/22)</TD><TD CLASS="h">0% (0/6)</TD></TR><TR><TD CLASS="f"><A HREF="#1b">getCompilationUnitFor (IJavaScriptElement): IJavaScriptUnit</A></TD><TD> </TD><TD CLASS="h">0% (0/1)</TD><TD CLASS="h">0% (0/4)</TD><TD CLASS="h">0% (0/1)</TD></TR><TR CLASS="o"><TD CLASS="f"><A HREF="#1c">getCurrentOperationStack (): ArrayList</A></TD><TD> </TD><TD CLASS="h">0% (0/1)</TD><TD CLASS="h">0% (0/15)</TD><TD CLASS="h">0% (0/5)</TD></TR><TR><TD CLASS="f"><A HREF="#1d">getDocument (IJavaScriptUnit): IDocument</A></TD><TD> </TD><TD CLASS="h">0% (0/1)</TD><TD CLASS="h">0% (0/14)</TD><TD CLASS="h">0% (0/4)</TD></TR><TR CLASS="o"><TD CLASS="f"><A HREF="#1e">getElementToProcess (): IJavaScriptElement</A></TD><TD> </TD><TD CLASS="h">0% (0/1)</TD><TD CLASS="h">0% (0/14)</TD><TD CLASS="h">0% (0/3)</TD></TR><TR><TD CLASS="f"><A HREF="#1f">getElementsToProcess (): IJavaScriptElement []</A></TD><TD> </TD><TD CLASS="h">0% (0/1)</TD><TD CLASS="h">0% (0/3)</TD><TD CLASS="h">0% (0/1)</TD></TR><TR CLASS="o"><TD CLASS="f"><A HREF="#20">getJavaModel (): IJavaScriptModel</A></TD><TD> </TD><TD CLASS="h">0% (0/1)</TD><TD CLASS="h">0% (0/3)</TD><TD CLASS="h">0% (0/1)</TD></TR><TR><TD CLASS="f"><A HREF="#21">getNestedFolders (IPackageFragmentRoot): IPath []</A></TD><TD> </TD><TD CLASS="h">0% (0/1)</TD><TD CLASS="h">0% (0/54)</TD><TD CLASS="h">0% (0/12)</TD></TR><TR CLASS="o"><TD CLASS="f"><A HREF="#22">getParentElement (): IJavaScriptElement</A></TD><TD> </TD><TD CLASS="h">0% (0/1)</TD><TD CLASS="h">0% (0/14)</TD><TD CLASS="h">0% (0/3)</TD></TR><TR><TD CLASS="f"><A HREF="#23">getParentElements (): IJavaScriptElement []</A></TD><TD> </TD><TD CLASS="h">0% (0/1)</TD><TD CLASS="h">0% (0/3)</TD><TD CLASS="h">0% (0/1)</TD></TR><TR CLASS="o"><TD CLASS="f"><A HREF="#24">getResultElements (): IJavaScriptElement []</A></TD><TD> </TD><TD CLASS="h">0% (0/1)</TD><TD CLASS="h">0% (0/3)</TD><TD CLASS="h">0% (0/1)</TD></TR><TR><TD CLASS="f"><A HREF="#25">getSchedulingRule (): ISchedulingRule</A></TD><TD> </TD><TD CLASS="h">0% (0/1)</TD><TD CLASS="h">0% (0/3)</TD><TD CLASS="h">0% (0/1)</TD></TR><TR CLASS="o"><TD CLASS="f"><A HREF="#26">getSubProgressMonitor (int): IProgressMonitor</A></TD><TD> </TD><TD CLASS="h">0% (0/1)</TD><TD CLASS="h">0% (0/15)</TD><TD CLASS="h">0% (0/4)</TD></TR><TR><TD CLASS="f"><A HREF="#27">hasModifiedResource (): boolean</A></TD><TD> </TD><TD CLASS="h">0% (0/1)</TD><TD CLASS="h">0% (0/11)</TD><TD CLASS="h">0% (0/1)</TD></TR><TR CLASS="o"><TD CLASS="f"><A HREF="#28">internalWorked (double): void</A></TD><TD> </TD><TD CLASS="h">0% (0/1)</TD><TD CLASS="h">0% (0/8)</TD><TD CLASS="h">0% (0/3)</TD></TR><TR><TD CLASS="f"><A HREF="#29">isCanceled (): boolean</A></TD><TD> </TD><TD CLASS="h">0% (0/1)</TD><TD CLASS="h">0% (0/9)</TD><TD CLASS="h">0% (0/3)</TD></TR><TR CLASS="o"><TD CLASS="f"><A HREF="#2a">isReadOnly (): boolean</A></TD><TD> </TD><TD CLASS="h">0% (0/1)</TD><TD CLASS="h">0% (0/2)</TD><TD CLASS="h">0% (0/1)</TD></TR><TR><TD CLASS="f"><A HREF="#2b">isTopLevelOperation (): boolean</A></TD><TD> </TD><TD CLASS="h">0% (0/1)</TD><TD CLASS="h">0% (0/14)</TD><TD CLASS="h">0% (0/3)</TD></TR><TR CLASS="o"><TD CLASS="f"><A HREF="#2c">moveResources (IResource [], IPath): void</A></TD><TD> </TD><TD CLASS="h">0% (0/1)</TD><TD CLASS="h">0% (0/37)</TD><TD CLASS="h">0% (0/9)</TD></TR><TR><TD CLASS="f"><A HREF="#2d">newJavaElementDelta (): JavaElementDelta</A></TD><TD> </TD><TD CLASS="h">0% (0/1)</TD><TD CLASS="h">0% (0/6)</TD><TD CLASS="h">0% (0/1)</TD></TR><TR CLASS="o"><TD CLASS="f"><A HREF="#2e">popOperation (): JavaModelOperation</A></TD><TD> </TD><TD CLASS="h">0% (0/1)</TD><TD CLASS="h">0% (0/22)</TD><TD CLASS="h">0% (0/7)</TD></TR><TR><TD CLASS="f"><A HREF="#2f">postAction (JavaModelOperation$IPostAction, int): void</A></TD><TD> </TD><TD CLASS="h">0% (0/1)</TD><TD CLASS="h">0% (0/111)</TD><TD CLASS="h">0% (0/27)</TD></TR><TR CLASS="o"><TD CLASS="f"><A HREF="#30">prefixesOneOf (IPath, IPath []): boolean</A></TD><TD> </TD><TD CLASS="h">0% (0/1)</TD><TD CLASS="h">0% (0/20)</TD><TD CLASS="h">0% (0/4)</TD></TR><TR><TD CLASS="f"><A HREF="#31">pushOperation (JavaModelOperation): void</A></TD><TD> </TD><TD CLASS="h">0% (0/1)</TD><TD CLASS="h">0% (0/5)</TD><TD CLASS="h">0% (0/2)</TD></TR><TR CLASS="o"><TD CLASS="f"><A HREF="#32">removeAllPostAction (String): void</A></TD><TD> </TD><TD CLASS="h">0% (0/1)</TD><TD CLASS="h">0% (0/63)</TD><TD CLASS="h">0% (0/10)</TD></TR><TR><TD CLASS="f"><A HREF="#33">removeReconcileDelta (IJavaScriptUnit): void</A></TD><TD> </TD><TD CLASS="h">0% (0/1)</TD><TD CLASS="h">0% (0/7)</TD><TD CLASS="h">0% (0/2)</TD></TR><TR CLASS="o"><TD CLASS="f"><A HREF="#34">run (IProgressMonitor): void</A></TD><TD> </TD><TD CLASS="h">0% (0/1)</TD><TD CLASS="h">0% (0/138)</TD><TD CLASS="h">0% (0/33)</TD></TR><TR><TD CLASS="f"><A HREF="#35">runOperation (IProgressMonitor): void</A></TD><TD> </TD><TD CLASS="h">0% (0/1)</TD><TD CLASS="h">0% (0/54)</TD><TD CLASS="h">0% (0/15)</TD></TR><TR CLASS="o"><TD CLASS="f"><A HREF="#36">runPostActions (): void</A></TD><TD> </TD><TD CLASS="h">0% (0/1)</TD><TD CLASS="h">0% (0/36)</TD><TD CLASS="h">0% (0/6)</TD></TR><TR><TD CLASS="f"><A HREF="#37">setAttribute (Object, Object): void</A></TD><TD> </TD><TD CLASS="h">0% (0/1)</TD><TD CLASS="h">0% (0/26)</TD><TD CLASS="h">0% (0/8)</TD></TR><TR CLASS="o"><TD CLASS="f"><A HREF="#38">setCanceled (boolean): void</A></TD><TD> </TD><TD CLASS="h">0% (0/1)</TD><TD CLASS="h">0% (0/8)</TD><TD CLASS="h">0% (0/3)</TD></TR><TR><TD CLASS="f"><A HREF="#39">setNested (boolean): void</A></TD><TD> </TD><TD CLASS="h">0% (0/1)</TD><TD CLASS="h">0% (0/4)</TD><TD CLASS="h">0% (0/2)</TD></TR><TR CLASS="o"><TD CLASS="f"><A HREF="#3a">setTaskName (String): void</A></TD><TD> </TD><TD CLASS="h">0% (0/1)</TD><TD CLASS="h">0% (0/8)</TD><TD CLASS="h">0% (0/3)</TD></TR><TR><TD CLASS="f"><A HREF="#3b">subTask (String): void</A></TD><TD> </TD><TD CLASS="h">0% (0/1)</TD><TD CLASS="h">0% (0/8)</TD><TD CLASS="h">0% (0/3)</TD></TR><TR CLASS="o"><TD CLASS="f"><A HREF="#3c">verify (): IJavaScriptModelStatus</A></TD><TD> </TD><TD CLASS="h">0% (0/1)</TD><TD CLASS="h">0% (0/3)</TD><TD CLASS="h">0% (0/1)</TD></TR><TR><TD CLASS="f"><A HREF="#3d">worked (int): void</A></TD><TD> </TD><TD CLASS="h">0% (0/1)</TD><TD CLASS="h">0% (0/10)</TD><TD CLASS="h">0% (0/4)</TD></TR></TABLE><P></P><TABLE CLASS="s" CELLSPACING="0" WIDTH="100%"><TR><TD CLASS="l">1</TD><TD>/*******************************************************************************</TD></TR><TR><TD CLASS="l">2</TD><TD> * Copyright (c) 2000, 2008 IBM Corporation and others.</TD></TR><TR><TD CLASS="l">3</TD><TD> * All rights reserved. This program and the accompanying materials</TD></TR><TR><TD CLASS="l">4</TD><TD> * are made available under the terms of the Eclipse Public License v1.0</TD></TR><TR><TD CLASS="l">5</TD><TD> * which accompanies this distribution, and is available at</TD></TR><TR><TD CLASS="l">6</TD><TD> * http://www.eclipse.org/legal/epl-v10.html</TD></TR><TR><TD CLASS="l">7</TD><TD> *</TD></TR><TR><TD CLASS="l">8</TD><TD> * Contributors:</TD></TR><TR><TD CLASS="l">9</TD><TD> * IBM Corporation - initial API and implementation</TD></TR><TR><TD CLASS="l">10</TD><TD> *******************************************************************************/</TD></TR><TR><TD CLASS="l">11</TD><TD>package org.eclipse.wst.jsdt.internal.core;</TD></TR><TR><TD CLASS="l">12</TD><TD> </TD></TR><TR><TD CLASS="l">13</TD><TD>import java.io.InputStream;</TD></TR><TR><TD CLASS="l">14</TD><TD>import java.util.ArrayList;</TD></TR><TR><TD CLASS="l">15</TD><TD>import java.util.HashMap;</TD></TR><TR><TD CLASS="l">16</TD><TD> </TD></TR><TR><TD CLASS="l">17</TD><TD>import org.eclipse.core.resources.IContainer;</TD></TR><TR><TD CLASS="l">18</TD><TD>import org.eclipse.core.resources.IFile;</TD></TR><TR><TD CLASS="l">19</TD><TD>import org.eclipse.core.resources.IFolder;</TD></TR><TR><TD CLASS="l">20</TD><TD>import org.eclipse.core.resources.IResource;</TD></TR><TR><TD CLASS="l">21</TD><TD>import org.eclipse.core.resources.IResourceStatus;</TD></TR><TR><TD CLASS="l">22</TD><TD>import org.eclipse.core.resources.IWorkspace;</TD></TR><TR><TD CLASS="l">23</TD><TD>import org.eclipse.core.resources.IWorkspaceRunnable;</TD></TR><TR><TD CLASS="l">24</TD><TD>import org.eclipse.core.resources.ResourcesPlugin;</TD></TR><TR><TD CLASS="l">25</TD><TD>import org.eclipse.core.runtime.CoreException;</TD></TR><TR><TD CLASS="l">26</TD><TD>import org.eclipse.core.runtime.IPath;</TD></TR><TR><TD CLASS="l">27</TD><TD>import org.eclipse.core.runtime.IProgressMonitor;</TD></TR><TR><TD CLASS="l">28</TD><TD>import org.eclipse.core.runtime.OperationCanceledException;</TD></TR><TR><TD CLASS="l">29</TD><TD>import org.eclipse.core.runtime.Path;</TD></TR><TR><TD CLASS="l">30</TD><TD>import org.eclipse.core.runtime.SubProgressMonitor;</TD></TR><TR><TD CLASS="l">31</TD><TD>import org.eclipse.core.runtime.jobs.ISchedulingRule;</TD></TR><TR><TD CLASS="l">32</TD><TD>import org.eclipse.jface.text.IDocument;</TD></TR><TR><TD CLASS="l">33</TD><TD>import org.eclipse.wst.jsdt.core.IBuffer;</TD></TR><TR><TD CLASS="l">34</TD><TD>import org.eclipse.wst.jsdt.core.IIncludePathEntry;</TD></TR><TR><TD CLASS="l">35</TD><TD>import org.eclipse.wst.jsdt.core.IJavaScriptUnit;</TD></TR><TR><TD CLASS="l">36</TD><TD>import org.eclipse.wst.jsdt.core.IJavaScriptElement;</TD></TR><TR><TD CLASS="l">37</TD><TD>import org.eclipse.wst.jsdt.core.IJavaScriptElementDelta;</TD></TR><TR><TD CLASS="l">38</TD><TD>import org.eclipse.wst.jsdt.core.IJavaScriptModel;</TD></TR><TR><TD CLASS="l">39</TD><TD>import org.eclipse.wst.jsdt.core.IJavaScriptModelStatus;</TD></TR><TR><TD CLASS="l">40</TD><TD>import org.eclipse.wst.jsdt.core.IJavaScriptModelStatusConstants;</TD></TR><TR><TD CLASS="l">41</TD><TD>import org.eclipse.wst.jsdt.core.IPackageFragment;</TD></TR><TR><TD CLASS="l">42</TD><TD>import org.eclipse.wst.jsdt.core.IPackageFragmentRoot;</TD></TR><TR><TD CLASS="l">43</TD><TD>import org.eclipse.wst.jsdt.core.JavaScriptModelException;</TD></TR><TR><TD CLASS="l">44</TD><TD>import org.eclipse.wst.jsdt.internal.core.util.Messages;</TD></TR><TR><TD CLASS="l">45</TD><TD> </TD></TR><TR><TD CLASS="l">46</TD><TD>/**</TD></TR><TR><TD CLASS="l">47</TD><TD> * Defines behavior common to all Java Model operations</TD></TR><TR><TD CLASS="l">48</TD><TD> */</TD></TR><TR CLASS="z"><TD CLASS="l">49</TD><TD>public abstract class JavaModelOperation implements IWorkspaceRunnable, IProgressMonitor {</TD></TR><TR><TD CLASS="l">50</TD><TD> protected interface IPostAction {</TD></TR><TR><TD CLASS="l">51</TD><TD> /*</TD></TR><TR><TD CLASS="l">52</TD><TD> * Returns the id of this action.</TD></TR><TR><TD CLASS="l">53</TD><TD> * @see JavaModelOperation#postAction</TD></TR><TR><TD CLASS="l">54</TD><TD> */</TD></TR><TR><TD CLASS="l">55</TD><TD> String getID();</TD></TR><TR><TD CLASS="l">56</TD><TD> /*</TD></TR><TR><TD CLASS="l">57</TD><TD> * Run this action.</TD></TR><TR><TD CLASS="l">58</TD><TD> */</TD></TR><TR><TD CLASS="l">59</TD><TD> void run() throws JavaScriptModelException;</TD></TR><TR><TD CLASS="l">60</TD><TD> }</TD></TR><TR><TD CLASS="l">61</TD><TD> /*</TD></TR><TR><TD CLASS="l">62</TD><TD> * Constants controlling the insertion mode of an action.</TD></TR><TR><TD CLASS="l">63</TD><TD> * @see JavaModelOperation#postAction</TD></TR><TR><TD CLASS="l">64</TD><TD> */</TD></TR><TR><TD CLASS="l">65</TD><TD> protected static final int APPEND = 1; // insert at the end</TD></TR><TR><TD CLASS="l">66</TD><TD> protected static final int REMOVEALL_APPEND = 2; // remove all existing ones with same ID, and add new one at the end</TD></TR><TR><TD CLASS="l">67</TD><TD> protected static final int KEEP_EXISTING = 3; // do not insert if already existing with same ID</TD></TR><TR><TD CLASS="l">68</TD><TD> </TD></TR><TR><TD CLASS="l">69</TD><TD> /*</TD></TR><TR><TD CLASS="l">70</TD><TD> * Whether tracing post actions is enabled.</TD></TR><TR><TD CLASS="l">71</TD><TD> */</TD></TR><TR><TD CLASS="l">72</TD><TD> protected static boolean POST_ACTION_VERBOSE;</TD></TR><TR><TD CLASS="l">73</TD><TD> </TD></TR><TR><TD CLASS="l">74</TD><TD> /*</TD></TR><TR><TD CLASS="l">75</TD><TD> * A list of IPostActions.</TD></TR><TR><TD CLASS="l">76</TD><TD> */</TD></TR><TR><TD CLASS="l">77</TD><TD> protected IPostAction[] actions;</TD></TR><TR CLASS="z"><TD CLASS="l">78</TD><TD> protected int actionsStart = 0;</TD></TR><TR CLASS="z"><TD CLASS="l">79</TD><TD> protected int actionsEnd = -1;</TD></TR><TR><TD CLASS="l">80</TD><TD> /*</TD></TR><TR><TD CLASS="l">81</TD><TD> * A HashMap of attributes that can be used by operations</TD></TR><TR><TD CLASS="l">82</TD><TD> */</TD></TR><TR><TD CLASS="l">83</TD><TD> protected HashMap attributes;</TD></TR><TR><TD CLASS="l">84</TD><TD> </TD></TR><TR><TD CLASS="l">85</TD><TD> public static final String HAS_MODIFIED_RESOURCE_ATTR = "hasModifiedResource"; //$NON-NLS-1$</TD></TR><TR><TD CLASS="l">86</TD><TD> public static final String TRUE = JavaModelManager.TRUE;</TD></TR><TR><TD CLASS="l">87</TD><TD> //public static final String FALSE = "false";</TD></TR><TR><TD CLASS="l">88</TD><TD> </TD></TR><TR><TD CLASS="l">89</TD><TD> /**</TD></TR><TR><TD CLASS="l">90</TD><TD> * The elements this operation operates on,</TD></TR><TR><TD CLASS="l">91</TD><TD> * or <code>null</code> if this operation</TD></TR><TR><TD CLASS="l">92</TD><TD> * does not operate on specific elements.</TD></TR><TR><TD CLASS="l">93</TD><TD> */</TD></TR><TR><TD CLASS="l">94</TD><TD> protected IJavaScriptElement[] elementsToProcess;</TD></TR><TR><TD CLASS="l">95</TD><TD> /**</TD></TR><TR><TD CLASS="l">96</TD><TD> * The parent elements this operation operates with</TD></TR><TR><TD CLASS="l">97</TD><TD> * or <code>null</code> if this operation</TD></TR><TR><TD CLASS="l">98</TD><TD> * does not operate with specific parent elements.</TD></TR><TR><TD CLASS="l">99</TD><TD> */</TD></TR><TR><TD CLASS="l">100</TD><TD> protected IJavaScriptElement[] parentElements;</TD></TR><TR><TD CLASS="l">101</TD><TD> /**</TD></TR><TR><TD CLASS="l"><A NAME="0">102</A></TD><TD> * An empty collection of <code>IJavaScriptElement</code>s - the common</TD></TR><TR><TD CLASS="l">103</TD><TD> * empty result if no elements are created, or if this</TD></TR><TR><TD CLASS="l">104</TD><TD> * operation is not actually executed.</TD></TR><TR><TD CLASS="l">105</TD><TD> */</TD></TR><TR CLASS="z"><TD CLASS="l">106</TD><TD> protected static IJavaScriptElement[] NO_ELEMENTS= new IJavaScriptElement[] {};</TD></TR><TR><TD CLASS="l">107</TD><TD> </TD></TR><TR><TD CLASS="l">108</TD><TD> </TD></TR><TR><TD CLASS="l">109</TD><TD> /**</TD></TR><TR><TD CLASS="l">110</TD><TD> * The elements created by this operation - empty</TD></TR><TR><TD CLASS="l">111</TD><TD> * until the operation actually creates elements.</TD></TR><TR><TD CLASS="l">112</TD><TD> */</TD></TR><TR CLASS="z"><TD CLASS="l">113</TD><TD> protected IJavaScriptElement[] resultElements= NO_ELEMENTS;</TD></TR><TR><TD CLASS="l">114</TD><TD> </TD></TR><TR><TD CLASS="l">115</TD><TD> /**</TD></TR><TR><TD CLASS="l">116</TD><TD> * The progress monitor passed into this operation</TD></TR><TR><TD CLASS="l">117</TD><TD> */</TD></TR><TR CLASS="z"><TD CLASS="l">118</TD><TD> public IProgressMonitor progressMonitor= null;</TD></TR><TR><TD CLASS="l">119</TD><TD> /**</TD></TR><TR><TD CLASS="l">120</TD><TD> * A flag indicating whether this operation is nested.</TD></TR><TR><TD CLASS="l">121</TD><TD> */</TD></TR><TR CLASS="z"><TD CLASS="l">122</TD><TD> protected boolean isNested = false;</TD></TR><TR><TD CLASS="l">123</TD><TD> /**</TD></TR><TR><TD CLASS="l">124</TD><TD> * Conflict resolution policy - by default do not force (fail on a conflict).</TD></TR><TR><TD CLASS="l">125</TD><TD> */</TD></TR><TR CLASS="z"><TD CLASS="l">126</TD><TD> protected boolean force = false;</TD></TR><TR><TD CLASS="l">127</TD><TD> </TD></TR><TR><TD CLASS="l"><A NAME="2">128</A></TD><TD> /*</TD></TR><TR><TD CLASS="l">129</TD><TD> * A per thread stack of java model operations (PerThreadObject of ArrayList).</TD></TR><TR><TD CLASS="l">130</TD><TD> */</TD></TR><TR CLASS="z"><TD CLASS="l">131</TD><TD> protected static ThreadLocal operationStacks = new ThreadLocal();</TD></TR><TR CLASS="z"><TD CLASS="l">132</TD><TD> protected JavaModelOperation() {</TD></TR><TR><TD CLASS="l">133</TD><TD> // default constructor used in subclasses</TD></TR><TR CLASS="z"><TD CLASS="l"><A NAME="3">134</A></TD><TD> }</TD></TR><TR><TD CLASS="l">135</TD><TD> /**</TD></TR><TR><TD CLASS="l">136</TD><TD> * A common constructor for all Java Model operations.</TD></TR><TR><TD CLASS="l">137</TD><TD> */</TD></TR><TR CLASS="z"><TD CLASS="l">138</TD><TD> protected JavaModelOperation(IJavaScriptElement[] elements) {</TD></TR><TR CLASS="z"><TD CLASS="l">139</TD><TD> this.elementsToProcess = elements;</TD></TR><TR CLASS="z"><TD CLASS="l"><A NAME="4">140</A></TD><TD> }</TD></TR><TR><TD CLASS="l">141</TD><TD> /**</TD></TR><TR><TD CLASS="l">142</TD><TD> * Common constructor for all Java Model operations.</TD></TR><TR><TD CLASS="l">143</TD><TD> */</TD></TR><TR CLASS="z"><TD CLASS="l">144</TD><TD> protected JavaModelOperation(IJavaScriptElement[] elementsToProcess, IJavaScriptElement[] parentElements) {</TD></TR><TR CLASS="z"><TD CLASS="l">145</TD><TD> this.elementsToProcess = elementsToProcess;</TD></TR><TR CLASS="z"><TD CLASS="l">146</TD><TD> this.parentElements= parentElements;</TD></TR><TR CLASS="z"><TD CLASS="l"><A NAME="5">147</A></TD><TD> }</TD></TR><TR><TD CLASS="l">148</TD><TD> /**</TD></TR><TR><TD CLASS="l">149</TD><TD> * A common constructor for all Java Model operations.</TD></TR><TR><TD CLASS="l">150</TD><TD> */</TD></TR><TR CLASS="z"><TD CLASS="l">151</TD><TD> protected JavaModelOperation(IJavaScriptElement[] elementsToProcess, IJavaScriptElement[] parentElements, boolean force) {</TD></TR><TR CLASS="z"><TD CLASS="l">152</TD><TD> this.elementsToProcess = elementsToProcess;</TD></TR><TR CLASS="z"><TD CLASS="l">153</TD><TD> this.parentElements= parentElements;</TD></TR><TR CLASS="z"><TD CLASS="l">154</TD><TD> this.force= force;</TD></TR><TR CLASS="z"><TD CLASS="l"><A NAME="6">155</A></TD><TD> }</TD></TR><TR><TD CLASS="l">156</TD><TD> /**</TD></TR><TR><TD CLASS="l">157</TD><TD> * A common constructor for all Java Model operations.</TD></TR><TR><TD CLASS="l">158</TD><TD> */</TD></TR><TR CLASS="z"><TD CLASS="l">159</TD><TD> protected JavaModelOperation(IJavaScriptElement[] elements, boolean force) {</TD></TR><TR CLASS="z"><TD CLASS="l">160</TD><TD> this.elementsToProcess = elements;</TD></TR><TR CLASS="z"><TD CLASS="l">161</TD><TD> this.force= force;</TD></TR><TR CLASS="z"><TD CLASS="l">162</TD><TD> }</TD></TR><TR><TD CLASS="l"><A NAME="7">163</A></TD><TD> </TD></TR><TR><TD CLASS="l">164</TD><TD> /**</TD></TR><TR><TD CLASS="l">165</TD><TD> * Common constructor for all Java Model operations.</TD></TR><TR><TD CLASS="l">166</TD><TD> */</TD></TR><TR CLASS="z"><TD CLASS="l">167</TD><TD> protected JavaModelOperation(IJavaScriptElement element) {</TD></TR><TR CLASS="z"><TD CLASS="l">168</TD><TD> this.elementsToProcess = new IJavaScriptElement[]{element};</TD></TR><TR CLASS="z"><TD CLASS="l"><A NAME="8">169</A></TD><TD> }</TD></TR><TR><TD CLASS="l">170</TD><TD> /**</TD></TR><TR><TD CLASS="l">171</TD><TD> * A common constructor for all Java Model operations.</TD></TR><TR><TD CLASS="l">172</TD><TD> */</TD></TR><TR CLASS="z"><TD CLASS="l">173</TD><TD> protected JavaModelOperation(IJavaScriptElement element, boolean force) {</TD></TR><TR CLASS="z"><TD CLASS="l">174</TD><TD> this.elementsToProcess = new IJavaScriptElement[]{element};</TD></TR><TR CLASS="z"><TD CLASS="l">175</TD><TD> this.force= force;</TD></TR><TR CLASS="z"><TD CLASS="l">176</TD><TD> }</TD></TR><TR><TD CLASS="l">177</TD><TD> </TD></TR><TR><TD CLASS="l"><A NAME="9">178</A></TD><TD> /*</TD></TR><TR><TD CLASS="l">179</TD><TD> * Registers the given action at the end of the list of actions to run.</TD></TR><TR><TD CLASS="l">180</TD><TD> */</TD></TR><TR><TD CLASS="l">181</TD><TD> protected void addAction(IPostAction action) {</TD></TR><TR CLASS="z"><TD CLASS="l">182</TD><TD> int length = this.actions.length;</TD></TR><TR CLASS="z"><TD CLASS="l">183</TD><TD> if (length == ++this.actionsEnd) {</TD></TR><TR CLASS="z"><TD CLASS="l">184</TD><TD> System.arraycopy(this.actions, 0, this.actions = new IPostAction[length*2], 0, length);</TD></TR><TR><TD CLASS="l">185</TD><TD> }</TD></TR><TR CLASS="z"><TD CLASS="l">186</TD><TD> this.actions[this.actionsEnd] = action;</TD></TR><TR CLASS="z"><TD CLASS="l">187</TD><TD> }</TD></TR><TR><TD CLASS="l"><A NAME="a">188</A></TD><TD> /*</TD></TR><TR><TD CLASS="l">189</TD><TD> * Registers the given delta with the Java Model Manager.</TD></TR><TR><TD CLASS="l">190</TD><TD> */</TD></TR><TR><TD CLASS="l">191</TD><TD> protected void addDelta(IJavaScriptElementDelta delta) {</TD></TR><TR CLASS="z"><TD CLASS="l">192</TD><TD> JavaModelManager.getJavaModelManager().getDeltaProcessor().registerJavaModelDelta(delta);</TD></TR><TR CLASS="z"><TD CLASS="l">193</TD><TD> }</TD></TR><TR><TD CLASS="l"><A NAME="b">194</A></TD><TD> /*</TD></TR><TR><TD CLASS="l">195</TD><TD> * Registers the given reconcile delta with the Java Model Manager.</TD></TR><TR><TD CLASS="l">196</TD><TD> */</TD></TR><TR><TD CLASS="l">197</TD><TD> protected void addReconcileDelta(IJavaScriptUnit workingCopy, IJavaScriptElementDelta delta) {</TD></TR><TR CLASS="z"><TD CLASS="l">198</TD><TD> HashMap reconcileDeltas = JavaModelManager.getJavaModelManager().getDeltaProcessor().reconcileDeltas;</TD></TR><TR CLASS="z"><TD CLASS="l">199</TD><TD> JavaElementDelta previousDelta = (JavaElementDelta)reconcileDeltas.get(workingCopy);</TD></TR><TR CLASS="z"><TD CLASS="l">200</TD><TD> if (previousDelta != null) {</TD></TR><TR CLASS="z"><TD CLASS="l">201</TD><TD> IJavaScriptElementDelta[] children = delta.getAffectedChildren();</TD></TR><TR CLASS="z"><TD CLASS="l">202</TD><TD> for (int i = 0, length = children.length; i < length; i++) {</TD></TR><TR CLASS="z"><TD CLASS="l">203</TD><TD> JavaElementDelta child = (JavaElementDelta)children[i];</TD></TR><TR CLASS="z"><TD CLASS="l">204</TD><TD> previousDelta.insertDeltaTree(child.getElement(), child);</TD></TR><TR><TD CLASS="l">205</TD><TD> }</TD></TR><TR><TD CLASS="l">206</TD><TD> // note that the last delta's AST always takes precedence over the existing delta's AST</TD></TR><TR><TD CLASS="l">207</TD><TD> // since it is the result of the last reconcile operation</TD></TR><TR CLASS="z"><TD CLASS="l">208</TD><TD> if ((delta.getFlags() & IJavaScriptElementDelta.F_AST_AFFECTED) != 0) {</TD></TR><TR CLASS="z"><TD CLASS="l">209</TD><TD> previousDelta.changedAST(delta.getJavaScriptUnitAST());</TD></TR><TR><TD CLASS="l">210</TD><TD> }</TD></TR><TR><TD CLASS="l">211</TD><TD> </TD></TR><TR><TD CLASS="l">212</TD><TD> } else {</TD></TR><TR CLASS="z"><TD CLASS="l">213</TD><TD> reconcileDeltas.put(workingCopy, delta);</TD></TR><TR><TD CLASS="l">214</TD><TD> }</TD></TR><TR CLASS="z"><TD CLASS="l">215</TD><TD> }</TD></TR><TR><TD CLASS="l"><A NAME="33">216</A></TD><TD> /*</TD></TR><TR><TD CLASS="l">217</TD><TD> * Deregister the reconcile delta for the given working copy</TD></TR><TR><TD CLASS="l">218</TD><TD> */</TD></TR><TR><TD CLASS="l">219</TD><TD> protected void removeReconcileDelta(IJavaScriptUnit workingCopy) {</TD></TR><TR CLASS="z"><TD CLASS="l">220</TD><TD> JavaModelManager.getJavaModelManager().getDeltaProcessor().reconcileDeltas.remove(workingCopy);</TD></TR><TR CLASS="z"><TD CLASS="l">221</TD><TD> }</TD></TR><TR><TD CLASS="l"><A NAME="c">222</A></TD><TD> /**</TD></TR><TR><TD CLASS="l">223</TD><TD> * @see IProgressMonitor</TD></TR><TR><TD CLASS="l">224</TD><TD> */</TD></TR><TR><TD CLASS="l">225</TD><TD> public void beginTask(String name, int totalWork) {</TD></TR><TR CLASS="z"><TD CLASS="l">226</TD><TD> if (progressMonitor != null) {</TD></TR><TR CLASS="z"><TD CLASS="l">227</TD><TD> progressMonitor.beginTask(name, totalWork);</TD></TR><TR><TD CLASS="l">228</TD><TD> }</TD></TR><TR CLASS="z"><TD CLASS="l">229</TD><TD> }</TD></TR><TR><TD CLASS="l"><A NAME="d">230</A></TD><TD> /*</TD></TR><TR><TD CLASS="l">231</TD><TD> * Returns whether this operation can modify the package fragment roots.</TD></TR><TR><TD CLASS="l">232</TD><TD> */</TD></TR><TR><TD CLASS="l">233</TD><TD> protected boolean canModifyRoots() {</TD></TR><TR CLASS="z"><TD CLASS="l">234</TD><TD> return false;</TD></TR><TR><TD CLASS="l">235</TD><TD> }</TD></TR><TR><TD CLASS="l">236</TD><TD> /**</TD></TR><TR><TD CLASS="l">237</TD><TD> * Checks with the progress monitor to see whether this operation</TD></TR><TR><TD CLASS="l">238</TD><TD> * should be canceled. An operation should regularly call this method</TD></TR><TR><TD CLASS="l">239</TD><TD> * during its operation so that the user can cancel it.</TD></TR><TR><TD CLASS="l">240</TD><TD> *</TD></TR><TR><TD CLASS="l"><A NAME="e">241</A></TD><TD> * @exception OperationCanceledException if cancelling the operation has been requested</TD></TR><TR><TD CLASS="l">242</TD><TD> * @see IProgressMonitor#isCanceled</TD></TR><TR><TD CLASS="l">243</TD><TD> */</TD></TR><TR><TD CLASS="l">244</TD><TD> protected void checkCanceled() {</TD></TR><TR CLASS="z"><TD CLASS="l">245</TD><TD> if (isCanceled()) {</TD></TR><TR CLASS="z"><TD CLASS="l">246</TD><TD> throw new OperationCanceledException(Messages.operation_cancelled);</TD></TR><TR><TD CLASS="l">247</TD><TD> }</TD></TR><TR CLASS="z"><TD CLASS="l">248</TD><TD> }</TD></TR><TR><TD CLASS="l">249</TD><TD> /**</TD></TR><TR><TD CLASS="l"><A NAME="f">250</A></TD><TD> * Common code used to verify the elements this operation is processing.</TD></TR><TR><TD CLASS="l">251</TD><TD> * @see JavaModelOperation#verify()</TD></TR><TR><TD CLASS="l">252</TD><TD> */</TD></TR><TR><TD CLASS="l">253</TD><TD> protected IJavaScriptModelStatus commonVerify() {</TD></TR><TR CLASS="z"><TD CLASS="l">254</TD><TD> if (elementsToProcess == null || elementsToProcess.length == 0) {</TD></TR><TR CLASS="z"><TD CLASS="l">255</TD><TD> return new JavaModelStatus(IJavaScriptModelStatusConstants.NO_ELEMENTS_TO_PROCESS);</TD></TR><TR><TD CLASS="l">256</TD><TD> }</TD></TR><TR CLASS="z"><TD CLASS="l">257</TD><TD> for (int i = 0; i < elementsToProcess.length; i++) {</TD></TR><TR CLASS="z"><TD CLASS="l">258</TD><TD> if (elementsToProcess[i] == null) {</TD></TR><TR CLASS="z"><TD CLASS="l">259</TD><TD> return new JavaModelStatus(IJavaScriptModelStatusConstants.NO_ELEMENTS_TO_PROCESS);</TD></TR><TR><TD CLASS="l">260</TD><TD> }</TD></TR><TR><TD CLASS="l">261</TD><TD> }</TD></TR><TR CLASS="z"><TD CLASS="l">262</TD><TD> return JavaModelStatus.VERIFIED_OK;</TD></TR><TR><TD CLASS="l">263</TD><TD> }</TD></TR><TR><TD CLASS="l"><A NAME="10">264</A></TD><TD> /**</TD></TR><TR><TD CLASS="l">265</TD><TD> * Convenience method to copy resources</TD></TR><TR><TD CLASS="l">266</TD><TD> */</TD></TR><TR><TD CLASS="l">267</TD><TD> protected void copyResources(IResource[] resources, IPath destinationPath) throws JavaScriptModelException {</TD></TR><TR CLASS="z"><TD CLASS="l">268</TD><TD> IProgressMonitor subProgressMonitor = getSubProgressMonitor(resources.length);</TD></TR><TR CLASS="z"><TD CLASS="l">269</TD><TD> IWorkspace workspace = resources[0].getWorkspace();</TD></TR><TR><TD CLASS="l">270</TD><TD> try {</TD></TR><TR CLASS="z"><TD CLASS="l">271</TD><TD> workspace.copy(resources, destinationPath, false, subProgressMonitor);</TD></TR><TR CLASS="z"><TD CLASS="l">272</TD><TD> setAttribute(HAS_MODIFIED_RESOURCE_ATTR, TRUE);</TD></TR><TR CLASS="z"><TD CLASS="l">273</TD><TD> } catch (CoreException e) {</TD></TR><TR CLASS="z"><TD CLASS="l">274</TD><TD> throw new JavaScriptModelException(e);</TD></TR><TR><TD CLASS="l">275</TD><TD> }</TD></TR><TR CLASS="z"><TD CLASS="l">276</TD><TD> }</TD></TR><TR><TD CLASS="l"><A NAME="11">277</A></TD><TD> /**</TD></TR><TR><TD CLASS="l">278</TD><TD> * Convenience method to create a file</TD></TR><TR><TD CLASS="l">279</TD><TD> */</TD></TR><TR><TD CLASS="l">280</TD><TD> protected void createFile(IContainer folder, String name, InputStream contents, boolean forceFlag) throws JavaScriptModelException {</TD></TR><TR CLASS="z"><TD CLASS="l">281</TD><TD> IFile file= folder.getFile(new Path(name));</TD></TR><TR><TD CLASS="l">282</TD><TD> try {</TD></TR><TR CLASS="z"><TD CLASS="l">283</TD><TD> file.create(</TD></TR><TR CLASS="z"><TD CLASS="l">284</TD><TD> contents,</TD></TR><TR CLASS="z"><TD CLASS="l">285</TD><TD> forceFlag ? IResource.FORCE | IResource.KEEP_HISTORY : IResource.KEEP_HISTORY,</TD></TR><TR CLASS="z"><TD CLASS="l">286</TD><TD> getSubProgressMonitor(1));</TD></TR><TR CLASS="z"><TD CLASS="l">287</TD><TD> setAttribute(HAS_MODIFIED_RESOURCE_ATTR, TRUE);</TD></TR><TR CLASS="z"><TD CLASS="l">288</TD><TD> } catch (CoreException e) {</TD></TR><TR CLASS="z"><TD CLASS="l">289</TD><TD> throw new JavaScriptModelException(e);</TD></TR><TR><TD CLASS="l">290</TD><TD> }</TD></TR><TR CLASS="z"><TD CLASS="l">291</TD><TD> }</TD></TR><TR><TD CLASS="l"><A NAME="12">292</A></TD><TD> /**</TD></TR><TR><TD CLASS="l">293</TD><TD> * Convenience method to create a folder</TD></TR><TR><TD CLASS="l">294</TD><TD> */</TD></TR><TR><TD CLASS="l">295</TD><TD> protected void createFolder(IContainer parentFolder, String name, boolean forceFlag) throws JavaScriptModelException {</TD></TR><TR CLASS="z"><TD CLASS="l">296</TD><TD> IFolder folder= parentFolder.getFolder(new Path(name));</TD></TR><TR><TD CLASS="l">297</TD><TD> try {</TD></TR><TR><TD CLASS="l">298</TD><TD> // we should use true to create the file locally. Only VCM should use tru/false</TD></TR><TR CLASS="z"><TD CLASS="l">299</TD><TD> folder.create(</TD></TR><TR CLASS="z"><TD CLASS="l">300</TD><TD> forceFlag ? IResource.FORCE | IResource.KEEP_HISTORY : IResource.KEEP_HISTORY,</TD></TR><TR CLASS="z"><TD CLASS="l">301</TD><TD> true, // local</TD></TR><TR CLASS="z"><TD CLASS="l">302</TD><TD> getSubProgressMonitor(1));</TD></TR><TR CLASS="z"><TD CLASS="l">303</TD><TD> setAttribute(HAS_MODIFIED_RESOURCE_ATTR, TRUE);</TD></TR><TR CLASS="z"><TD CLASS="l">304</TD><TD> } catch (CoreException e) {</TD></TR><TR CLASS="z"><TD CLASS="l">305</TD><TD> throw new JavaScriptModelException(e);</TD></TR><TR><TD CLASS="l">306</TD><TD> }</TD></TR><TR CLASS="z"><TD CLASS="l">307</TD><TD> }</TD></TR><TR><TD CLASS="l">308</TD><TD> /**</TD></TR><TR><TD CLASS="l">309</TD><TD> * Convenience method to delete an empty package fragment</TD></TR><TR><TD CLASS="l">310</TD><TD> */</TD></TR><TR><TD CLASS="l">311</TD><TD> protected void deleteEmptyPackageFragment(</TD></TR><TR><TD CLASS="l">312</TD><TD> IPackageFragment fragment,</TD></TR><TR><TD CLASS="l"><A NAME="13">313</A></TD><TD> boolean forceFlag,</TD></TR><TR><TD CLASS="l">314</TD><TD> IResource rootResource)</TD></TR><TR><TD CLASS="l">315</TD><TD> throws JavaScriptModelException {</TD></TR><TR><TD CLASS="l">316</TD><TD> </TD></TR><TR CLASS="z"><TD CLASS="l">317</TD><TD> IContainer resource = (IContainer) fragment.getResource();</TD></TR><TR><TD CLASS="l">318</TD><TD> </TD></TR><TR><TD CLASS="l">319</TD><TD> try {</TD></TR><TR CLASS="z"><TD CLASS="l">320</TD><TD> resource.delete(</TD></TR><TR CLASS="z"><TD CLASS="l">321</TD><TD> forceFlag ? IResource.FORCE | IResource.KEEP_HISTORY : IResource.KEEP_HISTORY,</TD></TR><TR CLASS="z"><TD CLASS="l">322</TD><TD> getSubProgressMonitor(1));</TD></TR><TR CLASS="z"><TD CLASS="l">323</TD><TD> setAttribute(HAS_MODIFIED_RESOURCE_ATTR, TRUE);</TD></TR><TR CLASS="z"><TD CLASS="l">324</TD><TD> while (resource instanceof IFolder) {</TD></TR><TR><TD CLASS="l">325</TD><TD> // deleting a package: delete the parent if it is empty (eg. deleting x.y where folder x doesn't have resources but y)</TD></TR><TR><TD CLASS="l">326</TD><TD> // without deleting the package fragment root</TD></TR><TR CLASS="z"><TD CLASS="l">327</TD><TD> resource = resource.getParent();</TD></TR><TR CLASS="z"><TD CLASS="l">328</TD><TD> if (!resource.equals(rootResource) && resource.members().length == 0) {</TD></TR><TR CLASS="z"><TD CLASS="l">329</TD><TD> resource.delete(</TD></TR><TR CLASS="z"><TD CLASS="l">330</TD><TD> forceFlag ? IResource.FORCE | IResource.KEEP_HISTORY : IResource.KEEP_HISTORY,</TD></TR><TR CLASS="z"><TD CLASS="l">331</TD><TD> getSubProgressMonitor(1));</TD></TR><TR CLASS="z"><TD CLASS="l">332</TD><TD> setAttribute(HAS_MODIFIED_RESOURCE_ATTR, TRUE);</TD></TR><TR><TD CLASS="l">333</TD><TD> }</TD></TR><TR><TD CLASS="l">334</TD><TD> }</TD></TR><TR CLASS="z"><TD CLASS="l">335</TD><TD> } catch (CoreException e) {</TD></TR><TR CLASS="z"><TD CLASS="l">336</TD><TD> throw new JavaScriptModelException(e);</TD></TR><TR><TD CLASS="l">337</TD><TD> }</TD></TR><TR CLASS="z"><TD CLASS="l">338</TD><TD> }</TD></TR><TR><TD CLASS="l">339</TD><TD> /**</TD></TR><TR><TD CLASS="l"><A NAME="14">340</A></TD><TD> * Convenience method to delete a resource</TD></TR><TR><TD CLASS="l">341</TD><TD> */</TD></TR><TR><TD CLASS="l">342</TD><TD> protected void deleteResource(IResource resource,int flags) throws JavaScriptModelException {</TD></TR><TR><TD CLASS="l">343</TD><TD> try {</TD></TR><TR CLASS="z"><TD CLASS="l">344</TD><TD> resource.delete(flags, getSubProgressMonitor(1));</TD></TR><TR CLASS="z"><TD CLASS="l">345</TD><TD> setAttribute(HAS_MODIFIED_RESOURCE_ATTR, TRUE);</TD></TR><TR CLASS="z"><TD CLASS="l">346</TD><TD> } catch (CoreException e) {</TD></TR><TR CLASS="z"><TD CLASS="l">347</TD><TD> throw new JavaScriptModelException(e);</TD></TR><TR><TD CLASS="l">348</TD><TD> }</TD></TR><TR CLASS="z"><TD CLASS="l">349</TD><TD> }</TD></TR><TR><TD CLASS="l"><A NAME="15">350</A></TD><TD> /**</TD></TR><TR><TD CLASS="l">351</TD><TD> * Convenience method to delete resources</TD></TR><TR><TD CLASS="l">352</TD><TD> */</TD></TR><TR><TD CLASS="l">353</TD><TD> protected void deleteResources(IResource[] resources, boolean forceFlag) throws JavaScriptModelException {</TD></TR><TR CLASS="z"><TD CLASS="l">354</TD><TD> if (resources == null || resources.length == 0) return;</TD></TR><TR CLASS="z"><TD CLASS="l">355</TD><TD> IProgressMonitor subProgressMonitor = getSubProgressMonitor(resources.length);</TD></TR><TR CLASS="z"><TD CLASS="l">356</TD><TD> IWorkspace workspace = resources[0].getWorkspace();</TD></TR><TR><TD CLASS="l">357</TD><TD> try {</TD></TR><TR CLASS="z"><TD CLASS="l">358</TD><TD> workspace.delete(</TD></TR><TR CLASS="z"><TD CLASS="l">359</TD><TD> resources,</TD></TR><TR CLASS="z"><TD CLASS="l">360</TD><TD> forceFlag ? IResource.FORCE | IResource.KEEP_HISTORY : IResource.KEEP_HISTORY,</TD></TR><TR CLASS="z"><TD CLASS="l">361</TD><TD> subProgressMonitor);</TD></TR><TR CLASS="z"><TD CLASS="l">362</TD><TD> setAttribute(HAS_MODIFIED_RESOURCE_ATTR, TRUE);</TD></TR><TR CLASS="z"><TD CLASS="l">363</TD><TD> } catch (CoreException e) {</TD></TR><TR CLASS="z"><TD CLASS="l">364</TD><TD> throw new JavaScriptModelException(e);</TD></TR><TR><TD CLASS="l">365</TD><TD> }</TD></TR><TR CLASS="z"><TD CLASS="l">366</TD><TD> }</TD></TR><TR><TD CLASS="l"><A NAME="16">367</A></TD><TD> /**</TD></TR><TR><TD CLASS="l">368</TD><TD> * @see IProgressMonitor</TD></TR><TR><TD CLASS="l">369</TD><TD> */</TD></TR><TR><TD CLASS="l">370</TD><TD> public void done() {</TD></TR><TR CLASS="z"><TD CLASS="l">371</TD><TD> if (progressMonitor != null) {</TD></TR><TR CLASS="z"><TD CLASS="l">372</TD><TD> progressMonitor.done();</TD></TR><TR><TD CLASS="l">373</TD><TD> }</TD></TR><TR CLASS="z"><TD CLASS="l">374</TD><TD> }</TD></TR><TR><TD CLASS="l"><A NAME="17">375</A></TD><TD> /*</TD></TR><TR><TD CLASS="l">376</TD><TD> * Returns whether the given path is equals to one of the given other paths.</TD></TR><TR><TD CLASS="l">377</TD><TD> */</TD></TR><TR><TD CLASS="l">378</TD><TD> protected boolean equalsOneOf(IPath path, IPath[] otherPaths) {</TD></TR><TR CLASS="z"><TD CLASS="l">379</TD><TD> for (int i = 0, length = otherPaths.length; i < length; i++) {</TD></TR><TR CLASS="z"><TD CLASS="l">380</TD><TD> if (path.equals(otherPaths[i])) {</TD></TR><TR CLASS="z"><TD CLASS="l">381</TD><TD> return true;</TD></TR><TR><TD CLASS="l">382</TD><TD> }</TD></TR><TR><TD CLASS="l">383</TD><TD> }</TD></TR><TR CLASS="z"><TD CLASS="l">384</TD><TD> return false;</TD></TR><TR><TD CLASS="l">385</TD><TD> }</TD></TR><TR><TD CLASS="l"><A NAME="18">386</A></TD><TD> /**</TD></TR><TR><TD CLASS="l">387</TD><TD> * Convenience method to run an operation within this operation</TD></TR><TR><TD CLASS="l">388</TD><TD> */</TD></TR><TR><TD CLASS="l">389</TD><TD> public void executeNestedOperation(JavaModelOperation operation, int subWorkAmount) throws JavaScriptModelException {</TD></TR><TR CLASS="z"><TD CLASS="l">390</TD><TD> IJavaScriptModelStatus status= operation.verify();</TD></TR><TR CLASS="z"><TD CLASS="l">391</TD><TD> if (!status.isOK()) {</TD></TR><TR CLASS="z"><TD CLASS="l">392</TD><TD> throw new JavaScriptModelException(status);</TD></TR><TR><TD CLASS="l">393</TD><TD> }</TD></TR><TR CLASS="z"><TD CLASS="l">394</TD><TD> IProgressMonitor subProgressMonitor = getSubProgressMonitor(subWorkAmount);</TD></TR><TR><TD CLASS="l">395</TD><TD> // fix for 1FW7IKC, part (1)</TD></TR><TR><TD CLASS="l">396</TD><TD> try {</TD></TR><TR CLASS="z"><TD CLASS="l">397</TD><TD> operation.setNested(true);</TD></TR><TR CLASS="z"><TD CLASS="l">398</TD><TD> operation.run(subProgressMonitor);</TD></TR><TR CLASS="z"><TD CLASS="l">399</TD><TD> } catch (CoreException ce) {</TD></TR><TR CLASS="z"><TD CLASS="l">400</TD><TD> if (ce instanceof JavaScriptModelException) {</TD></TR><TR CLASS="z"><TD CLASS="l">401</TD><TD> throw (JavaScriptModelException)ce;</TD></TR><TR><TD CLASS="l">402</TD><TD> } else {</TD></TR><TR><TD CLASS="l">403</TD><TD> // translate the core exception to a java model exception</TD></TR><TR CLASS="z"><TD CLASS="l">404</TD><TD> if (ce.getStatus().getCode() == IResourceStatus.OPERATION_FAILED) {</TD></TR><TR CLASS="z"><TD CLASS="l">405</TD><TD> Throwable e = ce.getStatus().getException();</TD></TR><TR CLASS="z"><TD CLASS="l">406</TD><TD> if (e instanceof JavaScriptModelException) {</TD></TR><TR CLASS="z"><TD CLASS="l">407</TD><TD> throw (JavaScriptModelException) e;</TD></TR><TR><TD CLASS="l">408</TD><TD> }</TD></TR><TR><TD CLASS="l">409</TD><TD> }</TD></TR><TR CLASS="z"><TD CLASS="l">410</TD><TD> throw new JavaScriptModelException(ce);</TD></TR><TR><TD CLASS="l">411</TD><TD> }</TD></TR><TR><TD CLASS="l">412</TD><TD> }</TD></TR><TR CLASS="z"><TD CLASS="l">413</TD><TD> }</TD></TR><TR><TD CLASS="l">414</TD><TD> /**</TD></TR><TR><TD CLASS="l">415</TD><TD> * Performs the operation specific behavior. Subclasses must override.</TD></TR><TR><TD CLASS="l">416</TD><TD> */</TD></TR><TR><TD CLASS="l">417</TD><TD> protected abstract void executeOperation() throws JavaScriptModelException;</TD></TR><TR><TD CLASS="l">418</TD><TD> /*</TD></TR><TR><TD CLASS="l"><A NAME="1a">419</A></TD><TD> * Returns the attribute registered at the given key with the top level operation.</TD></TR><TR><TD CLASS="l">420</TD><TD> * Returns null if no such attribute is found.</TD></TR><TR><TD CLASS="l">421</TD><TD> */</TD></TR><TR><TD CLASS="l">422</TD><TD> protected static Object getAttribute(Object key) {</TD></TR><TR CLASS="z"><TD CLASS="l">423</TD><TD> ArrayList stack = getCurrentOperationStack();</TD></TR><TR CLASS="z"><TD CLASS="l">424</TD><TD> if (stack.size() == 0) return null;</TD></TR><TR CLASS="z"><TD CLASS="l">425</TD><TD> JavaModelOperation topLevelOp = (JavaModelOperation)stack.get(0);</TD></TR><TR CLASS="z"><TD CLASS="l">426</TD><TD> if (topLevelOp.attributes == null) {</TD></TR><TR CLASS="z"><TD CLASS="l">427</TD><TD> return null;</TD></TR><TR><TD CLASS="l">428</TD><TD> } else {</TD></TR><TR CLASS="z"><TD CLASS="l">429</TD><TD> return topLevelOp.attributes.get(key);</TD></TR><TR><TD CLASS="l">430</TD><TD> }</TD></TR><TR><TD CLASS="l">431</TD><TD> }</TD></TR><TR><TD CLASS="l">432</TD><TD> /**</TD></TR><TR><TD CLASS="l">433</TD><TD> * Returns the compilation unit the given element is contained in,</TD></TR><TR><TD CLASS="l">434</TD><TD> * or the element itself (if it is a compilation unit),</TD></TR><TR><TD CLASS="l"><A NAME="1b">435</A></TD><TD> * otherwise <code>null</code>.</TD></TR><TR><TD CLASS="l">436</TD><TD> */</TD></TR><TR><TD CLASS="l">437</TD><TD> protected IJavaScriptUnit getCompilationUnitFor(IJavaScriptElement element) {</TD></TR><TR><TD CLASS="l">438</TD><TD> </TD></TR><TR CLASS="z"><TD CLASS="l">439</TD><TD> return ((JavaElement)element).getJavaScriptUnit();</TD></TR><TR><TD CLASS="l">440</TD><TD> }</TD></TR><TR><TD CLASS="l">441</TD><TD> /*</TD></TR><TR><TD CLASS="l"><A NAME="1c">442</A></TD><TD> * Returns the stack of operations running in the current thread.</TD></TR><TR><TD CLASS="l">443</TD><TD> * Returns an empty stack if no operations are currently running in this thread.</TD></TR><TR><TD CLASS="l">444</TD><TD> */</TD></TR><TR><TD CLASS="l">445</TD><TD> protected static ArrayList getCurrentOperationStack() {</TD></TR><TR CLASS="z"><TD CLASS="l">446</TD><TD> ArrayList stack = (ArrayList)operationStacks.get();</TD></TR><TR CLASS="z"><TD CLASS="l">447</TD><TD> if (stack == null) {</TD></TR><TR CLASS="z"><TD CLASS="l">448</TD><TD> stack = new ArrayList();</TD></TR><TR CLASS="z"><TD CLASS="l">449</TD><TD> operationStacks.set(stack);</TD></TR><TR><TD CLASS="l">450</TD><TD> }</TD></TR><TR CLASS="z"><TD CLASS="l">451</TD><TD> return stack;</TD></TR><TR><TD CLASS="l">452</TD><TD> }</TD></TR><TR><TD CLASS="l"><A NAME="1d">453</A></TD><TD> /*</TD></TR><TR><TD CLASS="l">454</TD><TD> * Returns the existing document for the given cu, or a DocumentAdapter if none.</TD></TR><TR><TD CLASS="l">455</TD><TD> */</TD></TR><TR><TD CLASS="l">456</TD><TD> protected IDocument getDocument(IJavaScriptUnit cu) throws JavaScriptModelException {</TD></TR><TR CLASS="z"><TD CLASS="l">457</TD><TD> IBuffer buffer = cu.getBuffer();</TD></TR><TR CLASS="z"><TD CLASS="l">458</TD><TD> if (buffer instanceof IDocument)</TD></TR><TR CLASS="z"><TD CLASS="l">459</TD><TD> return (IDocument) buffer;</TD></TR><TR CLASS="z"><TD CLASS="l">460</TD><TD> return new DocumentAdapter(buffer);</TD></TR><TR><TD CLASS="l">461</TD><TD> }</TD></TR><TR><TD CLASS="l">462</TD><TD> /**</TD></TR><TR><TD CLASS="l"><A NAME="1f">463</A></TD><TD> * Returns the elements to which this operation applies,</TD></TR><TR><TD CLASS="l">464</TD><TD> * or <code>null</code> if not applicable.</TD></TR><TR><TD CLASS="l">465</TD><TD> */</TD></TR><TR><TD CLASS="l">466</TD><TD> protected IJavaScriptElement[] getElementsToProcess() {</TD></TR><TR CLASS="z"><TD CLASS="l">467</TD><TD> return elementsToProcess;</TD></TR><TR><TD CLASS="l">468</TD><TD> }</TD></TR><TR><TD CLASS="l">469</TD><TD> /**</TD></TR><TR><TD CLASS="l"><A NAME="1e">470</A></TD><TD> * Returns the element to which this operation applies,</TD></TR><TR><TD CLASS="l">471</TD><TD> * or <code>null</code> if not applicable.</TD></TR><TR><TD CLASS="l">472</TD><TD> */</TD></TR><TR><TD CLASS="l">473</TD><TD> protected IJavaScriptElement getElementToProcess() {</TD></TR><TR CLASS="z"><TD CLASS="l">474</TD><TD> if (elementsToProcess == null || elementsToProcess.length == 0) {</TD></TR><TR CLASS="z"><TD CLASS="l">475</TD><TD> return null;</TD></TR><TR><TD CLASS="l">476</TD><TD> }</TD></TR><TR CLASS="z"><TD CLASS="l">477</TD><TD> return elementsToProcess[0];</TD></TR><TR><TD CLASS="l">478</TD><TD> }</TD></TR><TR><TD CLASS="l"><A NAME="20">479</A></TD><TD> /**</TD></TR><TR><TD CLASS="l">480</TD><TD> * Returns the Java Model this operation is operating in.</TD></TR><TR><TD CLASS="l">481</TD><TD> */</TD></TR><TR><TD CLASS="l"><A NAME="21">482</A></TD><TD> public IJavaScriptModel getJavaModel() {</TD></TR><TR CLASS="z"><TD CLASS="l">483</TD><TD> return JavaModelManager.getJavaModelManager().getJavaModel();</TD></TR><TR><TD CLASS="l">484</TD><TD> }</TD></TR><TR><TD CLASS="l">485</TD><TD> protected IPath[] getNestedFolders(IPackageFragmentRoot root) throws JavaScriptModelException {</TD></TR><TR CLASS="z"><TD CLASS="l">486</TD><TD> IPath rootPath = root.getPath();</TD></TR><TR CLASS="z"><TD CLASS="l">487</TD><TD> IIncludePathEntry[] classpath = root.getJavaScriptProject().getRawIncludepath();</TD></TR><TR CLASS="z"><TD CLASS="l">488</TD><TD> int length = classpath.length;</TD></TR><TR CLASS="z"><TD CLASS="l">489</TD><TD> IPath[] result = new IPath[length];</TD></TR><TR CLASS="z"><TD CLASS="l">490</TD><TD> int index = 0;</TD></TR><TR CLASS="z"><TD CLASS="l">491</TD><TD> for (int i = 0; i < length; i++) {</TD></TR><TR CLASS="z"><TD CLASS="l">492</TD><TD> IPath path = classpath[i].getPath();</TD></TR><TR CLASS="z"><TD CLASS="l">493</TD><TD> if (rootPath.isPrefixOf(path) && !rootPath.equals(path)) {</TD></TR><TR CLASS="z"><TD CLASS="l">494</TD><TD> result[index++] = path;</TD></TR><TR><TD CLASS="l">495</TD><TD> }</TD></TR><TR><TD CLASS="l">496</TD><TD> }</TD></TR><TR CLASS="z"><TD CLASS="l">497</TD><TD> if (index < length) {</TD></TR><TR CLASS="z"><TD CLASS="l">498</TD><TD> System.arraycopy(result, 0, result = new IPath[index], 0, index);</TD></TR><TR><TD CLASS="l">499</TD><TD> }</TD></TR><TR CLASS="z"><TD CLASS="l">500</TD><TD> return result;</TD></TR><TR><TD CLASS="l">501</TD><TD> }</TD></TR><TR><TD CLASS="l">502</TD><TD> /**</TD></TR><TR><TD CLASS="l"><A NAME="22">503</A></TD><TD> * Returns the parent element to which this operation applies,</TD></TR><TR><TD CLASS="l">504</TD><TD> * or <code>null</code> if not applicable.</TD></TR><TR><TD CLASS="l">505</TD><TD> */</TD></TR><TR><TD CLASS="l">506</TD><TD> protected IJavaScriptElement getParentElement() {</TD></TR><TR CLASS="z"><TD CLASS="l">507</TD><TD> if (parentElements == null || parentElements.length == 0) {</TD></TR><TR CLASS="z"><TD CLASS="l">508</TD><TD> return null;</TD></TR><TR><TD CLASS="l">509</TD><TD> }</TD></TR><TR CLASS="z"><TD CLASS="l">510</TD><TD> return parentElements[0];</TD></TR><TR><TD CLASS="l">511</TD><TD> }</TD></TR><TR><TD CLASS="l">512</TD><TD> /**</TD></TR><TR><TD CLASS="l"><A NAME="23">513</A></TD><TD> * Returns the parent elements to which this operation applies,</TD></TR><TR><TD CLASS="l">514</TD><TD> * or <code>null</code> if not applicable.</TD></TR><TR><TD CLASS="l">515</TD><TD> */</TD></TR><TR><TD CLASS="l">516</TD><TD> protected IJavaScriptElement[] getParentElements() {</TD></TR><TR CLASS="z"><TD CLASS="l">517</TD><TD> return parentElements;</TD></TR><TR><TD CLASS="l">518</TD><TD> }</TD></TR><TR><TD CLASS="l"><A NAME="24">519</A></TD><TD> /**</TD></TR><TR><TD CLASS="l">520</TD><TD> * Returns the elements created by this operation.</TD></TR><TR><TD CLASS="l">521</TD><TD> */</TD></TR><TR><TD CLASS="l">522</TD><TD> public IJavaScriptElement[] getResultElements() {</TD></TR><TR CLASS="z"><TD CLASS="l">523</TD><TD> return resultElements;</TD></TR><TR><TD CLASS="l">524</TD><TD> }</TD></TR><TR><TD CLASS="l">525</TD><TD> /*</TD></TR><TR><TD CLASS="l">526</TD><TD> * Returns the scheduling rule for this operation (i.e. the resource that needs to be locked</TD></TR><TR><TD CLASS="l"><A NAME="25">527</A></TD><TD> * while this operation is running.</TD></TR><TR><TD CLASS="l">528</TD><TD> * Subclasses can override.</TD></TR><TR><TD CLASS="l">529</TD><TD> */</TD></TR><TR><TD CLASS="l">530</TD><TD> protected ISchedulingRule getSchedulingRule() {</TD></TR><TR CLASS="z"><TD CLASS="l">531</TD><TD> return ResourcesPlugin.getWorkspace().getRoot();</TD></TR><TR><TD CLASS="l">532</TD><TD> }</TD></TR><TR><TD CLASS="l"><A NAME="26">533</A></TD><TD> /**</TD></TR><TR><TD CLASS="l">534</TD><TD> * Creates and returns a subprogress monitor if appropriate.</TD></TR><TR><TD CLASS="l">535</TD><TD> */</TD></TR><TR><TD CLASS="l">536</TD><TD> protected IProgressMonitor getSubProgressMonitor(int workAmount) {</TD></TR><TR CLASS="z"><TD CLASS="l">537</TD><TD> IProgressMonitor sub = null;</TD></TR><TR CLASS="z"><TD CLASS="l">538</TD><TD> if (progressMonitor != null) {</TD></TR><TR CLASS="z"><TD CLASS="l">539</TD><TD> sub = new SubProgressMonitor(progressMonitor, workAmount, SubProgressMonitor.PREPEND_MAIN_LABEL_TO_SUBTASK);</TD></TR><TR><TD CLASS="l">540</TD><TD> }</TD></TR><TR CLASS="z"><TD CLASS="l">541</TD><TD> return sub;</TD></TR><TR><TD CLASS="l">542</TD><TD> }</TD></TR><TR><TD CLASS="l">543</TD><TD> </TD></TR><TR><TD CLASS="l">544</TD><TD> /**</TD></TR><TR><TD CLASS="l"><A NAME="27">545</A></TD><TD> * Returns whether this operation has performed any resource modifications.</TD></TR><TR><TD CLASS="l">546</TD><TD> * Returns false if this operation has not been executed yet.</TD></TR><TR><TD CLASS="l">547</TD><TD> */</TD></TR><TR><TD CLASS="l"><A NAME="28">548</A></TD><TD> public boolean hasModifiedResource() {</TD></TR><TR CLASS="z"><TD CLASS="l">549</TD><TD> return !this.isReadOnly() && getAttribute(HAS_MODIFIED_RESOURCE_ATTR) == TRUE;</TD></TR><TR><TD CLASS="l">550</TD><TD> }</TD></TR><TR><TD CLASS="l">551</TD><TD> public void internalWorked(double work) {</TD></TR><TR CLASS="z"><TD CLASS="l">552</TD><TD> if (progressMonitor != null) {</TD></TR><TR CLASS="z"><TD CLASS="l">553</TD><TD> progressMonitor.internalWorked(work);</TD></TR><TR><TD CLASS="l">554</TD><TD> }</TD></TR><TR CLASS="z"><TD CLASS="l">555</TD><TD> }</TD></TR><TR><TD CLASS="l"><A NAME="29">556</A></TD><TD> /**</TD></TR><TR><TD CLASS="l">557</TD><TD> * @see IProgressMonitor</TD></TR><TR><TD CLASS="l">558</TD><TD> */</TD></TR><TR><TD CLASS="l">559</TD><TD> public boolean isCanceled() {</TD></TR><TR CLASS="z"><TD CLASS="l">560</TD><TD> if (progressMonitor != null) {</TD></TR><TR CLASS="z"><TD CLASS="l">561</TD><TD> return progressMonitor.isCanceled();</TD></TR><TR><TD CLASS="l">562</TD><TD> }</TD></TR><TR CLASS="z"><TD CLASS="l">563</TD><TD> return false;</TD></TR><TR><TD CLASS="l">564</TD><TD> }</TD></TR><TR><TD CLASS="l">565</TD><TD> /**</TD></TR><TR><TD CLASS="l"><A NAME="2a">566</A></TD><TD> * Returns <code>true</code> if this operation performs no resource modifications,</TD></TR><TR><TD CLASS="l">567</TD><TD> * otherwise <code>false</code>. Subclasses must override.</TD></TR><TR><TD CLASS="l">568</TD><TD> */</TD></TR><TR><TD CLASS="l">569</TD><TD> public boolean isReadOnly() {</TD></TR><TR CLASS="z"><TD CLASS="l">570</TD><TD> return false;</TD></TR><TR><TD CLASS="l">571</TD><TD> }</TD></TR><TR><TD CLASS="l">572</TD><TD> /*</TD></TR><TR><TD CLASS="l">573</TD><TD> * Returns whether this operation is the first operation to run in the current thread.</TD></TR><TR><TD CLASS="l"><A NAME="2b">574</A></TD><TD> */</TD></TR><TR><TD CLASS="l">575</TD><TD> protected boolean isTopLevelOperation() {</TD></TR><TR><TD CLASS="l">576</TD><TD> ArrayList stack;</TD></TR><TR CLASS="z"><TD CLASS="l">577</TD><TD> return</TD></TR><TR CLASS="z"><TD CLASS="l">578</TD><TD> (stack = getCurrentOperationStack()).size() > 0</TD></TR><TR CLASS="z"><TD CLASS="l">579</TD><TD> && stack.get(0) == this;</TD></TR><TR><TD CLASS="l">580</TD><TD> }</TD></TR><TR><TD CLASS="l">581</TD><TD> /*</TD></TR><TR><TD CLASS="l"><A NAME="19">582</A></TD><TD> * Returns the index of the first registered action with the given id, starting from a given position.</TD></TR><TR><TD CLASS="l">583</TD><TD> * Returns -1 if not found.</TD></TR><TR><TD CLASS="l">584</TD><TD> */</TD></TR><TR><TD CLASS="l">585</TD><TD> protected int firstActionWithID(String id, int start) {</TD></TR><TR CLASS="z"><TD CLASS="l">586</TD><TD> for (int i = start; i <= this.actionsEnd; i++) {</TD></TR><TR CLASS="z"><TD CLASS="l">587</TD><TD> if (this.actions[i].getID().equals(id)) {</TD></TR><TR CLASS="z"><TD CLASS="l">588</TD><TD> return i;</TD></TR><TR><TD CLASS="l">589</TD><TD> }</TD></TR><TR><TD CLASS="l">590</TD><TD> }</TD></TR><TR CLASS="z"><TD CLASS="l">591</TD><TD> return -1;</TD></TR><TR><TD CLASS="l">592</TD><TD> }</TD></TR><TR><TD CLASS="l">593</TD><TD> </TD></TR><TR><TD CLASS="l"><A NAME="2c">594</A></TD><TD> /**</TD></TR><TR><TD CLASS="l">595</TD><TD> * Convenience method to move resources</TD></TR><TR><TD CLASS="l">596</TD><TD> */</TD></TR><TR><TD CLASS="l">597</TD><TD> protected void moveResources(IResource[] resources, IPath destinationPath) throws JavaScriptModelException {</TD></TR><TR CLASS="z"><TD CLASS="l">598</TD><TD> IProgressMonitor subProgressMonitor = null;</TD></TR><TR CLASS="z"><TD CLASS="l">599</TD><TD> if (progressMonitor != null) {</TD></TR><TR CLASS="z"><TD CLASS="l">600</TD><TD> subProgressMonitor = new SubProgressMonitor(progressMonitor, resources.length, SubProgressMonitor.PREPEND_MAIN_LABEL_TO_SUBTASK);</TD></TR><TR><TD CLASS="l">601</TD><TD> }</TD></TR><TR CLASS="z"><TD CLASS="l">602</TD><TD> IWorkspace workspace = resources[0].getWorkspace();</TD></TR><TR><TD CLASS="l">603</TD><TD> try {</TD></TR><TR CLASS="z"><TD CLASS="l">604</TD><TD> workspace.move(resources, destinationPath, false, subProgressMonitor);</TD></TR><TR CLASS="z"><TD CLASS="l">605</TD><TD> setAttribute(HAS_MODIFIED_RESOURCE_ATTR, TRUE);</TD></TR><TR CLASS="z"><TD CLASS="l">606</TD><TD> } catch (CoreException e) {</TD></TR><TR CLASS="z"><TD CLASS="l">607</TD><TD> throw new JavaScriptModelException(e);</TD></TR><TR><TD CLASS="l">608</TD><TD> }</TD></TR><TR CLASS="z"><TD CLASS="l">609</TD><TD> }</TD></TR><TR><TD CLASS="l">610</TD><TD> /**</TD></TR><TR><TD CLASS="l"><A NAME="2d">611</A></TD><TD> * Creates and returns a new <code>IJavaScriptElementDelta</code></TD></TR><TR><TD CLASS="l">612</TD><TD> * on the Java Model.</TD></TR><TR><TD CLASS="l">613</TD><TD> */</TD></TR><TR><TD CLASS="l">614</TD><TD> public JavaElementDelta newJavaElementDelta() {</TD></TR><TR CLASS="z"><TD CLASS="l">615</TD><TD> return new JavaElementDelta(getJavaModel());</TD></TR><TR><TD CLASS="l">616</TD><TD> }</TD></TR><TR><TD CLASS="l">617</TD><TD> /*</TD></TR><TR><TD CLASS="l"><A NAME="2e">618</A></TD><TD> * Removes the last pushed operation from the stack of running operations.</TD></TR><TR><TD CLASS="l">619</TD><TD> * Returns the poped operation or null if the stack was empty.</TD></TR><TR><TD CLASS="l">620</TD><TD> */</TD></TR><TR><TD CLASS="l">621</TD><TD> protected JavaModelOperation popOperation() {</TD></TR><TR CLASS="z"><TD CLASS="l">622</TD><TD> ArrayList stack = getCurrentOperationStack();</TD></TR><TR CLASS="z"><TD CLASS="l">623</TD><TD> int size = stack.size();</TD></TR><TR CLASS="z"><TD CLASS="l">624</TD><TD> if (size > 0) {</TD></TR><TR CLASS="z"><TD CLASS="l">625</TD><TD> if (size == 1) { // top level operation</TD></TR><TR CLASS="z"><TD CLASS="l">626</TD><TD> operationStacks.set(null); // release reference (see http://bugs.eclipse.org/bugs/show_bug.cgi?id=33927)</TD></TR><TR><TD CLASS="l">627</TD><TD> }</TD></TR><TR CLASS="z"><TD CLASS="l">628</TD><TD> return (JavaModelOperation)stack.remove(size-1);</TD></TR><TR><TD CLASS="l">629</TD><TD> } else {</TD></TR><TR CLASS="z"><TD CLASS="l">630</TD><TD> return null;</TD></TR><TR><TD CLASS="l">631</TD><TD> }</TD></TR><TR><TD CLASS="l">632</TD><TD> }</TD></TR><TR><TD CLASS="l">633</TD><TD> /*</TD></TR><TR><TD CLASS="l">634</TD><TD> * Registers the given action to be run when the outer most java model operation has finished.</TD></TR><TR><TD CLASS="l">635</TD><TD> * The insertion mode controls whether:</TD></TR><TR><TD CLASS="l">636</TD><TD> * - the action should discard all existing actions with the same id, and be queued at the end (REMOVEALL_APPEND),</TD></TR><TR><TD CLASS="l"><A NAME="2f">637</A></TD><TD> * - the action should be ignored if there is already an action with the same id (KEEP_EXISTING),</TD></TR><TR><TD CLASS="l">638</TD><TD> * - the action should be queued at the end without looking at existing actions (APPEND)</TD></TR><TR><TD CLASS="l">639</TD><TD> */</TD></TR><TR><TD CLASS="l">640</TD><TD> protected void postAction(IPostAction action, int insertionMode) {</TD></TR><TR CLASS="z"><TD CLASS="l">641</TD><TD> if (POST_ACTION_VERBOSE) {</TD></TR><TR CLASS="z"><TD CLASS="l">642</TD><TD> System.out.print("(" + Thread.currentThread() + ") [JavaModelOperation.postAction(IPostAction, int)] Posting action " + action.getID()); //$NON-NLS-1$ //$NON-NLS-2$</TD></TR><TR CLASS="z"><TD CLASS="l">643</TD><TD> switch(insertionMode) {</TD></TR><TR><TD CLASS="l">644</TD><TD> case REMOVEALL_APPEND:</TD></TR><TR CLASS="z"><TD CLASS="l">645</TD><TD> System.out.println(" (REMOVEALL_APPEND)"); //$NON-NLS-1$</TD></TR><TR CLASS="z"><TD CLASS="l">646</TD><TD> break;</TD></TR><TR><TD CLASS="l">647</TD><TD> case KEEP_EXISTING:</TD></TR><TR CLASS="z"><TD CLASS="l">648</TD><TD> System.out.println(" (KEEP_EXISTING)"); //$NON-NLS-1$</TD></TR><TR CLASS="z"><TD CLASS="l">649</TD><TD> break;</TD></TR><TR><TD CLASS="l">650</TD><TD> case APPEND:</TD></TR><TR CLASS="z"><TD CLASS="l">651</TD><TD> System.out.println(" (APPEND)"); //$NON-NLS-1$</TD></TR><TR><TD CLASS="l">652</TD><TD> break;</TD></TR><TR><TD CLASS="l">653</TD><TD> }</TD></TR><TR><TD CLASS="l">654</TD><TD> }</TD></TR><TR><TD CLASS="l">655</TD><TD> </TD></TR><TR CLASS="z"><TD CLASS="l">656</TD><TD> JavaModelOperation topLevelOp = (JavaModelOperation)getCurrentOperationStack().get(0);</TD></TR><TR CLASS="z"><TD CLASS="l">657</TD><TD> IPostAction[] postActions = topLevelOp.actions;</TD></TR><TR CLASS="z"><TD CLASS="l">658</TD><TD> if (postActions == null) {</TD></TR><TR CLASS="z"><TD CLASS="l">659</TD><TD> topLevelOp.actions = postActions = new IPostAction[1];</TD></TR><TR CLASS="z"><TD CLASS="l">660</TD><TD> postActions[0] = action;</TD></TR><TR CLASS="z"><TD CLASS="l">661</TD><TD> topLevelOp.actionsEnd = 0;</TD></TR><TR><TD CLASS="l">662</TD><TD> } else {</TD></TR><TR CLASS="z"><TD CLASS="l">663</TD><TD> String id = action.getID();</TD></TR><TR CLASS="z"><TD CLASS="l">664</TD><TD> switch (insertionMode) {</TD></TR><TR><TD CLASS="l">665</TD><TD> case REMOVEALL_APPEND :</TD></TR><TR CLASS="z"><TD CLASS="l">666</TD><TD> int index = this.actionsStart-1;</TD></TR><TR CLASS="z"><TD CLASS="l">667</TD><TD> while ((index = topLevelOp.firstActionWithID(id, index+1)) >= 0) {</TD></TR><TR><TD CLASS="l">668</TD><TD> // remove action[index]</TD></TR><TR CLASS="z"><TD CLASS="l">669</TD><TD> System.arraycopy(postActions, index+1, postActions, index, topLevelOp.actionsEnd - index);</TD></TR><TR CLASS="z"><TD CLASS="l">670</TD><TD> postActions[topLevelOp.actionsEnd--] = null;</TD></TR><TR><TD CLASS="l">671</TD><TD> }</TD></TR><TR CLASS="z"><TD CLASS="l">672</TD><TD> topLevelOp.addAction(action);</TD></TR><TR CLASS="z"><TD CLASS="l">673</TD><TD> break;</TD></TR><TR><TD CLASS="l">674</TD><TD> case KEEP_EXISTING:</TD></TR><TR CLASS="z"><TD CLASS="l">675</TD><TD> if (topLevelOp.firstActionWithID(id, 0) < 0) {</TD></TR><TR CLASS="z"><TD CLASS="l">676</TD><TD> topLevelOp.addAction(action);</TD></TR><TR><TD CLASS="l">677</TD><TD> }</TD></TR><TR CLASS="z"><TD CLASS="l">678</TD><TD> break;</TD></TR><TR><TD CLASS="l">679</TD><TD> case APPEND:</TD></TR><TR CLASS="z"><TD CLASS="l">680</TD><TD> topLevelOp.addAction(action);</TD></TR><TR><TD CLASS="l">681</TD><TD> break;</TD></TR><TR><TD CLASS="l">682</TD><TD> }</TD></TR><TR><TD CLASS="l">683</TD><TD> }</TD></TR><TR CLASS="z"><TD CLASS="l">684</TD><TD> }</TD></TR><TR><TD CLASS="l"><A NAME="30">685</A></TD><TD> /*</TD></TR><TR><TD CLASS="l">686</TD><TD> * Returns whether the given path is the prefix of one of the given other paths.</TD></TR><TR><TD CLASS="l">687</TD><TD> */</TD></TR><TR><TD CLASS="l">688</TD><TD> protected boolean prefixesOneOf(IPath path, IPath[] otherPaths) {</TD></TR><TR CLASS="z"><TD CLASS="l">689</TD><TD> for (int i = 0, length = otherPaths.length; i < length; i++) {</TD></TR><TR CLASS="z"><TD CLASS="l">690</TD><TD> if (path.isPrefixOf(otherPaths[i])) {</TD></TR><TR CLASS="z"><TD CLASS="l">691</TD><TD> return true;</TD></TR><TR><TD CLASS="l">692</TD><TD> }</TD></TR><TR><TD CLASS="l">693</TD><TD> }</TD></TR><TR CLASS="z"><TD CLASS="l">694</TD><TD> return false;</TD></TR><TR><TD CLASS="l">695</TD><TD> }</TD></TR><TR><TD CLASS="l"><A NAME="31">696</A></TD><TD> /*</TD></TR><TR><TD CLASS="l">697</TD><TD> * Pushes the given operation on the stack of operations currently running in this thread.</TD></TR><TR><TD CLASS="l">698</TD><TD> */</TD></TR><TR><TD CLASS="l">699</TD><TD> protected void pushOperation(JavaModelOperation operation) {</TD></TR><TR CLASS="z"><TD CLASS="l">700</TD><TD> getCurrentOperationStack().add(operation);</TD></TR><TR CLASS="z"><TD CLASS="l">701</TD><TD> }</TD></TR><TR><TD CLASS="l">702</TD><TD> /*</TD></TR><TR><TD CLASS="l"><A NAME="32">703</A></TD><TD> * Removes all actions with the given id from the queue of post actions.</TD></TR><TR><TD CLASS="l">704</TD><TD> * Does nothing if no such action is in the queue.</TD></TR><TR><TD CLASS="l">705</TD><TD> */</TD></TR><TR><TD CLASS="l">706</TD><TD> protected void removeAllPostAction(String actionID) {</TD></TR><TR CLASS="z"><TD CLASS="l">707</TD><TD> if (POST_ACTION_VERBOSE) {</TD></TR><TR CLASS="z"><TD CLASS="l">708</TD><TD> System.out.println("(" + Thread.currentThread() + ") [JavaModelOperation.removeAllPostAction(String)] Removing actions " + actionID); //$NON-NLS-1$ //$NON-NLS-2$</TD></TR><TR><TD CLASS="l">709</TD><TD> }</TD></TR><TR><TD CLASS="l">710</TD><TD> </TD></TR><TR CLASS="z"><TD CLASS="l">711</TD><TD> JavaModelOperation topLevelOp = (JavaModelOperation)getCurrentOperationStack().get(0);</TD></TR><TR CLASS="z"><TD CLASS="l">712</TD><TD> IPostAction[] postActions = topLevelOp.actions;</TD></TR><TR CLASS="z"><TD CLASS="l">713</TD><TD> if (postActions == null) return;</TD></TR><TR CLASS="z"><TD CLASS="l">714</TD><TD> int index = this.actionsStart-1;</TD></TR><TR CLASS="z"><TD CLASS="l">715</TD><TD> while ((index = topLevelOp.firstActionWithID(actionID, index+1)) >= 0) {</TD></TR><TR><TD CLASS="l">716</TD><TD> // remove action[index]</TD></TR><TR CLASS="z"><TD CLASS="l">717</TD><TD> System.arraycopy(postActions, index+1, postActions, index, topLevelOp.actionsEnd - index);</TD></TR><TR CLASS="z"><TD CLASS="l">718</TD><TD> postActions[topLevelOp.actionsEnd--] = null;</TD></TR><TR><TD CLASS="l">719</TD><TD> }</TD></TR><TR CLASS="z"><TD CLASS="l">720</TD><TD> }</TD></TR><TR><TD CLASS="l">721</TD><TD> </TD></TR><TR><TD CLASS="l">722</TD><TD> /**</TD></TR><TR><TD CLASS="l">723</TD><TD> * Runs this operation and registers any deltas created.</TD></TR><TR><TD CLASS="l">724</TD><TD> *</TD></TR><TR><TD CLASS="l"><A NAME="34">725</A></TD><TD> * @see IWorkspaceRunnable</TD></TR><TR><TD CLASS="l">726</TD><TD> * @exception CoreException if the operation fails</TD></TR><TR><TD CLASS="l">727</TD><TD> */</TD></TR><TR><TD CLASS="l">728</TD><TD> public void run(IProgressMonitor monitor) throws CoreException {</TD></TR><TR CLASS="z"><TD CLASS="l">729</TD><TD> JavaModelManager manager = JavaModelManager.getJavaModelManager();</TD></TR><TR CLASS="z"><TD CLASS="l">730</TD><TD> DeltaProcessor deltaProcessor = manager.getDeltaProcessor();</TD></TR><TR CLASS="z"><TD CLASS="l">731</TD><TD> int previousDeltaCount = deltaProcessor.javaModelDeltas.size();</TD></TR><TR><TD CLASS="l">732</TD><TD> try {</TD></TR><TR CLASS="z"><TD CLASS="l">733</TD><TD> progressMonitor = monitor;</TD></TR><TR CLASS="z"><TD CLASS="l">734</TD><TD> pushOperation(this);</TD></TR><TR><TD CLASS="l">735</TD><TD> try {</TD></TR><TR CLASS="z"><TD CLASS="l">736</TD><TD> if (canModifyRoots()) {</TD></TR><TR><TD CLASS="l">737</TD><TD> // computes the root infos before executing the operation</TD></TR><TR><TD CLASS="l">738</TD><TD> // noop if aready initialized</TD></TR><TR CLASS="z"><TD CLASS="l">739</TD><TD> JavaModelManager.getJavaModelManager().deltaState.initializeRoots();</TD></TR><TR><TD CLASS="l">740</TD><TD> }</TD></TR><TR><TD CLASS="l">741</TD><TD> </TD></TR><TR CLASS="z"><TD CLASS="l">742</TD><TD> executeOperation();</TD></TR><TR CLASS="z"><TD CLASS="l">743</TD><TD> } finally {</TD></TR><TR CLASS="z"><TD CLASS="l">744</TD><TD> if (this.isTopLevelOperation()) {</TD></TR><TR CLASS="z"><TD CLASS="l">745</TD><TD> this.runPostActions();</TD></TR><TR><TD CLASS="l">746</TD><TD> }</TD></TR><TR CLASS="z"><TD CLASS="l">747</TD><TD> }</TD></TR><TR CLASS="z"><TD CLASS="l">748</TD><TD> } finally {</TD></TR><TR><TD CLASS="l">749</TD><TD> try {</TD></TR><TR><TD CLASS="l">750</TD><TD> // reacquire delta processor as it can have been reset during executeOperation()</TD></TR><TR CLASS="z"><TD CLASS="l">751</TD><TD> deltaProcessor = manager.getDeltaProcessor();</TD></TR><TR><TD CLASS="l">752</TD><TD> </TD></TR><TR><TD CLASS="l">753</TD><TD> // update JavaModel using deltas that were recorded during this operation</TD></TR><TR CLASS="z"><TD CLASS="l">754</TD><TD> for (int i = previousDeltaCount, size = deltaProcessor.javaModelDeltas.size(); i < size; i++) {</TD></TR><TR CLASS="z"><TD CLASS="l">755</TD><TD> deltaProcessor.updateJavaModel((IJavaScriptElementDelta)deltaProcessor.javaModelDeltas.get(i));</TD></TR><TR><TD CLASS="l">756</TD><TD> }</TD></TR><TR><TD CLASS="l">757</TD><TD> </TD></TR><TR><TD CLASS="l">758</TD><TD> // close the parents of the created elements and reset their project's cache (in case we are in an</TD></TR><TR><TD CLASS="l">759</TD><TD> // IWorkspaceRunnable and the clients wants to use the created element's parent)</TD></TR><TR><TD CLASS="l">760</TD><TD> // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=83646</TD></TR><TR CLASS="z"><TD CLASS="l">761</TD><TD> for (int i = 0, length = this.resultElements.length; i < length; i++) {</TD></TR><TR CLASS="z"><TD CLASS="l">762</TD><TD> IJavaScriptElement element = this.resultElements[i];</TD></TR><TR CLASS="z"><TD CLASS="l">763</TD><TD> Openable openable = (Openable) element.getOpenable();</TD></TR><TR CLASS="z"><TD CLASS="l">764</TD><TD> if (!(openable instanceof CompilationUnit) || !((CompilationUnit) openable).isWorkingCopy()) { // a working copy must remain a child of its parent even after a move</TD></TR><TR CLASS="z"><TD CLASS="l">765</TD><TD> ((JavaElement) openable.getParent()).close();</TD></TR><TR><TD CLASS="l">766</TD><TD> }</TD></TR><TR CLASS="z"><TD CLASS="l">767</TD><TD> switch (element.getElementType()) {</TD></TR><TR><TD CLASS="l">768</TD><TD> case IJavaScriptElement.PACKAGE_FRAGMENT_ROOT:</TD></TR><TR><TD CLASS="l">769</TD><TD> case IJavaScriptElement.PACKAGE_FRAGMENT:</TD></TR><TR CLASS="z"><TD CLASS="l">770</TD><TD> deltaProcessor.projectCachesToReset.add(element.getJavaScriptProject());</TD></TR><TR><TD CLASS="l">771</TD><TD> break;</TD></TR><TR><TD CLASS="l">772</TD><TD> }</TD></TR><TR><TD CLASS="l">773</TD><TD> }</TD></TR><TR CLASS="z"><TD CLASS="l">774</TD><TD> deltaProcessor.resetProjectCaches();</TD></TR><TR><TD CLASS="l">775</TD><TD> </TD></TR><TR><TD CLASS="l">776</TD><TD> // fire only iff:</TD></TR><TR><TD CLASS="l">777</TD><TD> // - the operation is a top level operation</TD></TR><TR><TD CLASS="l">778</TD><TD> // - the operation did produce some delta(s)</TD></TR><TR><TD CLASS="l">779</TD><TD> // - but the operation has not modified any resource</TD></TR><TR CLASS="z"><TD CLASS="l">780</TD><TD> if (this.isTopLevelOperation()) {</TD></TR><TR CLASS="z"><TD CLASS="l">781</TD><TD> if ((deltaProcessor.javaModelDeltas.size() > previousDeltaCount || !deltaProcessor.reconcileDeltas.isEmpty())</TD></TR><TR CLASS="z"><TD CLASS="l">782</TD><TD> && !this.hasModifiedResource()) {</TD></TR><TR CLASS="z"><TD CLASS="l">783</TD><TD> deltaProcessor.fire(null, DeltaProcessor.DEFAULT_CHANGE_EVENT);</TD></TR><TR><TD CLASS="l">784</TD><TD> } // else deltas are fired while processing the resource delta</TD></TR><TR><TD CLASS="l">785</TD><TD> }</TD></TR><TR CLASS="z"><TD CLASS="l">786</TD><TD> } finally {</TD></TR><TR CLASS="z"><TD CLASS="l">787</TD><TD> popOperation();</TD></TR><TR CLASS="z"><TD CLASS="l">788</TD><TD> }</TD></TR><TR CLASS="z"><TD CLASS="l">789</TD><TD> }</TD></TR><TR CLASS="z"><TD CLASS="l">790</TD><TD> }</TD></TR><TR><TD CLASS="l">791</TD><TD> /**</TD></TR><TR><TD CLASS="l"><A NAME="35">792</A></TD><TD> * Main entry point for Java Model operations. Runs a Java Model Operation as an IWorkspaceRunnable</TD></TR><TR><TD CLASS="l">793</TD><TD> * if not read-only.</TD></TR><TR><TD CLASS="l">794</TD><TD> */</TD></TR><TR><TD CLASS="l">795</TD><TD> public void runOperation(IProgressMonitor monitor) throws JavaScriptModelException {</TD></TR><TR CLASS="z"><TD CLASS="l">796</TD><TD> IJavaScriptModelStatus status= verify();</TD></TR><TR CLASS="z"><TD CLASS="l">797</TD><TD> if (!status.isOK()) {</TD></TR><TR CLASS="z"><TD CLASS="l">798</TD><TD> throw new JavaScriptModelException(status);</TD></TR><TR><TD CLASS="l">799</TD><TD> }</TD></TR><TR><TD CLASS="l">800</TD><TD> try {</TD></TR><TR CLASS="z"><TD CLASS="l">801</TD><TD> if (isReadOnly()) {</TD></TR><TR CLASS="z"><TD CLASS="l">802</TD><TD> run(monitor);</TD></TR><TR><TD CLASS="l">803</TD><TD> } else {</TD></TR><TR><TD CLASS="l">804</TD><TD> // Use IWorkspace.run(...) to ensure that a build will be done in autobuild mode.</TD></TR><TR><TD CLASS="l">805</TD><TD> // Note that if the tree is locked, this will throw a CoreException, but this is ok</TD></TR><TR><TD CLASS="l">806</TD><TD> // as this operation is modifying the tree (not read-only) and a CoreException will be thrown anyway.</TD></TR><TR CLASS="z"><TD CLASS="l">807</TD><TD> ResourcesPlugin.getWorkspace().run(this, getSchedulingRule(), IWorkspace.AVOID_UPDATE, monitor);</TD></TR><TR><TD CLASS="l">808</TD><TD> }</TD></TR><TR CLASS="z"><TD CLASS="l">809</TD><TD> } catch (CoreException ce) {</TD></TR><TR CLASS="z"><TD CLASS="l">810</TD><TD> if (ce instanceof JavaScriptModelException) {</TD></TR><TR CLASS="z"><TD CLASS="l">811</TD><TD> throw (JavaScriptModelException)ce;</TD></TR><TR><TD CLASS="l">812</TD><TD> } else {</TD></TR><TR CLASS="z"><TD CLASS="l">813</TD><TD> if (ce.getStatus().getCode() == IResourceStatus.OPERATION_FAILED) {</TD></TR><TR CLASS="z"><TD CLASS="l">814</TD><TD> Throwable e= ce.getStatus().getException();</TD></TR><TR CLASS="z"><TD CLASS="l">815</TD><TD> if (e instanceof JavaScriptModelException) {</TD></TR><TR CLASS="z"><TD CLASS="l">816</TD><TD> throw (JavaScriptModelException) e;</TD></TR><TR><TD CLASS="l">817</TD><TD> }</TD></TR><TR><TD CLASS="l">818</TD><TD> }</TD></TR><TR CLASS="z"><TD CLASS="l">819</TD><TD> throw new JavaScriptModelException(ce);</TD></TR><TR><TD CLASS="l"><A NAME="36">820</A></TD><TD> }</TD></TR><TR><TD CLASS="l">821</TD><TD> }</TD></TR><TR CLASS="z"><TD CLASS="l">822</TD><TD> }</TD></TR><TR><TD CLASS="l">823</TD><TD> protected void runPostActions() throws JavaScriptModelException {</TD></TR><TR CLASS="z"><TD CLASS="l">824</TD><TD> while (this.actionsStart <= this.actionsEnd) {</TD></TR><TR CLASS="z"><TD CLASS="l">825</TD><TD> IPostAction postAction = this.actions[this.actionsStart++];</TD></TR><TR CLASS="z"><TD CLASS="l">826</TD><TD> if (POST_ACTION_VERBOSE) {</TD></TR><TR CLASS="z"><TD CLASS="l">827</TD><TD> System.out.println("(" + Thread.currentThread() + ") [JavaModelOperation.runPostActions()] Running action " + postAction.getID()); //$NON-NLS-1$ //$NON-NLS-2$</TD></TR><TR><TD CLASS="l">828</TD><TD> }</TD></TR><TR CLASS="z"><TD CLASS="l">829</TD><TD> postAction.run();</TD></TR><TR><TD CLASS="l">830</TD><TD> }</TD></TR><TR CLASS="z"><TD CLASS="l">831</TD><TD> }</TD></TR><TR><TD CLASS="l"><A NAME="37">832</A></TD><TD> /*</TD></TR><TR><TD CLASS="l">833</TD><TD> * Registers the given attribute at the given key with the top level operation.</TD></TR><TR><TD CLASS="l">834</TD><TD> */</TD></TR><TR><TD CLASS="l">835</TD><TD> protected static void setAttribute(Object key, Object attribute) {</TD></TR><TR CLASS="z"><TD CLASS="l">836</TD><TD> ArrayList operationStack = getCurrentOperationStack();</TD></TR><TR CLASS="z"><TD CLASS="l">837</TD><TD> if (operationStack.size() == 0)</TD></TR><TR CLASS="z"><TD CLASS="l">838</TD><TD> return;</TD></TR><TR CLASS="z"><TD CLASS="l">839</TD><TD> JavaModelOperation topLevelOp = (JavaModelOperation) operationStack.get(0);</TD></TR><TR CLASS="z"><TD CLASS="l">840</TD><TD> if (topLevelOp.attributes == null) {</TD></TR><TR CLASS="z"><TD CLASS="l">841</TD><TD> topLevelOp.attributes = new HashMap();</TD></TR><TR><TD CLASS="l">842</TD><TD> }</TD></TR><TR CLASS="z"><TD CLASS="l">843</TD><TD> topLevelOp.attributes.put(key, attribute);</TD></TR><TR CLASS="z"><TD CLASS="l">844</TD><TD> }</TD></TR><TR><TD CLASS="l"><A NAME="38">845</A></TD><TD> /**</TD></TR><TR><TD CLASS="l">846</TD><TD> * @see IProgressMonitor</TD></TR><TR><TD CLASS="l">847</TD><TD> */</TD></TR><TR><TD CLASS="l">848</TD><TD> public void setCanceled(boolean b) {</TD></TR><TR CLASS="z"><TD CLASS="l">849</TD><TD> if (progressMonitor != null) {</TD></TR><TR CLASS="z"><TD CLASS="l">850</TD><TD> progressMonitor.setCanceled(b);</TD></TR><TR><TD CLASS="l">851</TD><TD> }</TD></TR><TR CLASS="z"><TD CLASS="l">852</TD><TD> }</TD></TR><TR><TD CLASS="l">853</TD><TD> /**</TD></TR><TR><TD CLASS="l"><A NAME="39">854</A></TD><TD> * Sets whether this operation is nested or not.</TD></TR><TR><TD CLASS="l">855</TD><TD> * @see CreateElementInCUOperation#checkCanceled</TD></TR><TR><TD CLASS="l">856</TD><TD> */</TD></TR><TR><TD CLASS="l">857</TD><TD> protected void setNested(boolean nested) {</TD></TR><TR CLASS="z"><TD CLASS="l">858</TD><TD> isNested = nested;</TD></TR><TR CLASS="z"><TD CLASS="l">859</TD><TD> }</TD></TR><TR><TD CLASS="l"><A NAME="3a">860</A></TD><TD> /**</TD></TR><TR><TD CLASS="l">861</TD><TD> * @see IProgressMonitor</TD></TR><TR><TD CLASS="l">862</TD><TD> */</TD></TR><TR><TD CLASS="l">863</TD><TD> public void setTaskName(String name) {</TD></TR><TR CLASS="z"><TD CLASS="l">864</TD><TD> if (progressMonitor != null) {</TD></TR><TR CLASS="z"><TD CLASS="l">865</TD><TD> progressMonitor.setTaskName(name);</TD></TR><TR><TD CLASS="l">866</TD><TD> }</TD></TR><TR CLASS="z"><TD CLASS="l">867</TD><TD> }</TD></TR><TR><TD CLASS="l"><A NAME="3b">868</A></TD><TD> /**</TD></TR><TR><TD CLASS="l">869</TD><TD> * @see IProgressMonitor</TD></TR><TR><TD CLASS="l">870</TD><TD> */</TD></TR><TR><TD CLASS="l">871</TD><TD> public void subTask(String name) {</TD></TR><TR CLASS="z"><TD CLASS="l">872</TD><TD> if (progressMonitor != null) {</TD></TR><TR CLASS="z"><TD CLASS="l">873</TD><TD> progressMonitor.subTask(name);</TD></TR><TR><TD CLASS="l">874</TD><TD> }</TD></TR><TR CLASS="z"><TD CLASS="l">875</TD><TD> }</TD></TR><TR><TD CLASS="l">876</TD><TD> /**</TD></TR><TR><TD CLASS="l">877</TD><TD> * Returns a status indicating if there is any known reason</TD></TR><TR><TD CLASS="l">878</TD><TD> * this operation will fail. Operations are verified before they</TD></TR><TR><TD CLASS="l">879</TD><TD> * are run.</TD></TR><TR><TD CLASS="l">880</TD><TD> *</TD></TR><TR><TD CLASS="l">881</TD><TD> * Subclasses must override if they have any conditions to verify</TD></TR><TR><TD CLASS="l">882</TD><TD> * before this operation executes.</TD></TR><TR><TD CLASS="l"><A NAME="3c">883</A></TD><TD> *</TD></TR><TR><TD CLASS="l">884</TD><TD> * @see IJavaScriptModelStatus</TD></TR><TR><TD CLASS="l">885</TD><TD> */</TD></TR><TR><TD CLASS="l">886</TD><TD> protected IJavaScriptModelStatus verify() {</TD></TR><TR CLASS="z"><TD CLASS="l">887</TD><TD> return commonVerify();</TD></TR><TR><TD CLASS="l">888</TD><TD> }</TD></TR><TR><TD CLASS="l">889</TD><TD> </TD></TR><TR><TD CLASS="l"><A NAME="3d">890</A></TD><TD> /**</TD></TR><TR><TD CLASS="l">891</TD><TD> * @see IProgressMonitor</TD></TR><TR><TD CLASS="l">892</TD><TD> */</TD></TR><TR><TD CLASS="l">893</TD><TD> public void worked(int work) {</TD></TR><TR CLASS="z"><TD CLASS="l">894</TD><TD> if (progressMonitor != null) {</TD></TR><TR CLASS="z"><TD CLASS="l">895</TD><TD> progressMonitor.worked(work);</TD></TR><TR CLASS="z"><TD CLASS="l">896</TD><TD> checkCanceled();</TD></TR><TR><TD CLASS="l">897</TD><TD> }</TD></TR><TR CLASS="z"><TD CLASS="l">898</TD><TD> }</TD></TR><TR><TD CLASS="l">899</TD><TD>}</TD></TR></TABLE><P></P><TABLE CLASS="hdft" CELLSPACING="0" WIDTH="100%"><TR><TD CLASS="nv">[<A HREF="../xslUnitTestCoverage.html">all classes</A>][<A HREF="124.html">org.eclipse.wst.jsdt.internal.core</A>]</TD></TR><TR><TD CLASS="tl"><A HREF="http://www.eclemma.org/support.html">EMMA 2.0.5312 EclEmma Fix 1</A> (C) Vladimir Roubtsov</TD></TR></TABLE></BODY></HTML>
\ No newline at end of file |