use of com.google.inject.Inject in project che by eclipse.
the class ExtensionRegistryGenerator method generateImports.
/**
* Inject imports
*
* @param extensions
* @param composerFactory
*/
private void generateImports(List<JClassType> extensions, ClassSourceFileComposerFactory composerFactory) {
// imports
composerFactory.addImport(GWT.class.getCanonicalName());
composerFactory.addImport(Extension.class.getCanonicalName());
composerFactory.addImport(ExtensionRegistry.class.getCanonicalName());
composerFactory.addImport(Inject.class.getCanonicalName());
composerFactory.addImport(Provider.class.getCanonicalName());
composerFactory.addImport(List.class.getCanonicalName());
composerFactory.addImport(ArrayList.class.getCanonicalName());
composerFactory.addImport(Map.class.getCanonicalName());
composerFactory.addImport(HashMap.class.getCanonicalName());
// import for extensions
for (JClassType jClassType : extensions) {
composerFactory.addImport(jClassType.getQualifiedSourceName());
}
}
use of com.google.inject.Inject in project che by eclipse.
the class JavaExtension method prepareActions.
@Inject
private void prepareActions(NewPackageAction newPackageAction, KeyBindingAgent keyBinding, NewJavaSourceFileAction newJavaSourceFileAction, ActionManager actionManager, ProjectClasspathAction projectClasspathAction, MoveAction moveAction, CutJavaSourceAction cutAction, FileStructureAction fileStructureAction, MarkDirAsSourceAction markDirAsSourceAction, UnmarkDirAsSourceAction unmarkDirAsSourceAction, MarkDirectoryAsGroup markDirectoryAsGroup, OrganizeImportsAction organizeImportsAction, RenameRefactoringAction renameRefactoringAction, QuickDocumentationAction quickDocumentationAction, QuickFixAction quickFixAction, OpenDeclarationAction openDeclarationAction, OpenImplementationAction openImplementationAction, FindUsagesAction findUsagesAction, ParametersHintsAction parametersHintsAction) {
DefaultActionGroup newGroup = (DefaultActionGroup) actionManager.getAction(GROUP_FILE_NEW);
actionManager.registerAction("newJavaClass", newJavaSourceFileAction);
newGroup.add(newJavaSourceFileAction, Constraints.FIRST);
actionManager.registerAction("newJavaPackage", newPackageAction);
newGroup.add(newPackageAction, new Constraints(Anchor.AFTER, "newJavaClass"));
DefaultActionGroup refactorGroup = (DefaultActionGroup) actionManager.getAction(GROUP_ASSISTANT_REFACTORING);
if (refactorGroup == null) {
refactorGroup = new DefaultActionGroup("Refactoring", true, actionManager);
actionManager.registerAction(GROUP_ASSISTANT_REFACTORING, refactorGroup);
}
DefaultActionGroup projectGroup = (DefaultActionGroup) actionManager.getAction(GROUP_PROJECT);
actionManager.registerAction("projectProperties", projectClasspathAction);
projectGroup.add(projectClasspathAction, new Constraints(Anchor.LAST, null));
DefaultActionGroup assistantGroup = (DefaultActionGroup) actionManager.getAction(GROUP_ASSISTANT);
refactorGroup.addSeparator();
refactorGroup.add(moveAction);
refactorGroup.add(renameRefactoringAction);
assistantGroup.add(refactorGroup, new Constraints(Anchor.BEFORE, "updateDependency"));
actionManager.registerAction(SHOW_QUICK_DOC, quickDocumentationAction);
actionManager.registerAction(OPEN_JAVA_DECLARATION, openDeclarationAction);
actionManager.registerAction(OPEN_IMPLEMENTATION, openImplementationAction);
actionManager.registerAction(JAVA_RENAME_REFACTORING, renameRefactoringAction);
actionManager.registerAction(JAVA_MOVE_REFACTORING, moveAction);
actionManager.registerAction(JAVA_CUT_REFACTORING, cutAction);
actionManager.registerAction(JAVA_FIND_USAGES, findUsagesAction);
actionManager.registerAction(JAVA_CLASS_STRUCTURE, fileStructureAction);
actionManager.registerAction(ORGANIZE_IMPORTS, organizeImportsAction);
actionManager.registerAction(PARAMETERS_INFO, parametersHintsAction);
actionManager.registerAction(QUICK_FIX, quickFixAction);
assistantGroup.add(quickDocumentationAction, new Constraints(Anchor.BEFORE, GROUP_ASSISTANT_REFACTORING));
assistantGroup.add(quickFixAction, new Constraints(Anchor.BEFORE, GROUP_ASSISTANT_REFACTORING));
assistantGroup.add(openDeclarationAction, new Constraints(Anchor.BEFORE, GROUP_ASSISTANT_REFACTORING));
assistantGroup.add(organizeImportsAction, new Constraints(Anchor.BEFORE, GROUP_ASSISTANT_REFACTORING));
assistantGroup.add(openImplementationAction, new Constraints(Anchor.BEFORE, GROUP_ASSISTANT_REFACTORING));
assistantGroup.add(fileStructureAction, new Constraints(Anchor.BEFORE, GROUP_ASSISTANT_REFACTORING));
assistantGroup.add(findUsagesAction, new Constraints(Anchor.BEFORE, GROUP_ASSISTANT_REFACTORING));
//Configure Build Path action group
actionManager.registerAction("markDirectoryAsSourceGroup", markDirectoryAsGroup);
actionManager.registerAction("markDirectoryAsSource", markDirAsSourceAction);
actionManager.registerAction("unmarkDirectoryAsSource", unmarkDirAsSourceAction);
markDirectoryAsGroup.add(markDirAsSourceAction);
markDirectoryAsGroup.add(unmarkDirAsSourceAction);
markDirectoryAsGroup.add(projectClasspathAction);
DefaultActionGroup mainContextMenuGroup = (DefaultActionGroup) actionManager.getAction("resourceOperation");
mainContextMenuGroup.addSeparator();
mainContextMenuGroup.add(markDirectoryAsGroup);
mainContextMenuGroup.addSeparator();
DefaultActionGroup editorContextMenuGroup = (DefaultActionGroup) actionManager.getAction(IdeActions.GROUP_EDITOR_CONTEXT_MENU);
editorContextMenuGroup.add(quickDocumentationAction, new Constraints(Anchor.AFTER, "format"));
editorContextMenuGroup.add(quickFixAction, new Constraints(Anchor.AFTER, SHOW_QUICK_DOC));
editorContextMenuGroup.add(openDeclarationAction, new Constraints(Anchor.AFTER, QUICK_FIX));
editorContextMenuGroup.add(refactorGroup, new Constraints(Anchor.AFTER, OPEN_JAVA_DECLARATION));
editorContextMenuGroup.add(fileStructureAction, new Constraints(Anchor.AFTER, GROUP_ASSISTANT_REFACTORING));
if (UserAgent.isMac()) {
keyBinding.getGlobal().addKey(new KeyBuilder().alt().control().charCode('b').build(), OPEN_IMPLEMENTATION);
keyBinding.getGlobal().addKey(new KeyBuilder().control().charCode('j').build(), SHOW_QUICK_DOC);
keyBinding.getGlobal().addKey(new KeyBuilder().control().charCode(KeyCodeMap.F12).build(), JAVA_CLASS_STRUCTURE);
keyBinding.getGlobal().addKey(new KeyBuilder().alt().control().charCode('o').build(), ORGANIZE_IMPORTS);
keyBinding.getGlobal().addKey(new KeyBuilder().control().charCode('p').build(), PARAMETERS_INFO);
keyBinding.getGlobal().addKey(new KeyBuilder().action().charCode(KeyCodeMap.ENTER).build(), QUICK_FIX);
} else {
keyBinding.getGlobal().addKey(new KeyBuilder().alt().action().charCode('b').build(), OPEN_IMPLEMENTATION);
keyBinding.getGlobal().addKey(new KeyBuilder().action().charCode('q').build(), SHOW_QUICK_DOC);
keyBinding.getGlobal().addKey(new KeyBuilder().action().charCode(KeyCodeMap.F12).build(), JAVA_CLASS_STRUCTURE);
keyBinding.getGlobal().addKey(new KeyBuilder().alt().action().charCode('o').build(), ORGANIZE_IMPORTS);
keyBinding.getGlobal().addKey(new KeyBuilder().action().charCode('p').build(), PARAMETERS_INFO);
keyBinding.getGlobal().addKey(new KeyBuilder().alt().charCode(KeyCodeMap.ENTER).build(), QUICK_FIX);
}
keyBinding.getGlobal().addKey(new KeyBuilder().none().charCode(KeyCodeMap.F4).build(), OPEN_JAVA_DECLARATION);
keyBinding.getGlobal().addKey(new KeyBuilder().shift().charCode(KeyCodeMap.F6).build(), JAVA_RENAME_REFACTORING);
keyBinding.getGlobal().addKey(new KeyBuilder().action().charCode('x').build(), JAVA_CUT_REFACTORING);
keyBinding.getGlobal().addKey(new KeyBuilder().charCode(KeyCodeMap.F6).build(), JAVA_MOVE_REFACTORING);
keyBinding.getGlobal().addKey(new KeyBuilder().alt().charCode(KeyCodeMap.F7).build(), JAVA_FIND_USAGES);
}
use of com.google.inject.Inject in project che by eclipse.
the class LanguageServerExtension method registerAction.
@Inject
protected void registerAction(ActionManager actionManager, KeyBindingAgent keyBindingManager, GoToSymbolAction goToSymbolAction, FindSymbolAction findSymbolAction, FindDefinitionAction findDefinitionAction, FindReferencesAction findReferencesAction) {
actionManager.registerAction("LSGoToSymbolAction", goToSymbolAction);
actionManager.registerAction("LSFindSymbolAction", findSymbolAction);
actionManager.registerAction("LSFindDefinitionAction", findDefinitionAction);
actionManager.registerAction("LSFindReferencesAction", findReferencesAction);
DefaultActionGroup assistantGroup = (DefaultActionGroup) actionManager.getAction(GROUP_ASSISTANT);
assistantGroup.add(goToSymbolAction, new Constraints(Anchor.BEFORE, GROUP_ASSISTANT_REFACTORING));
assistantGroup.add(findSymbolAction, new Constraints(Anchor.BEFORE, GROUP_ASSISTANT_REFACTORING));
assistantGroup.add(findDefinitionAction, new Constraints(Anchor.BEFORE, GROUP_ASSISTANT_REFACTORING));
assistantGroup.add(findReferencesAction, new Constraints(Anchor.BEFORE, GROUP_ASSISTANT_REFACTORING));
if (UserAgent.isMac()) {
keyBindingManager.getGlobal().addKey(new KeyBuilder().control().charCode(KeyCodeMap.F12).build(), "LSGoToSymbolAction");
} else {
keyBindingManager.getGlobal().addKey(new KeyBuilder().action().charCode(KeyCodeMap.F12).build(), "LSGoToSymbolAction");
}
keyBindingManager.getGlobal().addKey(new KeyBuilder().alt().charCode('n').build(), "LSFindSymbolAction");
keyBindingManager.getGlobal().addKey(new KeyBuilder().alt().charCode(KeyCodeMap.F7).build(), "LSFindReferencesAction");
keyBindingManager.getGlobal().addKey(new KeyBuilder().charCode(KeyCodeMap.F4).build(), "LSFindDefinitionAction");
}
use of com.google.inject.Inject in project che by eclipse.
the class NodeJsExtension method prepareActions.
@Inject
private void prepareActions(ActionManager actionManager, NodeJsResources resources, IconRegistry iconRegistry, NewNodeJsFileAction newFileAction) {
DefaultActionGroup newGroup = (DefaultActionGroup) actionManager.getAction(GROUP_FILE_NEW);
actionManager.registerAction("newNodeJsFile", newFileAction);
newGroup.add(newFileAction, Constraints.FIRST);
iconRegistry.registerIcon(new Icon(NODE_JS_CATEGORY + ".samples.category.icon", resources.jsIcon()));
}
use of com.google.inject.Inject in project che by eclipse.
the class WebExtension method prepareActions.
@Inject
private void prepareActions(WebExtensionResource resources, ActionManager actionManager, NewCssFileAction newCssFileAction, NewLessFileAction newLessFileAction, NewHtmlFileAction newHtmlFileAction, NewJavaScriptFileAction newJavaScriptFileAction, PreviewAction previewAction) {
// register actions
actionManager.registerAction("newCssFile", newCssFileAction);
actionManager.registerAction("newLessFile", newLessFileAction);
actionManager.registerAction("newHtmlFile", newHtmlFileAction);
actionManager.registerAction("newJavaScriptFile", newJavaScriptFileAction);
actionManager.registerAction("previewHTML", previewAction);
// set icons
newCssFileAction.getTemplatePresentation().setSVGResource(resources.cssFile());
newLessFileAction.getTemplatePresentation().setSVGResource(resources.lessFile());
newHtmlFileAction.getTemplatePresentation().setSVGResource(resources.htmlFile());
newJavaScriptFileAction.getTemplatePresentation().setSVGResource(resources.jsFile());
// add actions in main menu
DefaultActionGroup newGroup = (DefaultActionGroup) actionManager.getAction(GROUP_FILE_NEW);
newGroup.add(newCssFileAction);
newGroup.add(newLessFileAction);
newGroup.add(newHtmlFileAction);
newGroup.add(newJavaScriptFileAction);
// add actions in context menu
DefaultActionGroup mainContextMenuGroup = (DefaultActionGroup) actionManager.getAction(GROUP_MAIN_CONTEXT_MENU);
mainContextMenuGroup.add(previewAction);
// add actions in Assistant main menu
DefaultActionGroup assistantMainMenuGroup = (DefaultActionGroup) actionManager.getAction(GROUP_ASSISTANT);
assistantMainMenuGroup.add(previewAction);
}
Aggregations