List of usage examples for org.aspectj.asm.internal ProgramElement genAccessibility
public static IProgramElement.Accessibility genAccessibility(int modifiers)
From source file:org.eclipse.ajdt.ui.tests.editor.contentassist.PetClinicTests.java
License:Open Source License
/** * Tests that ITDs that are not visible in the current * scope do not appear as content assist proposals */// w w w. j a v a 2s . c om public void testPrivateContentAssistShouldAppear() throws Exception { MockCompletionRequestor requestor = new MockCompletionRequestor(); // check that itds are inserted int offset = entityAspectContents.indexOf("this.") + "this.".length(); entityAspect.codeComplete(offset, requestor, AJWorkingCopyOwner.INSTANCE); // should see the id proposal. It is private, but declared in this aspect CompletionProposal idProposal = null; for (Iterator acceptedIter = requestor.accepted.iterator(); acceptedIter.hasNext();) { CompletionProposal proposal = (CompletionProposal) acceptedIter.next(); if (new String(proposal.getName()).equals("id")) { idProposal = proposal; } } assertNotNull("Should have found the 'id' proposal because it is private, but declared in this aspect", idProposal); assertTrue("Proposal should be marked as Package Protected", ProgramElement.genAccessibility(idProposal.getFlags()) == Accessibility.PRIVATE); }
From source file:org.eclipse.ajdt.ui.tests.editor.contentassist.PetClinicTests.java
License:Open Source License
public void testPackageProtectedContentAssistShouldAppear() throws Exception { MockCompletionRequestor requestor = new MockCompletionRequestor(); // check that itds are inserted int offset = ownerUnitContents.indexOf("this.") + "this.".length(); ownerUnit.codeComplete(offset, requestor, AJWorkingCopyOwner.INSTANCE); // should see the entityManager proposal. It is package protected in an ITD in the same package CompletionProposal entityManagerProposal = null; for (Iterator acceptedIter = requestor.accepted.iterator(); acceptedIter.hasNext();) { CompletionProposal proposal = (CompletionProposal) acceptedIter.next(); if (new String(proposal.getName()).equals("entityManager")) { entityManagerProposal = proposal; }/*from ww w. j ava 2 s . c o m*/ } assertNotNull("Should have found the 'entityManager' proposal because it is package protected", entityManagerProposal); assertTrue("Proposal should be marked as Package Protected", ProgramElement.genAccessibility(entityManagerProposal.getFlags()) == Accessibility.PACKAGE); }
From source file:org.eclipse.ajdt.ui.tests.editor.contentassist.PetClinicTests.java
License:Open Source License
public void testPublicContentAssistShouldAppear() throws Exception { MockCompletionRequestor requestor = new MockCompletionRequestor(); // check that itds are inserted int offset = ownerControllerContents.indexOf("new Owner().") + "new Owner().".length(); ownerController.codeComplete(offset, requestor, AJWorkingCopyOwner.INSTANCE); // should see the entityManager proposal. It is package protected in an ITD in the same package CompletionProposal getAddressProposal = null; for (Iterator acceptedIter = requestor.accepted.iterator(); acceptedIter.hasNext();) { CompletionProposal proposal = (CompletionProposal) acceptedIter.next(); if (new String(proposal.getName()).equals("getAddress")) { getAddressProposal = proposal; }/* w ww .j ava 2 s .c o m*/ } assertNotNull("Should have found the 'getAddress' proposal because it is public", getAddressProposal); assertTrue("Proposal should be marked as Public", ProgramElement.genAccessibility(getAddressProposal.getFlags()) == Accessibility.PUBLIC); }