• jon-wu
  • NEWBIE
  • 25 Points
  • Member since 2011

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 12
    Replies

I've noticed that code assist isn't working at all for me in Eclipse but after looking through the logs I've realized that it's breaking because it doesn't like the @RemoteAction annotation for JS remoting that I happen to be using almost everywhere. Once I remove all those annotations the code assist and auto complete works fine.

 

This is horribly inconvenient yet seems like it would be easy to fix.

 

Any ways to fix this or workarounds?

 

Here's an example of the error in the IDE log:

 

 

 WARN [2011-07-05 16:14:09,900] (ApexCodeEditor.java:getStatementNear:789) - An error occured while parsing the AST, the last cached version of the AST is being used

apex.parser.ApexParseException: Unknown annotation: RemoteAction

at apex.parser.ApexParser.parseClass(ApexParser.java:61)

at com.salesforce.ide.ui.editors.apex.ast.IdeApexClzParser.parseClass(IdeApexClzParser.java:53)

at com.salesforce.ide.ui.editors.apex.ast.IdeApexClzParser.parse(IdeApexClzParser.java:30)

at com.salesforce.ide.ui.editors.apex.ApexCodeEditor.getStatementNear(ApexCodeEditor.java:786)

at com.salesforce.ide.ui.editors.apex.ApexCodeEditor.getSourceElementAt(ApexCodeEditor.java:745)

at com.salesforce.ide.ui.editors.apex.ApexCodeEditor.computeHighlightRangeSourceReference(ApexCodeEditor.java:741)

at com.salesforce.ide.ui.editors.apex.ApexCodeEditor.selectionChanged(ApexCodeEditor.java:605)

at com.salesforce.ide.ui.editors.apex.ApexCodeEditor$EditorSelectionChangedListener.selectionChanged(ApexCodeEditor.java:598)

at org.eclipse.jface.text.TextViewer.firePostSelectionChanged(TextViewer.java:2745)

at org.eclipse.jface.text.TextViewer.firePostSelectionChanged(TextViewer.java:2693)

at org.eclipse.jface.text.TextViewer$5.run(TextViewer.java:2672)

at org.eclipse.swt.widgets.Display.runTimers(Display.java:3761)

at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3275)

at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2640)

at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2604)

at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2438)

at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:671)

at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)

at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:664)

at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)

at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:115)

at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)

at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)

at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)

at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369)

at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:597)

at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:620)

at org.eclipse.equinox.launcher.Main.basicRun(Main.java:575)

at org.eclipse.equinox.launcher.Main.run(Main.java:1408)

Caused by: apex.ast.Modifiers$ModifierStateException: Unknown annotation: RemoteAction

at apex.ast.Modifiers.setAnnotation(Modifiers.java:83)

at apex.parser.gen.ApexParser.annotation(ApexParser.java:2818)

at apex.parser.gen.ApexParser.modifier(ApexParser.java:2629)

at apex.parser.gen.ApexParser.modifiers(ApexParser.java:2504)

at apex.parser.gen.ApexParser.classBodyDeclaration(ApexParser.java:1152)

at apex.parser.gen.ApexParser.classDeclaration(ApexParser.java:540)

at apex.parser.gen.ApexParser.typeDeclaration(ApexParser.java:376)

at apex.parser.ApexParser.parseClass(ApexParser.java:59)

How can I format a date/time to the user's timezone within an attribute without creating a separate method to do it in the controller?

 

The outputText formatting won't work since I can't put outputText within an attribute since that's not valid XML.

 

For example:

 

<apex:repeat value="{!revisionHistory}" var="history">

   <a href="/{!history.CreatedById}" title="{!history.CreatedDate}">{!history.Name}</a>

</apex:repeat>

 

I want something like the above but I want title to be formatted date AND time in the user's local timezone. It appears you can do this with the date via forumlas but I can't find a way to do this with the date and time without writing a special getter which isn't ideal.

Does Apex support variable arity or varargs?

 

I'm trying to make a flexible JS remoting method that accepts input from a variety of forms and would rather not have to change the signature of my method every time I modify the fields. I was using JSON but the JSONObject class from json.org isn't robust enough and has bugs.

 

Varargs doesn't seem to be supported either. Any ideas? If not it looks like I'll just have to make a bunch of different functions or ditch JS remoting, make a dummy page, and then send a POST to that and pull out the page params.

Can I set my own response headers besides cache and content-type for an <apex:page> or any other pages on the force.com platform?

 

I'd be interested in setting my own headers in general but in this instance I'm trying to proxy a download of a JSON document through Apex with some modifications before it's passed off to the client.

 

