I've just completed a new eclipse helios install and I am wondering why the autocompletion is not working properly; in my older versions (ganymede/galileo) it was.
It's working for simple functions and class-methods but:
It doesn't know methods which have been inherited from other classes
It won't show autocompletion for chained methods which return $this.
For instance:
class y
{
protected $_a;
public function setA($a)
{
$this->_a = $a;
return $this;
}
}
class x extends y
{
protected $_b;
public function setB($b)
{
$this->_b = $b;
return $this;
}
}
$x = new x;
$x->[AUTOCOMPLETION]
Here [AUTOCOMPLETION] only shows the methods directly implemented in x, but not the methods of y.
When I do:
$x->setB(123)
->[AUTOCOMPLETION]
...the autocompletion doesn't work at all. Both of these cases worked great in my previous versions. So what's wrong? Did I mis-configure something?
work ok on Mac. it shows both setA and setB
Post a bug report in bugzilla
https://bugs.eclipse.org/bugs/enter_bug.cgi?product=PDT
it turned out that the version I was using was bugged. Eclipse 3.7.2 works fine again.
Related
I have tested symfony3 with both eclipse and netbeans IDE and I still don't manage to get autocompletion...
Here is my controller:
<?php
// src/OC/PlatformBundle/Controller/AdvertController.php
namespace OC\PlatformBundle\Controller;
// N'oubliez pas ce use :
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Response;
class AdvertController extends Controller
{
public function indexAction()
{
$content = $this->get('templating')->render('OCPlatformBundle:Advert:index.html.twig');
return new Response($content);
}
}
In Eclipse I can have autocomplete for $this (then I have get as a choice), but I never get the render method with autocompletion..
I looked at this Preserving auto-completion abilities with Symfony2 Dependency Injection but I couldn't get it working.
Can anyone help me with my example please?
Try this:
public function indexAction()
{
/** #var $twig \Symfony\Bundle\TwigBundle\TwigEngine */
$twig = $this->get('templating');
$content = $twig->render('OCPlatformBundle:Advert:index.html.twig');;
return new Response($content);
}
Maybe you need to adjust the comment hint but it should work.
But my advice would be: Get PhpStorm with the symfony Plugin (i know it's not free but give the trial a try and decide if it's worth it)
Working on a GWT project (2.7.0), i have experienced a very odd client code behaviour.
The following code throws the error "SEVERE: (ReferenceError) : Ljava_io_Serializable_2_classLit_0_g$ is not definedcom.google.gwt.core.client.JavaScriptException: (ReferenceError) : Ljava_io_Serializable_2_classLit_0_g$ is not defined".
The error occurs, when calling Arrays.asList() with a parameter, that has an interface type.
Is this expected behaviour or a GWT bug?
// Working
Integer n1 = 1;
Arrays.asList(n1);
// Not working
Serializable n2 = 1;
Arrays.asList(n2);
GWT 2.7's Super Dev Mode (and from the _g$ in your class literal field, I think that is what you are using) has been observed having other issues like this, but when compiled the issues go away.
If this is indeed what you are seeing, the issue seems to be fixed in 2.8, not yet released: https://groups.google.com/d/topic/google-web-toolkit/RzsjqX2gGd4/discussion
This behavior is definitely not expected, but if you can confirm that this works correctly when compiled for production and in GWT 2.8, then we at least know the bug is fixed.
Well, the typical use of Arrays.asList would be
Object myObj = new Object();
List theList = Arrays.asList(new Object[] {myObj});
This works in GWT with any kind of interface/class/enum you throw at it.
EDIT : I've tested this with GWT 2.5.1 :
public class Foo implements EntryPoint {
public static interface MyInterface {
}
public static class MyObject implements MyInterface {
}
public void onModuleLoad() {
MyInterface myObject = new MyObject();
List<MyInterface> myList = Arrays.asList(myObject);
}
}
Isn't it possible that the problem lies somewhere else?
Using JMockIt 1.12 and Eclipse Luna and I get "The allocated object is never used" errors.
I tried:
#Test
public void testNullCase() {
new NonStrictExpectations() {{
TestClass.getPlug();
result = null;
}
...
};
To use SuppressWarnings I had to use something ugly like this:
#Test
public void testNullCase() {
#SuppressWarnings("unused")
NonStrictExpectations dummy = new NonStrictExpectations() {{
TestClass.getPlug();
result = null;
}
...
};
How to do this in a nicer way or am I missing something using JMockIt?
This warning can be turned off via:
opening the dialog Window/Preferences
going to section Java/Compiler/Errors&Warnings/Potential Programming problems
disabling Unused object allocation.
If you want to make that change persistent outside a particular Eclipse workspace, you can use the workspace mechanic. Or you could move the #SuppressWarnings("unused") to the test class to disable it for all tests in the class.
So I'm testing an eclipse plugin with SWTbot and I'm not getting the result I'm expect - when I cut the test down it turns out that the problem isn't with the bot it's with some code that I've copied accross from another part of the program (where it was fully functional)
The following code...
#RunWith(SWTBotJunit4ClassRunner.class)
public class Tests {
private static SWTWorkbenchBot bot;
#BeforeClass
public static void beforeClass() throws Exception {
bot = new SWTWorkbenchBot();
bot.viewByTitle("Welcome").close();
}
#Test
public void maybeThisWillWork(){
IWorkbenchWindow activeWorkbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
System.out.println("A");
IWorkbenchPage activePage = activeWorkbenchWindow.getActivePage();
System.out.println("B");
}
#AfterClass
public static void sleep() {
System.out.println("In the sleep function");
bot.sleep(10000);
}
}
Gives me the output -
A
In the sleep function
Rather than the expected
A
B
In the sleep function
Any ideas?
you may need to run your test as JUnit plugin test. Have you tried that?
So it turns out that the answer is thus (also a nice advantage of stackoverflow is that I actually solved this somewhere else, remembered I'd had a similar problem and then had to come back to stackoverflow to remind myself of the details)
SWTBot isn't running in the UI thread proper hence the null pointer errors, what I had to do was use effectively:
Display display = bot.getDisplay();
display.syncExec(objectThatdoesthethingiwanttogetdoneintheUIthread);
System.out.println(objectThatdoesthethingiwanttogetdoneintheUIthread.results);
...and that got things working...
How should Zend_Validator_StringLength extended?
MyValidator:
class Zend_Validate_StringLengthNoTags extends Zend_Validate_StringLength {
public function __construct($options = array()) {
parent::__construct($options);
}
public function isValid($value) {
return parent::isValid(trim(strip_tags($value)));
}
}
Use of validator - bug not assign values to $this->_min, $this->_max:
$text->addValidator(new Zend_Validator_StringLengthNoTags(array('max'=>4,'min'=>2)));
Edit:
root of bug: $this->_min==1, $this->_max==null ,
but it should be
$this->_min==2, $this->_max==4
Update: the answer:
This was internal application system problem that generate this bug, it fixed soo the code above working. Thanks for all peaple they try to help me.
Thanks
It seems that your Zend_Validate_StringLengthNoTags could be replaced simply by filters StripTags and StringTrim and standard Zend_Validate_StringLength validator.
For example, I think that the following would work the same as your validator:
$text->setFilters(array('stripTags','stringTrim'));
$text->addValidator(new Zend_Validator_StringLength(array('max'=>4,'min'=>2)));
The reason is that validation in Zend Framework is performed after filtering, i.e. on filtered data.
Returning to your Zend_Validate_StringLengthNoTags code. The code looks ok and I cannot spote a problem with it.