Skip to content

Instantly share code, notes, and snippets.

View suxiaogang's full-sized avatar
🙄
busy writing bugs

Sam Su suxiaogang

🙄
busy writing bugs
  • NULL
  • UTM Zone 49
View GitHub Profile
@suxiaogang
suxiaogang / getCurrentProject.java
Last active December 15, 2015 15:39
getCurrentProject in plugin dev
public static IProject getCurrentProject(){
ISelectionService selectionService =
Workbench.getInstance().getActiveWorkbenchWindow().getSelectionService();
ISelection selection = selectionService.getSelection();
IProject project = null;
if(selection instanceof IStructuredSelection) {
Object element = ((IStructuredSelection)selection).getFirstElement();
@suxiaogang
suxiaogang / RenameIResource.java
Last active December 15, 2015 15:39
IResource rename in plugin development
protected boolean renameProject(IProject localProject, String newProjectName) {
RenameResourceProcessor renameProcessor = new RenameResourceProcessor(localProject);
renameProcessor.setNewResourceName(newProjectName);
CheckConditionsOperation condictionOperation = new CheckConditionsOperation(new RenameRefactoring(renameProcessor),
CheckConditionsOperation.FINAL_CONDITIONS);
CreateChangeOperation operation = new CreateChangeOperation(condictionOperation,
RefactoringCore.getConditionCheckingFailedSeverity());
PerformChangeOperation performChangeOperation = new PerformChangeOperation(operation);
/**
* Fullscreenr - lightweight full screen background jquery plugin
* By Jan Schneiders
* www.nanotux.com
*
* Modifications by Chris Van Patten
* http://www.vanpattenmedia.com
* Version 1.5
**/