From 770eb38d380e6fedb643bc0c175a3f12a9faaff5 Mon Sep 17 00:00:00 2001 From: Vitaly Parfonov Date: Wed, 30 Mar 2016 12:51:12 +0300 Subject: [PATCH] Add C/C++ project type C/C++ Editor (with syntax highlighter only) Signed-off-by: Vitaly Parfonov --- assembly/assembly-ide-war/pom.xml | 8 ++ .../resources/org/eclipse/che/ide/IDE.gwt.xml | 1 + assembly/assembly-machine-war/pom.xml | 8 ++ .../java/org/eclipse/che/ide/MimeType.java | 5 +- .../presenter/ProjectWizardPresenter.java | 26 ++++-- .../filetype/ExtensionFileTypeIdentifier.java | 2 +- .../che-plugin-cpp-lang-ide/pom.xml | 85 +++++++++++++++++++ .../che/plugin/cpp/ide/CppExtension.java | 69 +++++++++++++++ .../plugin/cpp/ide/CppJsEditorExtension.java | 39 +++++++++ .../cpp/ide/CppLocalizationConstant.java | 48 +++++++++++ .../che/plugin/cpp/ide/CppResources.java | 35 ++++++++ .../ide/action/CreateCSourceFileAction.java | 55 ++++++++++++ .../ide/action/CreateCppSourceFileAction.java | 57 +++++++++++++ .../action/CreateHeaderSourceFileAction.java | 54 ++++++++++++ .../ide/action/NewClikeResourceAction.java | 68 +++++++++++++++ .../cpp/ide/editor/CEditorProvider.java | 61 +++++++++++++ .../cpp/ide/editor/CppEditorProvider.java | 41 +++++++++ .../plugin/cpp/ide/inject/CppGinModule.java | 65 ++++++++++++++ .../ide/project/CProjectWizardRegistrar.java | 54 ++++++++++++ .../project/CppProjectWizardRegistrar.java | 54 ++++++++++++ .../org/eclipse/che/plugin/cpp/Cpp.gwt.xml | 29 +++++++ .../ide/CppLocalizationConstant.properties | 12 +++ .../eclipse/che/plugin/cpp/ide/svg/c_file.svg | 31 +++++++ .../che/plugin/cpp/ide/svg/c_header_file.svg | 29 +++++++ .../che/plugin/cpp/ide/svg/category.svg | 31 +++++++ .../che/plugin/cpp/ide/svg/cpp_file.svg | 31 +++++++ .../che-plugin-cpp-lang-server/pom.xml | 48 +++++++++++ .../che/plugin/cpp/inject/CppModule.java | 31 +++++++ .../plugin/cpp/projecttype/CProjectType.java | 31 +++++++ .../cpp/projecttype/CppProjectType.java | 31 +++++++ .../che-plugin-cpp-lang-shared/pom.xml | 40 +++++++++ .../che/plugin/cpp/shared/Constants.java | 54 ++++++++++++ plugins/plugin-cpp/pom.xml | 41 +++++++++ .../orion/client/orion-codenvy-theme.css | 3 + .../code_edit/built-codeEdit.css | 4 + plugins/pom.xml | 1 + pom.xml | 15 ++++ 37 files changed, 1286 insertions(+), 11 deletions(-) create mode 100644 plugins/plugin-cpp/che-plugin-cpp-lang-ide/pom.xml create mode 100644 plugins/plugin-cpp/che-plugin-cpp-lang-ide/src/main/java/org/eclipse/che/plugin/cpp/ide/CppExtension.java create mode 100644 plugins/plugin-cpp/che-plugin-cpp-lang-ide/src/main/java/org/eclipse/che/plugin/cpp/ide/CppJsEditorExtension.java create mode 100644 plugins/plugin-cpp/che-plugin-cpp-lang-ide/src/main/java/org/eclipse/che/plugin/cpp/ide/CppLocalizationConstant.java create mode 100644 plugins/plugin-cpp/che-plugin-cpp-lang-ide/src/main/java/org/eclipse/che/plugin/cpp/ide/CppResources.java create mode 100644 plugins/plugin-cpp/che-plugin-cpp-lang-ide/src/main/java/org/eclipse/che/plugin/cpp/ide/action/CreateCSourceFileAction.java create mode 100644 plugins/plugin-cpp/che-plugin-cpp-lang-ide/src/main/java/org/eclipse/che/plugin/cpp/ide/action/CreateCppSourceFileAction.java create mode 100644 plugins/plugin-cpp/che-plugin-cpp-lang-ide/src/main/java/org/eclipse/che/plugin/cpp/ide/action/CreateHeaderSourceFileAction.java create mode 100644 plugins/plugin-cpp/che-plugin-cpp-lang-ide/src/main/java/org/eclipse/che/plugin/cpp/ide/action/NewClikeResourceAction.java create mode 100644 plugins/plugin-cpp/che-plugin-cpp-lang-ide/src/main/java/org/eclipse/che/plugin/cpp/ide/editor/CEditorProvider.java create mode 100644 plugins/plugin-cpp/che-plugin-cpp-lang-ide/src/main/java/org/eclipse/che/plugin/cpp/ide/editor/CppEditorProvider.java create mode 100644 plugins/plugin-cpp/che-plugin-cpp-lang-ide/src/main/java/org/eclipse/che/plugin/cpp/ide/inject/CppGinModule.java create mode 100644 plugins/plugin-cpp/che-plugin-cpp-lang-ide/src/main/java/org/eclipse/che/plugin/cpp/ide/project/CProjectWizardRegistrar.java create mode 100644 plugins/plugin-cpp/che-plugin-cpp-lang-ide/src/main/java/org/eclipse/che/plugin/cpp/ide/project/CppProjectWizardRegistrar.java create mode 100644 plugins/plugin-cpp/che-plugin-cpp-lang-ide/src/main/resources/org/eclipse/che/plugin/cpp/Cpp.gwt.xml create mode 100644 plugins/plugin-cpp/che-plugin-cpp-lang-ide/src/main/resources/org/eclipse/che/plugin/cpp/ide/CppLocalizationConstant.properties create mode 100644 plugins/plugin-cpp/che-plugin-cpp-lang-ide/src/main/resources/org/eclipse/che/plugin/cpp/ide/svg/c_file.svg create mode 100644 plugins/plugin-cpp/che-plugin-cpp-lang-ide/src/main/resources/org/eclipse/che/plugin/cpp/ide/svg/c_header_file.svg create mode 100644 plugins/plugin-cpp/che-plugin-cpp-lang-ide/src/main/resources/org/eclipse/che/plugin/cpp/ide/svg/category.svg create mode 100644 plugins/plugin-cpp/che-plugin-cpp-lang-ide/src/main/resources/org/eclipse/che/plugin/cpp/ide/svg/cpp_file.svg create mode 100644 plugins/plugin-cpp/che-plugin-cpp-lang-server/pom.xml create mode 100644 plugins/plugin-cpp/che-plugin-cpp-lang-server/src/main/java/org/eclipse/che/plugin/cpp/inject/CppModule.java create mode 100644 plugins/plugin-cpp/che-plugin-cpp-lang-server/src/main/java/org/eclipse/che/plugin/cpp/projecttype/CProjectType.java create mode 100644 plugins/plugin-cpp/che-plugin-cpp-lang-server/src/main/java/org/eclipse/che/plugin/cpp/projecttype/CppProjectType.java create mode 100644 plugins/plugin-cpp/che-plugin-cpp-lang-shared/pom.xml create mode 100644 plugins/plugin-cpp/che-plugin-cpp-lang-shared/src/main/java/org/eclipse/che/plugin/cpp/shared/Constants.java create mode 100644 plugins/plugin-cpp/pom.xml diff --git a/assembly/assembly-ide-war/pom.xml b/assembly/assembly-ide-war/pom.xml index 84fd7bb3f6..d65e5f1d05 100644 --- a/assembly/assembly-ide-war/pom.xml +++ b/assembly/assembly-ide-war/pom.xml @@ -160,6 +160,14 @@ org.eclipse.che.lib che-swagger-module + + org.eclipse.che.plugin + che-plugin-cpp-lang-ide + + + org.eclipse.che.plugin + che-plugin-cpp-lang-shared + org.eclipse.che.plugin che-plugin-docker-client diff --git a/assembly/assembly-ide-war/src/main/resources/org/eclipse/che/ide/IDE.gwt.xml b/assembly/assembly-ide-war/src/main/resources/org/eclipse/che/ide/IDE.gwt.xml index 58742ef061..bd366f7fc7 100644 --- a/assembly/assembly-ide-war/src/main/resources/org/eclipse/che/ide/IDE.gwt.xml +++ b/assembly/assembly-ide-war/src/main/resources/org/eclipse/che/ide/IDE.gwt.xml @@ -55,6 +55,7 @@ + diff --git a/assembly/assembly-machine-war/pom.xml b/assembly/assembly-machine-war/pom.xml index 275e0c5ddd..ca7e9db119 100644 --- a/assembly/assembly-machine-war/pom.xml +++ b/assembly/assembly-machine-war/pom.xml @@ -95,6 +95,14 @@ che-jdt-ext-machine jar + + org.eclipse.che.plugin + che-plugin-cpp-lang-server + + + org.eclipse.che.plugin + che-plugin-cpp-lang-shared + org.eclipse.che.plugin che-plugin-git-provider-che diff --git a/core/commons/che-core-commons-gwt/src/main/java/org/eclipse/che/ide/MimeType.java b/core/commons/che-core-commons-gwt/src/main/java/org/eclipse/che/ide/MimeType.java index 313b32a784..1fa3502ccd 100644 --- a/core/commons/che-core-commons-gwt/src/main/java/org/eclipse/che/ide/MimeType.java +++ b/core/commons/che-core-commons-gwt/src/main/java/org/eclipse/che/ide/MimeType.java @@ -67,7 +67,10 @@ public interface MimeType { String TEXT_CSS = "text/css"; /** "text/x-c" */ - String TEXT_C = "text/x-c"; + String TEXT_C = "text/x-csrc"; + + /** "text/x-c" */ + String TEXT_CPP = "text/x-c++src"; /** "text/x-h" */ String TEXT_H = "text/x-h"; diff --git a/core/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/projecttype/wizard/presenter/ProjectWizardPresenter.java b/core/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/projecttype/wizard/presenter/ProjectWizardPresenter.java index 2e361970cb..6578682344 100644 --- a/core/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/projecttype/wizard/presenter/ProjectWizardPresenter.java +++ b/core/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/projecttype/wizard/presenter/ProjectWizardPresenter.java @@ -14,6 +14,7 @@ import com.google.inject.Inject; import com.google.inject.Provider; import com.google.inject.Singleton; +import org.eclipse.che.api.project.shared.dto.AttributeDto; import org.eclipse.che.api.project.shared.dto.ItemReference; import org.eclipse.che.api.project.shared.dto.ProjectTemplateDescriptor; import org.eclipse.che.api.project.shared.dto.ProjectTypeDto; @@ -32,6 +33,7 @@ import org.eclipse.che.ide.projecttype.wizard.categoriespage.CategoriesPagePrese import org.eclipse.che.ide.ui.dialogs.DialogFactory; import javax.validation.constraints.NotNull; +import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -191,19 +193,25 @@ public class ProjectWizardPresenter implements Wizard.UpdateDelegate, wizard = getWizardForProjectType(projectType, prevData); wizard.navigateToFirst(); final ProjectConfigDto newProject = wizard.getDataObject(); - - // some values should be shared between wizards for different project types - newProject.setPath(prevData.getPath()); + newProject.setType(projectType.getId()); newProject.setName(prevData.getName()); newProject.setDescription(prevData.getDescription()); - newProject.setMixins(prevData.getMixins()); - if (wizardMode == UPDATE) { + if (wizardMode == CREATE) { + newProject.setMixins(Collections.emptyList()); + List attributes = projectType.getAttributes(); + Map> prevDataAttributes = prevData.getAttributes(); + Map> newAttributes = new HashMap<>(); + for (AttributeDto attribute : attributes) { + if(prevDataAttributes.containsKey(attribute.getId())) { + newAttributes.put(attribute.getId(), prevDataAttributes.get(attribute.getId())); + } + } + newProject.setAttributes(newAttributes); + } else { + // some values should be shared between wizards for different project types + newProject.setMixins(prevData.getMixins()); newProject.setAttributes(prevData.getAttributes()); } - - // set dataObject's values from projectType - newProject.setType(projectType.getId()); -// newProject.setRecipe(projectType.getDefaultRecipe()); } @Override diff --git a/core/ide/che-core-ide-jseditor/src/main/java/org/eclipse/che/ide/jseditor/client/filetype/ExtensionFileTypeIdentifier.java b/core/ide/che-core-ide-jseditor/src/main/java/org/eclipse/che/ide/jseditor/client/filetype/ExtensionFileTypeIdentifier.java index 58b8b0dc2e..72d6a9c3ec 100644 --- a/core/ide/che-core-ide-jseditor/src/main/java/org/eclipse/che/ide/jseditor/client/filetype/ExtensionFileTypeIdentifier.java +++ b/core/ide/che-core-ide-jseditor/src/main/java/org/eclipse/che/ide/jseditor/client/filetype/ExtensionFileTypeIdentifier.java @@ -48,7 +48,7 @@ public class ExtensionFileTypeIdentifier implements FileTypeIdentifier { /** Prepares the know extension registry. */ public void init() { - this.mappings.put("c", makeList("text/x-c")); + this.mappings.put("c", makeList("text/x-csrc")); this.mappings.put("C", makeList("text/x-c++src")); this.mappings.put("cc", makeList("text/x-c++src")); this.mappings.put("cpp", makeList("text/x-c++src")); diff --git a/plugins/plugin-cpp/che-plugin-cpp-lang-ide/pom.xml b/plugins/plugin-cpp/che-plugin-cpp-lang-ide/pom.xml new file mode 100644 index 0000000000..020ba33399 --- /dev/null +++ b/plugins/plugin-cpp/che-plugin-cpp-lang-ide/pom.xml @@ -0,0 +1,85 @@ + + + + 4.0.0 + + che-plugin-cpp-parent + org.eclipse.che.plugin + 4.1.0-RC1-SNAPSHOT + + che-plugin-cpp-lang-ide + jar + Che Plugin :: C/C++ :: IDE + + + com.google.gwt.inject + gin + + + com.google.inject + guice + + + javax.inject + javax.inject + + + javax.validation + validation-api + + + org.eclipse.che.core + che-core-api-workspace + + + org.eclipse.che.core + che-core-commons-annotations + + + org.eclipse.che.core + che-core-ide-api + + + org.eclipse.che.core + che-core-ide-app + + + org.eclipse.che.core + che-core-ide-jseditor + + + org.eclipse.che.plugin + che-plugin-cpp-lang-shared + + + org.vectomatic + lib-gwt-svg + + + com.google.gwt + gwt-user + provided + + + + + + src/main/java + + + src/main/resources + + + + diff --git a/plugins/plugin-cpp/che-plugin-cpp-lang-ide/src/main/java/org/eclipse/che/plugin/cpp/ide/CppExtension.java b/plugins/plugin-cpp/che-plugin-cpp-lang-ide/src/main/java/org/eclipse/che/plugin/cpp/ide/CppExtension.java new file mode 100644 index 0000000000..3a942c1783 --- /dev/null +++ b/plugins/plugin-cpp/che-plugin-cpp-lang-ide/src/main/java/org/eclipse/che/plugin/cpp/ide/CppExtension.java @@ -0,0 +1,69 @@ +/******************************************************************************* + * Copyright (c) 2012-2016 Codenvy, S.A. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Codenvy, S.A. - initial API and implementation + *******************************************************************************/ +package org.eclipse.che.plugin.cpp.ide; + +import com.google.inject.Inject; +import com.google.inject.name.Named; + +import org.eclipse.che.ide.api.action.ActionManager; +import org.eclipse.che.ide.api.action.DefaultActionGroup; +import org.eclipse.che.ide.api.constraints.Constraints; +import org.eclipse.che.ide.api.extension.Extension; +import org.eclipse.che.ide.api.filetypes.FileType; +import org.eclipse.che.ide.api.filetypes.FileTypeRegistry; +import org.eclipse.che.ide.api.icon.Icon; +import org.eclipse.che.ide.api.icon.IconRegistry; +import org.eclipse.che.plugin.cpp.ide.action.CreateCSourceFileAction; +import org.eclipse.che.plugin.cpp.ide.action.CreateCppSourceFileAction; +import org.eclipse.che.plugin.cpp.ide.action.CreateHeaderSourceFileAction; + +import static org.eclipse.che.ide.api.action.IdeActions.GROUP_FILE_NEW; + +/** + * @author Vitalii Parfonov + * + * */ +@Extension(title = "Cpp") +public class CppExtension { + + public static String C_CATEGORY = "C/C++"; + + @Inject + public CppExtension(FileTypeRegistry fileTypeRegistry, + @Named("CFileType") FileType cFile, + @Named("CppFileType") FileType cppFile, + @Named("HFileType") FileType hFile) { + fileTypeRegistry.registerFileType(cFile); + fileTypeRegistry.registerFileType(cppFile); + fileTypeRegistry.registerFileType(hFile); + } + + @Inject + private void prepareActions(CreateCSourceFileAction newCSourceFileAction, + CreateCppSourceFileAction newCppSourceFileAction, + CreateHeaderSourceFileAction newHeadSourceFileAction, + ActionManager actionManager, + CppResources resources, + IconRegistry iconRegistry) { + + DefaultActionGroup newGroup = (DefaultActionGroup)actionManager.getAction(GROUP_FILE_NEW); + + actionManager.registerAction("newCFile", newCSourceFileAction); + actionManager.registerAction("newCppFile", newCppSourceFileAction); + actionManager.registerAction("newHFile", newHeadSourceFileAction); + newGroup.add(newCSourceFileAction, Constraints.FIRST); + newGroup.add(newHeadSourceFileAction, Constraints.FIRST); + newGroup.add(newCppSourceFileAction, Constraints.FIRST); + iconRegistry.registerIcon(new Icon(C_CATEGORY + ".samples.category.icon", resources.category())); + + } + +} diff --git a/plugins/plugin-cpp/che-plugin-cpp-lang-ide/src/main/java/org/eclipse/che/plugin/cpp/ide/CppJsEditorExtension.java b/plugins/plugin-cpp/che-plugin-cpp-lang-ide/src/main/java/org/eclipse/che/plugin/cpp/ide/CppJsEditorExtension.java new file mode 100644 index 0000000000..1222bdf141 --- /dev/null +++ b/plugins/plugin-cpp/che-plugin-cpp-lang-ide/src/main/java/org/eclipse/che/plugin/cpp/ide/CppJsEditorExtension.java @@ -0,0 +1,39 @@ +/******************************************************************************* + * Copyright (c) 2012-2016 Codenvy, S.A. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Codenvy, S.A. - initial API and implementation + *******************************************************************************/ +package org.eclipse.che.plugin.cpp.ide; + +import com.google.inject.name.Named; + +import org.eclipse.che.ide.api.editor.EditorRegistry; +import org.eclipse.che.ide.api.extension.Extension; +import org.eclipse.che.ide.api.filetypes.FileType; +import org.eclipse.che.plugin.cpp.ide.editor.CEditorProvider; +import org.eclipse.che.plugin.cpp.ide.editor.CppEditorProvider; + +import javax.inject.Inject; + +@Extension(title = "C/C++ JS Editor") +public class CppJsEditorExtension { + + @Inject + public CppJsEditorExtension(final EditorRegistry editorRegistry, + final @Named("CFileType") FileType cFile, + final @Named("HFileType") FileType hFile, + final @Named("CppFileType") FileType classFile, + final CEditorProvider cEditorProvider, + final CppEditorProvider cppEditorProvider) { + // register editor provider + editorRegistry.registerDefaultEditor(cFile, cEditorProvider); + editorRegistry.registerDefaultEditor(hFile, cEditorProvider); + editorRegistry.registerDefaultEditor(classFile, cppEditorProvider); + editorRegistry.registerDefaultEditor(classFile, cppEditorProvider); + } +} diff --git a/plugins/plugin-cpp/che-plugin-cpp-lang-ide/src/main/java/org/eclipse/che/plugin/cpp/ide/CppLocalizationConstant.java b/plugins/plugin-cpp/che-plugin-cpp-lang-ide/src/main/java/org/eclipse/che/plugin/cpp/ide/CppLocalizationConstant.java new file mode 100644 index 0000000000..2c6e87448c --- /dev/null +++ b/plugins/plugin-cpp/che-plugin-cpp-lang-ide/src/main/java/org/eclipse/che/plugin/cpp/ide/CppLocalizationConstant.java @@ -0,0 +1,48 @@ +/******************************************************************************* + * Copyright (c) 2012-2016 Codenvy, S.A. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Codenvy, S.A. - initial API and implementation + *******************************************************************************/ +package org.eclipse.che.plugin.cpp.ide; + +import com.google.gwt.i18n.client.Messages; + +/** + * Localization constants. Interface to represent the constants defined in resource bundle: + * 'CppLocalizationConstant.properties'. + * + * @author Vitalii PArfonov + */ +public interface CppLocalizationConstant extends Messages { + + + @Key("cpp.action.create.c.file.title") + @DefaultMessage("New C File") + String createCFileActionTitle(); + + @Key("cpp.action.create.c.file.description") + @DefaultMessage("Create C File") + String createCFileActionDescription(); + + @Key("cpp.action.create.h.file.title") + @DefaultMessage("New H File") + String createCHeaderFileActionTitle(); + + @Key("cpp.action.create.c.file.description") + @DefaultMessage("Create C Header File") + String createCHeaderFileActionDescription(); + + @Key("cpp.action.create.cpp.file.title") + @DefaultMessage("New C++ File") + String createCppFileActionTitle(); + + @Key("cpp.action.create.cpp.file.description") + @DefaultMessage("Create C++ File") + String createCppFileActionDescription(); + +} diff --git a/plugins/plugin-cpp/che-plugin-cpp-lang-ide/src/main/java/org/eclipse/che/plugin/cpp/ide/CppResources.java b/plugins/plugin-cpp/che-plugin-cpp-lang-ide/src/main/java/org/eclipse/che/plugin/cpp/ide/CppResources.java new file mode 100644 index 0000000000..930c84d50f --- /dev/null +++ b/plugins/plugin-cpp/che-plugin-cpp-lang-ide/src/main/java/org/eclipse/che/plugin/cpp/ide/CppResources.java @@ -0,0 +1,35 @@ +/******************************************************************************* + * Copyright (c) 2012-2016 Codenvy, S.A. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Codenvy, S.A. - initial API and implementation + *******************************************************************************/ +package org.eclipse.che.plugin.cpp.ide; + +import com.google.gwt.core.client.GWT; +import com.google.gwt.resources.client.ClientBundle; + +import org.vectomatic.dom.svg.ui.SVGResource; + +/** + * @author Vitalii Parfonov + */ +public interface CppResources extends ClientBundle { + CppResources INSTANCE = GWT.create(CppResources.class); + + @Source("svg/c_file.svg") + SVGResource cFile(); + + @Source("svg/cpp_file.svg") + SVGResource cppFile(); + + @Source("svg/c_header_file.svg") + SVGResource cHeaderFile(); + + @Source("svg/category.svg") + SVGResource category(); +} diff --git a/plugins/plugin-cpp/che-plugin-cpp-lang-ide/src/main/java/org/eclipse/che/plugin/cpp/ide/action/CreateCSourceFileAction.java b/plugins/plugin-cpp/che-plugin-cpp-lang-ide/src/main/java/org/eclipse/che/plugin/cpp/ide/action/CreateCSourceFileAction.java new file mode 100644 index 0000000000..a76c800e31 --- /dev/null +++ b/plugins/plugin-cpp/che-plugin-cpp-lang-ide/src/main/java/org/eclipse/che/plugin/cpp/ide/action/CreateCSourceFileAction.java @@ -0,0 +1,55 @@ +/******************************************************************************* + * Copyright (c) 2012-2016 Codenvy, S.A. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Codenvy, S.A. - initial API and implementation + *******************************************************************************/ +package org.eclipse.che.plugin.cpp.ide.action; + +import com.google.inject.Inject; +import com.google.inject.Singleton; + +import org.eclipse.che.ide.api.app.AppContext; +import org.eclipse.che.plugin.cpp.ide.CppLocalizationConstant; +import org.eclipse.che.plugin.cpp.ide.CppResources; + +import static org.eclipse.che.plugin.cpp.shared.Constants.C_EXT; + +/** + * Action to create new C source file. + * + * @author Vitalii Parfonov + */ +@Singleton +public class CreateCSourceFileAction extends NewClikeResourceAction { + + private static final String DEFAULT_CONTENT = "#include \n" + + "\n" + + "int main(void)\n" + + "{\n" + + " printf(\"hello, world\\n\");\n" + + "}"; + + @Inject + public CreateCSourceFileAction(CppLocalizationConstant localizationConstant, + CppResources cppResources, + AppContext appContext) { + super(localizationConstant.createCFileActionTitle(), + localizationConstant.createCFileActionDescription(), + cppResources.cFile(), appContext); + } + + @Override + protected String getExtension() { + return C_EXT; + } + + @Override + protected String getDefaultContent() { + return DEFAULT_CONTENT; + } +} diff --git a/plugins/plugin-cpp/che-plugin-cpp-lang-ide/src/main/java/org/eclipse/che/plugin/cpp/ide/action/CreateCppSourceFileAction.java b/plugins/plugin-cpp/che-plugin-cpp-lang-ide/src/main/java/org/eclipse/che/plugin/cpp/ide/action/CreateCppSourceFileAction.java new file mode 100644 index 0000000000..6a67fa1912 --- /dev/null +++ b/plugins/plugin-cpp/che-plugin-cpp-lang-ide/src/main/java/org/eclipse/che/plugin/cpp/ide/action/CreateCppSourceFileAction.java @@ -0,0 +1,57 @@ +/******************************************************************************* + * Copyright (c) 2012-2016 Codenvy, S.A. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Codenvy, S.A. - initial API and implementation + *******************************************************************************/ +package org.eclipse.che.plugin.cpp.ide.action; + +import com.google.inject.Inject; +import com.google.inject.Singleton; + +import org.eclipse.che.ide.api.app.AppContext; +import org.eclipse.che.plugin.cpp.ide.CppLocalizationConstant; +import org.eclipse.che.plugin.cpp.ide.CppResources; + +import static org.eclipse.che.plugin.cpp.shared.Constants.CPP_EXT; + +/** + * Action to create new C++ source file. + * + * @author Vitalii Parfonov + */ +@Singleton +public class CreateCppSourceFileAction extends NewClikeResourceAction { + + + private static final String DEFAULT_CONTENT = "#include \n" + + "\n" + + "int main()\n" + + "{\n" + + " std::cout << \"Hello, world!\\n\";\n" + + " return 0;\n" + + "}"; + + @Inject + public CreateCppSourceFileAction(CppLocalizationConstant localizationConstant, + AppContext appContext, + CppResources cppResources) { + super(localizationConstant.createCppFileActionTitle(), + localizationConstant.createCppFileActionDescription(), + cppResources.cppFile(), appContext); + } + + @Override + protected String getExtension() { + return CPP_EXT; + } + + @Override + protected String getDefaultContent() { + return DEFAULT_CONTENT; + } +} diff --git a/plugins/plugin-cpp/che-plugin-cpp-lang-ide/src/main/java/org/eclipse/che/plugin/cpp/ide/action/CreateHeaderSourceFileAction.java b/plugins/plugin-cpp/che-plugin-cpp-lang-ide/src/main/java/org/eclipse/che/plugin/cpp/ide/action/CreateHeaderSourceFileAction.java new file mode 100644 index 0000000000..1ebd9f6cc3 --- /dev/null +++ b/plugins/plugin-cpp/che-plugin-cpp-lang-ide/src/main/java/org/eclipse/che/plugin/cpp/ide/action/CreateHeaderSourceFileAction.java @@ -0,0 +1,54 @@ +/******************************************************************************* + * Copyright (c) 2012-2016 Codenvy, S.A. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Codenvy, S.A. - initial API and implementation + *******************************************************************************/ +package org.eclipse.che.plugin.cpp.ide.action; + +import com.google.inject.Inject; +import com.google.inject.Singleton; + +import org.eclipse.che.ide.api.app.AppContext; +import org.eclipse.che.plugin.cpp.ide.CppLocalizationConstant; +import org.eclipse.che.plugin.cpp.ide.CppResources; + +import static org.eclipse.che.plugin.cpp.shared.Constants.H_EXT; + +/** + * Action to create new C Header file. + * + * @author Vitalii Parfonov + */ +@Singleton +public class CreateHeaderSourceFileAction extends NewClikeResourceAction { + + private static final String DEFAULT_CONTENT = "#ifndef VARIABLE\n" + + "#define VARIABLE\n" + + "// Write your header file here.\n" + + "#endif"; + + @Inject + public CreateHeaderSourceFileAction(CppLocalizationConstant localizationConstant, + CppResources cppResources, + AppContext appContext) { + super(localizationConstant.createCHeaderFileActionTitle(), + localizationConstant.createCHeaderFileActionDescription(), + cppResources.cHeaderFile(), + appContext); + } + + @Override + protected String getExtension() { + return H_EXT; + } + + @Override + protected String getDefaultContent() { + return DEFAULT_CONTENT; + } +} diff --git a/plugins/plugin-cpp/che-plugin-cpp-lang-ide/src/main/java/org/eclipse/che/plugin/cpp/ide/action/NewClikeResourceAction.java b/plugins/plugin-cpp/che-plugin-cpp-lang-ide/src/main/java/org/eclipse/che/plugin/cpp/ide/action/NewClikeResourceAction.java new file mode 100644 index 0000000000..b9fb9d8304 --- /dev/null +++ b/plugins/plugin-cpp/che-plugin-cpp-lang-ide/src/main/java/org/eclipse/che/plugin/cpp/ide/action/NewClikeResourceAction.java @@ -0,0 +1,68 @@ +/******************************************************************************* + * Copyright (c) 2012-2016 Codenvy, S.A. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Codenvy, S.A. - initial API and implementation + *******************************************************************************/ +package org.eclipse.che.plugin.cpp.ide.action; + +import org.eclipse.che.commons.annotation.Nullable; +import org.eclipse.che.ide.api.action.ActionEvent; +import org.eclipse.che.ide.api.app.AppContext; +import org.eclipse.che.ide.api.app.CurrentProject; +import org.eclipse.che.ide.api.selection.Selection; +import org.eclipse.che.ide.newresource.AbstractNewResourceAction; +import org.vectomatic.dom.svg.ui.SVGResource; + +import javax.validation.constraints.NotNull; + +import static org.eclipse.che.plugin.cpp.shared.Constants.CPP_PROJECT_TYPE_ID; +import static org.eclipse.che.plugin.cpp.shared.Constants.C_PROJECT_TYPE_ID; + +/** + * Base class for ne C/C++ resource + * + * Show/hide action depend on project type + * + * @author Vitalii Parfonov + */ +public abstract class NewClikeResourceAction extends AbstractNewResourceAction { + + protected final AppContext appContext; + + /** + * Creates new action. + * + * @param title + * action's title + * @param description + * action's description + * @param svgIcon + */ + public NewClikeResourceAction(String title, String description, @Nullable SVGResource svgIcon, AppContext appContext) { + super(title, description, svgIcon); + this.appContext = appContext; + } + + @Override + public void updateInPerspective(@NotNull ActionEvent e) { + CurrentProject project = appContext.getCurrentProject(); + if (project == null || !(CPP_PROJECT_TYPE_ID.equals(project.getRootProject().getType()) || + C_PROJECT_TYPE_ID.equals(project.getRootProject().getType()))) { + e.getPresentation().setEnabledAndVisible(false); + return; + } + + Selection selection = projectExplorer.getSelection(); + if (selection == null) { + e.getPresentation().setEnabledAndVisible(false); + return; + } + + e.getPresentation().setEnabledAndVisible(true); + } +} diff --git a/plugins/plugin-cpp/che-plugin-cpp-lang-ide/src/main/java/org/eclipse/che/plugin/cpp/ide/editor/CEditorProvider.java b/plugins/plugin-cpp/che-plugin-cpp-lang-ide/src/main/java/org/eclipse/che/plugin/cpp/ide/editor/CEditorProvider.java new file mode 100644 index 0000000000..e2af0ba293 --- /dev/null +++ b/plugins/plugin-cpp/che-plugin-cpp-lang-ide/src/main/java/org/eclipse/che/plugin/cpp/ide/editor/CEditorProvider.java @@ -0,0 +1,61 @@ +/******************************************************************************* + * Copyright (c) 2012-2016 Codenvy, S.A. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Codenvy, S.A. - initial API and implementation + *******************************************************************************/ +package org.eclipse.che.plugin.cpp.ide.editor; + +import org.eclipse.che.ide.api.editor.EditorPartPresenter; +import org.eclipse.che.ide.api.editor.EditorProvider; +import org.eclipse.che.ide.api.notification.NotificationManager; +import org.eclipse.che.ide.jseditor.client.defaulteditor.DefaultEditorProvider; +import org.eclipse.che.ide.jseditor.client.editorconfig.AutoSaveTextEditorConfiguration; +import org.eclipse.che.ide.jseditor.client.texteditor.EmbeddedTextEditorPresenter; + +import javax.inject.Inject; + + +/** + * EditorProvider that provides a text editor configured for C source files. + * + * @author Vitalii Parfonov + */ +public class CEditorProvider implements EditorProvider { + + private final DefaultEditorProvider editorProvider; + private final NotificationManager notificationManager; + + + @Inject + public CEditorProvider(final DefaultEditorProvider editorProvider, + final NotificationManager notificationManager) { + this.editorProvider = editorProvider; + this.notificationManager = notificationManager; + } + + @Override + public String getId() { + return "CEditor"; + } + + @Override + public String getDescription() { + return "C Editor"; + } + + @Override + public EditorPartPresenter getEditor() { + final EditorPartPresenter textEditor = editorProvider.getEditor(); + if (textEditor instanceof EmbeddedTextEditorPresenter) { + final EmbeddedTextEditorPresenter editor = (EmbeddedTextEditorPresenter)textEditor; + editor.initialize(new AutoSaveTextEditorConfiguration(), notificationManager); + } + return textEditor; + } + +} diff --git a/plugins/plugin-cpp/che-plugin-cpp-lang-ide/src/main/java/org/eclipse/che/plugin/cpp/ide/editor/CppEditorProvider.java b/plugins/plugin-cpp/che-plugin-cpp-lang-ide/src/main/java/org/eclipse/che/plugin/cpp/ide/editor/CppEditorProvider.java new file mode 100644 index 0000000000..2eb635209f --- /dev/null +++ b/plugins/plugin-cpp/che-plugin-cpp-lang-ide/src/main/java/org/eclipse/che/plugin/cpp/ide/editor/CppEditorProvider.java @@ -0,0 +1,41 @@ +/******************************************************************************* + * Copyright (c) 2012-2016 Codenvy, S.A. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Codenvy, S.A. - initial API and implementation + *******************************************************************************/ +package org.eclipse.che.plugin.cpp.ide.editor; + +import org.eclipse.che.ide.api.notification.NotificationManager; +import org.eclipse.che.ide.jseditor.client.defaulteditor.DefaultEditorProvider; + +import javax.inject.Inject; + + +/** + * EditorProvider that provides a text editor configured for C++ source files. + * + * @author Vitalii Parfonov + */ +public class CppEditorProvider extends CEditorProvider { + + @Inject + public CppEditorProvider(final DefaultEditorProvider editorProvider, + final NotificationManager notificationManager) { + super(editorProvider, notificationManager); + } + + @Override + public String getId() { + return "CppEditor"; + } + + @Override + public String getDescription() { + return "C++ Editor"; + } +} diff --git a/plugins/plugin-cpp/che-plugin-cpp-lang-ide/src/main/java/org/eclipse/che/plugin/cpp/ide/inject/CppGinModule.java b/plugins/plugin-cpp/che-plugin-cpp-lang-ide/src/main/java/org/eclipse/che/plugin/cpp/ide/inject/CppGinModule.java new file mode 100644 index 0000000000..549d0b620c --- /dev/null +++ b/plugins/plugin-cpp/che-plugin-cpp-lang-ide/src/main/java/org/eclipse/che/plugin/cpp/ide/inject/CppGinModule.java @@ -0,0 +1,65 @@ +/******************************************************************************* + * Copyright (c) 2012-2016 Codenvy, S.A. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Codenvy, S.A. - initial API and implementation + *******************************************************************************/ +package org.eclipse.che.plugin.cpp.ide.inject; + +import com.google.gwt.inject.client.AbstractGinModule; +import com.google.gwt.inject.client.multibindings.GinMultibinder; +import com.google.inject.Provides; +import com.google.inject.Singleton; +import com.google.inject.name.Named; + +import org.eclipse.che.ide.MimeType; +import org.eclipse.che.ide.api.extension.ExtensionGinModule; +import org.eclipse.che.ide.api.filetypes.FileType; +import org.eclipse.che.ide.api.project.type.wizard.ProjectWizardRegistrar; +import org.eclipse.che.plugin.cpp.ide.CppResources; +import org.eclipse.che.plugin.cpp.ide.project.CProjectWizardRegistrar; +import org.eclipse.che.plugin.cpp.ide.project.CppProjectWizardRegistrar; + +import static org.eclipse.che.plugin.cpp.shared.Constants.CPP_EXT; +import static org.eclipse.che.plugin.cpp.shared.Constants.C_EXT; +import static org.eclipse.che.plugin.cpp.shared.Constants.H_EXT; + + +/** + * @author Vitalii Parfonov + */ +@ExtensionGinModule +public class CppGinModule extends AbstractGinModule { + + /** {@inheritDoc} */ + @Override + protected void configure() { + GinMultibinder.newSetBinder(binder(), ProjectWizardRegistrar.class).addBinding().to(CppProjectWizardRegistrar.class); + GinMultibinder.newSetBinder(binder(), ProjectWizardRegistrar.class).addBinding().to(CProjectWizardRegistrar.class); + } + + @Provides + @Singleton + @Named("CFileType") + protected FileType provideCFile() { + return new FileType("C", CppResources.INSTANCE.cFile(), MimeType.TEXT_C, C_EXT); + } + + @Provides + @Singleton + @Named("CppFileType") + protected FileType provideCppFile() { + return new FileType("C++", CppResources.INSTANCE.cppFile(), MimeType.TEXT_CPP, CPP_EXT); + } + + @Provides + @Singleton + @Named("HFileType") + protected FileType provideHeaderFile() { + return new FileType("C Header", CppResources.INSTANCE.cHeaderFile(), MimeType.TEXT_H, H_EXT); + } +} diff --git a/plugins/plugin-cpp/che-plugin-cpp-lang-ide/src/main/java/org/eclipse/che/plugin/cpp/ide/project/CProjectWizardRegistrar.java b/plugins/plugin-cpp/che-plugin-cpp-lang-ide/src/main/java/org/eclipse/che/plugin/cpp/ide/project/CProjectWizardRegistrar.java new file mode 100644 index 0000000000..045dd5dc6a --- /dev/null +++ b/plugins/plugin-cpp/che-plugin-cpp-lang-ide/src/main/java/org/eclipse/che/plugin/cpp/ide/project/CProjectWizardRegistrar.java @@ -0,0 +1,54 @@ +/******************************************************************************* + * Copyright (c) 2012-2016 Codenvy, S.A. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Codenvy, S.A. - initial API and implementation + *******************************************************************************/ +package org.eclipse.che.plugin.cpp.ide.project; + +import com.google.inject.Provider; +import org.eclipse.che.api.workspace.shared.dto.ProjectConfigDto; +import org.eclipse.che.ide.api.project.type.wizard.ProjectWizardRegistrar; +import org.eclipse.che.ide.api.wizard.WizardPage; +import org.eclipse.che.plugin.cpp.ide.CppExtension; + +import javax.validation.constraints.NotNull; +import java.util.ArrayList; +import java.util.List; + +import static org.eclipse.che.plugin.cpp.shared.Constants.C_PROJECT_TYPE_ID; + + +/** + * Provides information for registering C_PROJECT_TYPE_ID project type into project wizard. + * + * @author Vitalii Parfonov + */ +public class CProjectWizardRegistrar implements ProjectWizardRegistrar { + + + private final List>> wizardPages; + + public CProjectWizardRegistrar() { + wizardPages = new ArrayList<>(); + } + + @NotNull + public String getProjectTypeId() { + return C_PROJECT_TYPE_ID; + } + + @NotNull + public String getCategory() { + return CppExtension.C_CATEGORY; + } + + @NotNull + public List>> getWizardPages() { + return wizardPages; + } +} diff --git a/plugins/plugin-cpp/che-plugin-cpp-lang-ide/src/main/java/org/eclipse/che/plugin/cpp/ide/project/CppProjectWizardRegistrar.java b/plugins/plugin-cpp/che-plugin-cpp-lang-ide/src/main/java/org/eclipse/che/plugin/cpp/ide/project/CppProjectWizardRegistrar.java new file mode 100644 index 0000000000..042e5e0745 --- /dev/null +++ b/plugins/plugin-cpp/che-plugin-cpp-lang-ide/src/main/java/org/eclipse/che/plugin/cpp/ide/project/CppProjectWizardRegistrar.java @@ -0,0 +1,54 @@ +/******************************************************************************* + * Copyright (c) 2012-2016 Codenvy, S.A. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Codenvy, S.A. - initial API and implementation + *******************************************************************************/ +package org.eclipse.che.plugin.cpp.ide.project; + +import com.google.inject.Provider; + +import org.eclipse.che.api.workspace.shared.dto.ProjectConfigDto; +import org.eclipse.che.ide.api.project.type.wizard.ProjectWizardRegistrar; +import org.eclipse.che.ide.api.wizard.WizardPage; +import org.eclipse.che.plugin.cpp.ide.CppExtension; + +import javax.validation.constraints.NotNull; +import java.util.ArrayList; +import java.util.List; + +import static org.eclipse.che.plugin.cpp.shared.Constants.CPP_PROJECT_TYPE_ID; + + +/** + * Provides information for registering C_PROJECT_TYPE_ID++ project type into project wizard. + * + * @author Vitalii Parfonov + */ +public class CppProjectWizardRegistrar implements ProjectWizardRegistrar { + + private final List>> wizardPages; + + public CppProjectWizardRegistrar() { + wizardPages = new ArrayList<>(); + } + + @NotNull + public String getProjectTypeId() { + return CPP_PROJECT_TYPE_ID; + } + + @NotNull + public String getCategory() { + return CppExtension.C_CATEGORY; + } + + @NotNull + public List>> getWizardPages() { + return wizardPages; + } +} diff --git a/plugins/plugin-cpp/che-plugin-cpp-lang-ide/src/main/resources/org/eclipse/che/plugin/cpp/Cpp.gwt.xml b/plugins/plugin-cpp/che-plugin-cpp-lang-ide/src/main/resources/org/eclipse/che/plugin/cpp/Cpp.gwt.xml new file mode 100644 index 0000000000..ebabb50146 --- /dev/null +++ b/plugins/plugin-cpp/che-plugin-cpp-lang-ide/src/main/resources/org/eclipse/che/plugin/cpp/Cpp.gwt.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + diff --git a/plugins/plugin-cpp/che-plugin-cpp-lang-ide/src/main/resources/org/eclipse/che/plugin/cpp/ide/CppLocalizationConstant.properties b/plugins/plugin-cpp/che-plugin-cpp-lang-ide/src/main/resources/org/eclipse/che/plugin/cpp/ide/CppLocalizationConstant.properties new file mode 100644 index 0000000000..0b073df26d --- /dev/null +++ b/plugins/plugin-cpp/che-plugin-cpp-lang-ide/src/main/resources/org/eclipse/che/plugin/cpp/ide/CppLocalizationConstant.properties @@ -0,0 +1,12 @@ +# +# Copyright (c) 2012-2016 Codenvy, S.A. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# Codenvy, S.A. - initial API and implementation +# + +# diff --git a/plugins/plugin-cpp/che-plugin-cpp-lang-ide/src/main/resources/org/eclipse/che/plugin/cpp/ide/svg/c_file.svg b/plugins/plugin-cpp/che-plugin-cpp-lang-ide/src/main/resources/org/eclipse/che/plugin/cpp/ide/svg/c_file.svg new file mode 100644 index 0000000000..64d8186a3e --- /dev/null +++ b/plugins/plugin-cpp/che-plugin-cpp-lang-ide/src/main/resources/org/eclipse/che/plugin/cpp/ide/svg/c_file.svg @@ -0,0 +1,31 @@ + + + + + + + + diff --git a/plugins/plugin-cpp/che-plugin-cpp-lang-ide/src/main/resources/org/eclipse/che/plugin/cpp/ide/svg/c_header_file.svg b/plugins/plugin-cpp/che-plugin-cpp-lang-ide/src/main/resources/org/eclipse/che/plugin/cpp/ide/svg/c_header_file.svg new file mode 100644 index 0000000000..ccce47a870 --- /dev/null +++ b/plugins/plugin-cpp/che-plugin-cpp-lang-ide/src/main/resources/org/eclipse/che/plugin/cpp/ide/svg/c_header_file.svg @@ -0,0 +1,29 @@ + + + + + + + + + h + + + + + diff --git a/plugins/plugin-cpp/che-plugin-cpp-lang-ide/src/main/resources/org/eclipse/che/plugin/cpp/ide/svg/category.svg b/plugins/plugin-cpp/che-plugin-cpp-lang-ide/src/main/resources/org/eclipse/che/plugin/cpp/ide/svg/category.svg new file mode 100644 index 0000000000..64d8186a3e --- /dev/null +++ b/plugins/plugin-cpp/che-plugin-cpp-lang-ide/src/main/resources/org/eclipse/che/plugin/cpp/ide/svg/category.svg @@ -0,0 +1,31 @@ + + + + + + + + diff --git a/plugins/plugin-cpp/che-plugin-cpp-lang-ide/src/main/resources/org/eclipse/che/plugin/cpp/ide/svg/cpp_file.svg b/plugins/plugin-cpp/che-plugin-cpp-lang-ide/src/main/resources/org/eclipse/che/plugin/cpp/ide/svg/cpp_file.svg new file mode 100644 index 0000000000..64d8186a3e --- /dev/null +++ b/plugins/plugin-cpp/che-plugin-cpp-lang-ide/src/main/resources/org/eclipse/che/plugin/cpp/ide/svg/cpp_file.svg @@ -0,0 +1,31 @@ + + + + + + + + diff --git a/plugins/plugin-cpp/che-plugin-cpp-lang-server/pom.xml b/plugins/plugin-cpp/che-plugin-cpp-lang-server/pom.xml new file mode 100644 index 0000000000..6503ec00ce --- /dev/null +++ b/plugins/plugin-cpp/che-plugin-cpp-lang-server/pom.xml @@ -0,0 +1,48 @@ + + + + 4.0.0 + + che-plugin-cpp-parent + org.eclipse.che.plugin + 4.1.0-RC1-SNAPSHOT + + che-plugin-cpp-lang-server + Che Plugin :: C/C++ :: Extension Server + + false + + + + com.google.inject + guice + + + com.google.inject.extensions + guice-multibindings + + + org.eclipse.che.core + che-core-api-project + + + org.eclipse.che.core + che-core-commons-inject + + + org.eclipse.che.plugin + che-plugin-cpp-lang-shared + + + diff --git a/plugins/plugin-cpp/che-plugin-cpp-lang-server/src/main/java/org/eclipse/che/plugin/cpp/inject/CppModule.java b/plugins/plugin-cpp/che-plugin-cpp-lang-server/src/main/java/org/eclipse/che/plugin/cpp/inject/CppModule.java new file mode 100644 index 0000000000..86f4d92858 --- /dev/null +++ b/plugins/plugin-cpp/che-plugin-cpp-lang-server/src/main/java/org/eclipse/che/plugin/cpp/inject/CppModule.java @@ -0,0 +1,31 @@ +/******************************************************************************* + * Copyright (c) 2012-2016 Codenvy, S.A. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Codenvy, S.A. - initial API and implementation + *******************************************************************************/ +package org.eclipse.che.plugin.cpp.inject; + +import com.google.inject.AbstractModule; +import com.google.inject.multibindings.Multibinder; +import org.eclipse.che.api.project.server.type.ProjectTypeDef; +import org.eclipse.che.inject.DynaModule; +import org.eclipse.che.plugin.cpp.projecttype.CProjectType; +import org.eclipse.che.plugin.cpp.projecttype.CppProjectType; + +/** + * @author Vitaly Parfonov + */ +@DynaModule +public class CppModule extends AbstractModule { + @Override + protected void configure() { + Multibinder projectTypeMultibinder = Multibinder.newSetBinder(binder(), ProjectTypeDef.class); + projectTypeMultibinder.addBinding().to(CProjectType.class); + projectTypeMultibinder.addBinding().to(CppProjectType.class); + } +} diff --git a/plugins/plugin-cpp/che-plugin-cpp-lang-server/src/main/java/org/eclipse/che/plugin/cpp/projecttype/CProjectType.java b/plugins/plugin-cpp/che-plugin-cpp-lang-server/src/main/java/org/eclipse/che/plugin/cpp/projecttype/CProjectType.java new file mode 100644 index 0000000000..6c960fad8a --- /dev/null +++ b/plugins/plugin-cpp/che-plugin-cpp-lang-server/src/main/java/org/eclipse/che/plugin/cpp/projecttype/CProjectType.java @@ -0,0 +1,31 @@ +/******************************************************************************* + * Copyright (c) 2012-2016 Codenvy, S.A. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Codenvy, S.A. - initial API and implementation + *******************************************************************************/ +package org.eclipse.che.plugin.cpp.projecttype; + +import com.google.inject.Inject; +import org.eclipse.che.api.project.server.type.ProjectTypeDef; + +import static org.eclipse.che.plugin.cpp.shared.Constants.C_LANG; +import static org.eclipse.che.plugin.cpp.shared.Constants.C_PROJECT_TYPE_ID; +import static org.eclipse.che.plugin.cpp.shared.Constants.LANGUAGE; + + +/** + * C project type + * @author Vitalii Parfonov + */ +public class CProjectType extends ProjectTypeDef { + @Inject + public CProjectType() { + super(C_PROJECT_TYPE_ID, "C", true, false, true); + addConstantDefinition(LANGUAGE, "language", C_LANG); + } +} diff --git a/plugins/plugin-cpp/che-plugin-cpp-lang-server/src/main/java/org/eclipse/che/plugin/cpp/projecttype/CppProjectType.java b/plugins/plugin-cpp/che-plugin-cpp-lang-server/src/main/java/org/eclipse/che/plugin/cpp/projecttype/CppProjectType.java new file mode 100644 index 0000000000..cf1a36d630 --- /dev/null +++ b/plugins/plugin-cpp/che-plugin-cpp-lang-server/src/main/java/org/eclipse/che/plugin/cpp/projecttype/CppProjectType.java @@ -0,0 +1,31 @@ +/******************************************************************************* + * Copyright (c) 2012-2016 Codenvy, S.A. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Codenvy, S.A. - initial API and implementation + *******************************************************************************/ +package org.eclipse.che.plugin.cpp.projecttype; + +import com.google.inject.Inject; + +import org.eclipse.che.api.project.server.type.ProjectTypeDef; + +import static org.eclipse.che.plugin.cpp.shared.Constants.CPP_LANG; +import static org.eclipse.che.plugin.cpp.shared.Constants.CPP_PROJECT_TYPE_ID; +import static org.eclipse.che.plugin.cpp.shared.Constants.LANGUAGE; + +/** + * C++ project type + * @author Vitalii Parfonov + */ +public class CppProjectType extends ProjectTypeDef { + @Inject + public CppProjectType() { + super(CPP_PROJECT_TYPE_ID, "C++", true, false, true); + addConstantDefinition(LANGUAGE, "language", CPP_LANG); + } +} diff --git a/plugins/plugin-cpp/che-plugin-cpp-lang-shared/pom.xml b/plugins/plugin-cpp/che-plugin-cpp-lang-shared/pom.xml new file mode 100644 index 0000000000..b3d72ac835 --- /dev/null +++ b/plugins/plugin-cpp/che-plugin-cpp-lang-shared/pom.xml @@ -0,0 +1,40 @@ + + + + 4.0.0 + + che-plugin-cpp-parent + org.eclipse.che.plugin + 4.1.0-RC1-SNAPSHOT + + che-plugin-cpp-lang-shared + Che Plugin :: C/C++ :: Shared + + + com.google.gwt + gwt-user + provided + + + + + + src/main/java + + + src/main/resources + + + + diff --git a/plugins/plugin-cpp/che-plugin-cpp-lang-shared/src/main/java/org/eclipse/che/plugin/cpp/shared/Constants.java b/plugins/plugin-cpp/che-plugin-cpp-lang-shared/src/main/java/org/eclipse/che/plugin/cpp/shared/Constants.java new file mode 100644 index 0000000000..997262531a --- /dev/null +++ b/plugins/plugin-cpp/che-plugin-cpp-lang-shared/src/main/java/org/eclipse/che/plugin/cpp/shared/Constants.java @@ -0,0 +1,54 @@ +/******************************************************************************* + * Copyright (c) 2012-2016 Codenvy, S.A. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Codenvy, S.A. - initial API and implementation + *******************************************************************************/ +package org.eclipse.che.plugin.cpp.shared; + +/** @author Vitalii Parfonov */ +public final class Constants { + /** + * Language attribute name + */ + public static String LANGUAGE = "language"; + /** + * C Project Type ID + */ + public static String C_PROJECT_TYPE_ID = "c"; + /** + * C++ Project Type ID + */ + public static String CPP_PROJECT_TYPE_ID = "cpp"; + + /** + * C Language + */ + public static String C_LANG = "c_lang"; + + /** + * C++ Language + */ + public static String CPP_LANG = "cpp_lang"; + + /** + * Default extension for C files + */ + public static String C_EXT = "c"; + + /** + * Default extension for C Headers files + */ + public static String H_EXT = "h"; + /** + * Default extension for C++ files + */ + public static String CPP_EXT = "cpp"; + + private Constants() {} + +} diff --git a/plugins/plugin-cpp/pom.xml b/plugins/plugin-cpp/pom.xml new file mode 100644 index 0000000000..fbcbbe8be4 --- /dev/null +++ b/plugins/plugin-cpp/pom.xml @@ -0,0 +1,41 @@ + + + + 4.0.0 + + che-plugin-parent + org.eclipse.che.plugin + 4.1.0-RC1-SNAPSHOT + ../pom.xml + + che-plugin-cpp-parent + pom + Che Plugin :: C/C++ :: Parent + + che-plugin-cpp-lang-shared + che-plugin-cpp-lang-server + che-plugin-cpp-lang-ide + + + + + + org.eclipse.che.core + che-core-api-dto-maven-plugin + ${project.version} + + + + + diff --git a/plugins/plugin-orion/che-plugin-orion-editor/src/main/resources/org/eclipse/che/ide/editor/orion/client/orion-codenvy-theme.css b/plugins/plugin-orion/che-plugin-orion-editor/src/main/resources/org/eclipse/che/ide/editor/orion/client/orion-codenvy-theme.css index 2d07dde3b2..a5f7ad0996 100644 --- a/plugins/plugin-orion/che-plugin-orion-editor/src/main/resources/org/eclipse/che/ide/editor/orion/client/orion-codenvy-theme.css +++ b/plugins/plugin-orion/che-plugin-orion-editor/src/main/resources/org/eclipse/che/ide/editor/orion/client/orion-codenvy-theme.css @@ -271,6 +271,9 @@ .orionCodenvy .meta.tag { color: #e8bf55; } +.orionCodenvy .meta.preprocessor { + color: #A4A4A4; +} .annotationHTML { margin-left: 1px; } diff --git a/plugins/plugin-orion/che-plugin-orion-editor/src/main/resources/org/eclipse/che/ide/editor/orion/public/built-codeEdit-10.0/code_edit/built-codeEdit.css b/plugins/plugin-orion/che-plugin-orion-editor/src/main/resources/org/eclipse/che/ide/editor/orion/public/built-codeEdit-10.0/code_edit/built-codeEdit.css index d82f7c638a..1eaad69b3e 100644 --- a/plugins/plugin-orion/che-plugin-orion-editor/src/main/resources/org/eclipse/che/ide/editor/orion/public/built-codeEdit-10.0/code_edit/built-codeEdit.css +++ b/plugins/plugin-orion/che-plugin-orion-editor/src/main/resources/org/eclipse/che/ide/editor/orion/public/built-codeEdit-10.0/code_edit/built-codeEdit.css @@ -401,6 +401,10 @@ .meta.tag { color: #3f7f7f; } +.meta .preprocessor { + color: #A4A4A4; +} + .punctuation-definition-comment { color: #3f5fbf; } diff --git a/plugins/pom.xml b/plugins/pom.xml index 2fbbcf360d..d813f90afd 100644 --- a/plugins/pom.xml +++ b/plugins/pom.xml @@ -38,5 +38,6 @@ plugin-gwt plugin-python plugin-svn + plugin-cpp diff --git a/pom.xml b/pom.xml index 951d60ddcd..b3d1fa46ab 100644 --- a/pom.xml +++ b/pom.xml @@ -309,6 +309,21 @@ che-jdt-ext-machine ${project.version} + + org.eclipse.che.plugin + che-plugin-cpp-lang-ide + ${project.version} + + + org.eclipse.che.plugin + che-plugin-cpp-lang-server + ${project.version} + + + org.eclipse.che.plugin + che-plugin-cpp-lang-shared + ${project.version} + org.eclipse.che.plugin che-plugin-docker-client