I can return the text just fine and force it to download by modifying the Content-Type but without the Content-Disposition header, I can't set the filename which is a non-starter in my case. If I can't get Apex / VF to do this I'll have to setup a proxy outside of Salesforce.

 

Thanks!

  • March 11, 2011
  • Like
  • 0

When JSON support was added in APEX, I was one of those guys who jumped up and down. Started using heavily for one of my integration project and everything was fine and dandy for couple week. Since yesterday, I have been noticing some weired behavior. The first time I noticed it, I thought it was one of those APEX issues I love to call "APEX weirdness" and hoped that it will fix itself (READ: getting fixed without us knowing). That hasn't happened. :(

 

Here is the issue. 

 

My JSON parsing code looks like this:

class SomeApexWrapper {

public static SomeApexWrapper getInstance(String jsonString)

JSONParser parser = JSON.createParser(jsonString);       

SomeApexWrapper w = (SomeApexWrapper) parser.readValueAs(SomeApexWrapper.class);

}

}

 

This code was working fine until two days ago. It stops working If I change any class that uses this class to parse json string. The error I get is "[Source: java.io.StringReader@21363a13; line: 1, column: 1] Don't know the type of the Apex object to deserialize"

 

Just saving the SomeApexWrapper  class again fixes the issue. 

 

Has anyone had/having this issue? Is there a permanent solution for this?

  • November 07, 2011
  • Like
  • 0

I've noticed that code assist isn't working at all for me in Eclipse but after looking through the logs I've realized that it's breaking because it doesn't like the @RemoteAction annotation for JS remoting that I happen to be using almost everywhere. Once I remove all those annotations the code assist and auto complete works fine.

 

This is horribly inconvenient yet seems like it would be easy to fix.

 

Any ways to fix this or workarounds?

 

Here's an example of the error in the IDE log:

 

 

 WARN [2011-07-05 16:14:09,900] (ApexCodeEditor.java:getStatementNear:789) - An error occured while parsing the AST, the last cached version of the AST is being used

apex.parser.ApexParseException: Unknown annotation: RemoteAction

at apex.parser.ApexParser.parseClass(ApexParser.java:61)

at com.salesforce.ide.ui.editors.apex.ast.IdeApexClzParser.parseClass(IdeApexClzParser.java:53)

at com.salesforce.ide.ui.editors.apex.ast.IdeApexClzParser.parse(IdeApexClzParser.java:30)

at com.salesforce.ide.ui.editors.apex.ApexCodeEditor.getStatementNear(ApexCodeEditor.java:786)

at com.salesforce.ide.ui.editors.apex.ApexCodeEditor.getSourceElementAt(ApexCodeEditor.java:745)

at com.salesforce.ide.ui.editors.apex.ApexCodeEditor.computeHighlightRangeSourceReference(ApexCodeEditor.java:741)

at com.salesforce.ide.ui.editors.apex.ApexCodeEditor.selectionChanged(ApexCodeEditor.java:605)

at com.salesforce.ide.ui.editors.apex.ApexCodeEditor$EditorSelectionChangedListener.selectionChanged(ApexCodeEditor.java:598)

at org.eclipse.jface.text.TextViewer.firePostSelectionChanged(TextViewer.java:2745)

at org.eclipse.jface.text.TextViewer.firePostSelectionChanged(TextViewer.java:2693)

at org.eclipse.jface.text.TextViewer$5.run(TextViewer.java:2672)

at org.eclipse.swt.widgets.Display.runTimers(Display.java:3761)

at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3275)

at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2640)

at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2604)

at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2438)

at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:671)

at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)

at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:664)

at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)

at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:115)

at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)

at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)

at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)

at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369)

at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:597)

at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:620)

at org.eclipse.equinox.launcher.Main.basicRun(Main.java:575)

at org.eclipse.equinox.launcher.Main.run(Main.java:1408)

Caused by: apex.ast.Modifiers$ModifierStateException: Unknown annotation: RemoteAction

at apex.ast.Modifiers.setAnnotation(Modifiers.java:83)

at apex.parser.gen.ApexParser.annotation(ApexParser.java:2818)

at apex.parser.gen.ApexParser.modifier(ApexParser.java:2629)

at apex.parser.gen.ApexParser.modifiers(ApexParser.java:2504)

at apex.parser.gen.ApexParser.classBodyDeclaration(ApexParser.java:1152)

at apex.parser.gen.ApexParser.classDeclaration(ApexParser.java:540)

at apex.parser.gen.ApexParser.typeDeclaration(ApexParser.java:376)

at apex.parser.ApexParser.parseClass(ApexParser.java:59)

