This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* This is an example of creating an Enyo component for handling calls to an IndexedDB. | |
* This example is pretty basic, the DB is based around a Road object that has | |
* a description and location (unique), the location is used as the key for the record. | |
* | |
* Tested and works in Chrome, however testing in Firefox seems to fail do not know why. | |
*/ | |
enyo.kind({ | |
name: "IndexedDBControl", | |
kind: "Component", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.List; | |
import org.eclipse.jdt.core.ICompilationUnit; | |
import org.eclipse.jdt.core.IJavaElement; | |
import org.eclipse.jdt.core.IJavaProject; | |
import org.eclipse.jdt.core.IPackageFragment; | |
import org.eclipse.jdt.core.IPackageFragmentRoot; | |
public class GetICompilationUnits { | |
public static List<ICompilationUnit> getCompilationUnits(IJavaProject javaProject) { | |
List<ICompilationUnit> units = new LinkedList<ICompilationUnit>(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.eclipse.core.resources.IProject; | |
import org.eclipse.core.resources.IWorkspaceRoot; | |
import org.eclipse.core.resources.ResourcesPlugin; | |
import org.eclipse.core.runtime.CoreException; | |
import org.eclipse.jdt.core.IJavaProject; | |
import org.eclipse.jdt.core.JavaCore; | |
public class EclipseJavaProjects { | |
public static List<IJavaProject> getJavaProjects() { | |
List<IJavaProject> projectList = new LinkedList<IJavaProject>(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.eclipse.jdt.core.dom.ASTNode; | |
import org.eclipse.jdt.core.dom.ASTParser; | |
import org.eclipse.jdt.core.dom.AST; | |
public ASTUtil { | |
public static ASTNode getASTNode(ICompilationUnit unit) { | |
ASTParser parser = ASTParser.newParser(AST.JLS3); | |
parser.setKind(ASTParser.K_COMPILATION_UNIT); | |
parser.setSource(unit); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.eclipse.jdt.core.ICompilationUnit; | |
import org.eclipse.jdt.core.IJavaElement; | |
import org.eclipse.jdt.core.JavaModelException; | |
import org.eclipse.jdt.core.dom.AST; | |
import org.eclipse.jdt.core.dom.ASTNode; | |
import org.eclipse.jdt.core.dom.ASTParser; | |
import org.eclipse.jdt.internal.ui.JavaPlugin; | |
import org.eclipse.jdt.internal.ui.javaeditor.JavaEditor; | |
import org.eclipse.jdt.ui.IWorkingCopyManager; | |
import org.eclipse.jface.text.ITextViewerExtension5; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Uses the fully qualified type name to search the Eclipse Workspace | |
* to find the type's ICompilationUnit | |
*/ | |
public class FindICompilationUnit { | |
public ICompilationUnit unitLookup(String name){ | |
ICompilationUnit unit = null; | |
SearchPattern sp = SearchPattern.createPattern(name, IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_FULL_MATCH); | |
SearchEngine se = new SearchEngine(); | |
UnitRequestor ur = new UnitRequestor(); |