Skip to content

Instantly share code, notes, and snippets.

Avatar

Samuel Santos samueltcsantos

View GitHub Profile
@samueltcsantos
samueltcsantos / operators.py
Created Apr 18, 2014
Operadores aritméticos
View operators.py
'''
Created on 18/04/2014
@author: Samuel T. C. Santos
Operadores Aritmetico em Python
'''
a = 4
b = 5
View functions.py
'''
Created on 18/04/2014
@author: Samuel T. C. Santos
Criando funcoes em Python
'''
def soma(a, b):
return a + b
@samueltcsantos
samueltcsantos / conditional.py
Created Apr 18, 2014
Estrutura condicional em Python
View conditional.py
'''
Created on 18/04/2014
@author: Samuel T. C. Santos
Estrutura de descisao em Python if-else
'''
x = 10
@samueltcsantos
samueltcsantos / SampleHandler.java
Last active Aug 29, 2015
Listando todos os projetos do workspace
View SampleHandler.java
package com.jdt.info.handlers;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;
@samueltcsantos
samueltcsantos / SampleHandler.java
Last active Aug 29, 2015
Criando um IJavaProject
View SampleHandler.java
/**
* Show the project name and create a IJavaProject object.
*
* @see {https://github.com/samueltcsantos/eclipse-jdt}
*
* @param project
* @throws CoreException
*/
private IJavaProject createIJavaProject(IProject project) throws CoreException {
@samueltcsantos
samueltcsantos / SampleHandler.java
Created Apr 19, 2014
Pegar todos os pacotes de um Projeto do Workspace
View SampleHandler.java
/**
* get all packages in the project including the '.jars' packages
*
* @param javaProject
* @return
* @throws JavaModelException
*/
private IPackageFragment [] getProjectPackages(IJavaProject javaProject) throws JavaModelException{
@samueltcsantos
samueltcsantos / SampleHandler.java
Created Apr 19, 2014
Pegar todas as Unidade de Compilação em um pacote.
View SampleHandler.java
/**
* Get all compilation Unit in the package.
*
* @see {https://github.com/samueltcsantos/eclipse-jdt}
*
* @param myPackage
* @return
* @throws JavaModelException
*/
private ICompilationUnit [] getCompilationUnits(IPackageFragment myPackage) throws JavaModelException{
@samueltcsantos
samueltcsantos / SampleHandler.java
Created Apr 19, 2014
Como acessar todos os métodos dentro de uma classe.
View SampleHandler.java
/**
* Get all types in the Compilation Unit.
*
* @see {https://github.com/samueltcsantos/eclipse-jdt}
*
* @param unit
* @return
* @throws JavaModelException
*/
private IType[] getITypes(ICompilationUnit unit) throws JavaModelException{
@samueltcsantos
samueltcsantos / SampleHandler.java
Created Apr 19, 2014
Acessando o nomes dos pacotes com código fonte.
View SampleHandler.java
/**
* the command has been executed, so extract extract the needed information
* from the application context.
*
* @see {https://github.com/samueltcsantos/eclipse-jdt}
*
*/
public Object execute(ExecutionEvent event) throws ExecutionException {
IWorkspace workspace = ResourcesPlugin.getWorkspace();
@samueltcsantos
samueltcsantos / SampleHandler.java
Created Apr 19, 2014
Pegar um projeto específico por nome
View SampleHandler.java
/**
* Get a specific project by project name.
*
* @see {https://github.com/samueltcsantos/eclipse-jdt}
*
* @param projectName
* @return
*/
public IProject getProject(String projectName){
// here root is IWorkspaceRoot from ResourcesPlugin.getWorkspace().getRoot();