How can I format a date/time to the user's timezone within an attribute without creating a separate method to do it in the controller?

 

The outputText formatting won't work since I can't put outputText within an attribute since that's not valid XML.

 

For example:

 

<apex:repeat value="{!revisionHistory}" var="history">

   <a href="/{!history.CreatedById}" title="{!history.CreatedDate}">{!history.Name}</a>

</apex:repeat>

 

I want something like the above but I want title to be formatted date AND time in the user's local timezone. It appears you can do this with the date via forumlas but I can't find a way to do this with the date and time without writing a special getter which isn't ideal.

HI,

I want to know that how would i refresh Parent Window on Clicking of Save/Submit button on PopUp window or we can say Child window.

For this I used JavaScript ;

 

<script language="JavaScript" type="text/javascript">
 function CloseAndRefresh(){

      opener.location.reload(true);
      self.close();
  }
</script>

On Submit :

 

<apex:commandButton action="{!save}" onclick="CloseAndRefresh()" value="Save"/>

 

But It doesn't Work .

Please Help ..

  • March 17, 2011
  • Like
  • 0

Can I set my own response headers besides cache and content-type for an <apex:page> or any other pages on the force.com platform?

 

I'd be interested in setting my own headers in general but in this instance I'm trying to proxy a download of a JSON document through Apex with some modifications before it's passed off to the client.

 

I can return the text just fine and force it to download by modifying the Content-Type but without the Content-Disposition header, I can't set the filename which is a non-starter in my case. If I can't get Apex / VF to do this I'll have to setup a proxy outside of Salesforce.

 

Thanks!

  • March 11, 2011
  • Like
  • 0
How could I connect to salesforce in javascritp but without using page login.salesforce.com.? My purpose is then to create a query to the "Lead" entity and incorporated it as a gadget in a business mashup platform test Since I have the customer key and secret key of SalesForceDeveloper. Thanks.

Hi

 

I am trying to check user's id (who has log in) whether it is in my public group or not for Apex managed Sharing. I am able to get the list of all users who are in public group using Group Member Table.

But that does not include the members who have indirect access using role hierarchies (ex: system admins and managers).

 

Can anyone help me out in preparing a list of users/group members who can access the public group in direct or indirect way.

 

Has anyone had any luck unit testing against information in the history table for an object?

 

We have a custom history popup, similar to the SF history display, but generated from scratch in a VisualForce controller.

 

I'm attempting to write some unit tests for the controller.  I am creating and updating an object of a type which has history tracking turned on, but I never get any entries in the history table.  I'm assuming that this is because the history table is populated from a trigger or similar when the transaction commits, and the transaction is rolled back in test mode.

 

I'm going to restructure to the code to get around this from the coverage point of view, but before I do that I'd appreciate it if anyone could confirm that this is the case.

I'm trying to use visualforce to perform the following:
A. Show related lists (and all headings) only if a related record exists.
B. If a related record does not exist, the particular section is not displayed.
 
I'm trying to use the apex:relatedList tag with the rendered attribute.
 
Is it possible to check if the list is empty as a boolean expression within visualforce without having to create a custom controller method? I have a working solution, but if I want to add this functionality for all related lists, it's a lot of extra controller code to write.
 
Thanks in advance.
 
 
VisualForce View Page
<apex:page standardController="Account" extensions="AccountHiddenListController">
    <apex:detail relatedList="false">
        <apex:relatedList list="Opportunities" rendered="{!relatedOpportunitiesExist}">    
        </apex:relatedList>
    </apex:detail>
</apex:page>
 
 
Controller Code:
public class AccountHiddenListController
{
    private final Account account;
    private boolean relatedOpportunitiesExist;
   
    public AccountHiddenListController (ApexPages.StandardController accountController)
    {
        this.account = (Account) accountController.getRecord();
    }
   
    public boolean getRelatedOpportunitiesExist()
    {
        if (this.relatedOpportunitiesExist != null)
        {
            return this.relatedOpportunitiesExist;
        }
   
        List<Opportunity> opp = this.getOpportunitiesList();
        if (opp.size() > 0)
        {
            this.relatedOpportunitiesExist = true;
        }
        else
        {
            this.relatedOpportunitiesExist = false;       
        }
        return this.relatedOpportunitiesExist;
           
    }
   
    public void setRelatedOpportunitiesExist()
    {
   
    }
   
    public List<Opportunity> getOpportunitiesList()
    {
        if (this.account == null)        
            return null;       
        return [select o.id
        from Opportunity o
        where o.AccountId = :account.id];
       
    }
   
}