Skip to content

Commit

Permalink
Merge pull request #1369 from eclipse/json-example
Browse files Browse the repository at this point in the history
Add JSON Example
  • Loading branch information
ashumilova committed May 27, 2016
2 parents 9846404 + 0991320 commit df409bd
Show file tree
Hide file tree
Showing 39 changed files with 1,829 additions and 1 deletion.
18 changes: 17 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,15 @@
<modules>
<module>core</module>
<module>plugins</module>
<module>samples</module>
<module>dashboard</module>
<module>assembly</module>
</modules>
<scm>
<connection>scm:git:git@github.com:eclipse/che.git</connection>
<developerConnection>scm:git:git@github.com:eclipse/che.git</developerConnection>
<tag>HEAD</tag>
<url>https://github.com/codenvy/che-core</url>
<url>https://github.com/eclipse/che</url>
</scm>
<properties>
<che.lib.version>4.3.0-RC1-SNAPSHOT</che.lib.version>
Expand Down Expand Up @@ -669,6 +670,21 @@
<artifactId>shared</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.che.sample</groupId>
<artifactId>che-sample-plugin-json-ide</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.che.sample</groupId>
<artifactId>che-sample-plugin-json-server</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.che.sample</groupId>
<artifactId>che-sample-plugin-json-shared</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.che.core</groupId>
<artifactId>che-core-commons-test</artifactId>
Expand Down
30 changes: 30 additions & 0 deletions samples/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
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
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>che-parent</artifactId>
<groupId>org.eclipse.che</groupId>
<version>4.3.0-RC1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<groupId>org.eclipse.che.sample</groupId>
<artifactId>che-sample-parent</artifactId>
<version>4.3.0-RC1-SNAPSHOT</version>
<packaging>pom</packaging>
<name>Che Sample :: Parent</name>
<modules>
<module>sample-plugin-json</module>
</modules>
</project>
111 changes: 111 additions & 0 deletions samples/sample-plugin-json/che-sample-plugin-json-ide/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
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
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>che-sample-plugin-json-parent</artifactId>
<groupId>org.eclipse.che.sample</groupId>
<version>4.3.0-RC1-SNAPSHOT</version>
</parent>
<artifactId>che-sample-plugin-json-ide</artifactId>
<packaging>jar</packaging>
<name>Che Sample :: Plugin JSON :: IDE</name>
<dependencies>
<dependency>
<groupId>com.google.gwt.inject</groupId>
<artifactId>gin</artifactId>
</dependency>
<dependency>
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
</dependency>
<dependency>
<groupId>com.google.inject.extensions</groupId>
<artifactId>guice-assistedinject</artifactId>
</dependency>
<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.che.core</groupId>
<artifactId>che-core-api-workspace</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.che.core</groupId>
<artifactId>che-core-api-workspace-shared</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.che.core</groupId>
<artifactId>che-core-commons-annotations</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.che.core</groupId>
<artifactId>che-core-commons-gwt</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.che.core</groupId>
<artifactId>che-core-ide-api</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.che.core</groupId>
<artifactId>che-core-ide-app</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.che.sample</groupId>
<artifactId>che-sample-plugin-json-shared</artifactId>
</dependency>
<dependency>
<groupId>org.vectomatic</groupId>
<artifactId>lib-gwt-svg</artifactId>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<resources>
<resource>
<directory>src/main/java</directory>
</resource>
<resource>
<directory>src/main/resources</directory>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>analyze</id>
<configuration>
<skip>true</skip>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*******************************************************************************
* 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.jsonexample.ide;

import com.google.inject.Inject;
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.jsonexample.ide.editor.JsonExampleEditorProvider;

/**
* The editor extension for the JSON Example
*/
@Extension(title = "JSON Example Editor")
public class JsonExampleEditorExtension {

/**
* Constructor.
*
* @param editorRegistry
* the {@link EditorRegistry} for registering our editor
* @param jsonFile
* the {@link FileType} that is associated with our editor
* @param editorProvider
* the editor provider
*/
@Inject
public JsonExampleEditorExtension(final EditorRegistry editorRegistry,
final @Named("JsonFileType") FileType jsonFile,
final JsonExampleEditorProvider editorProvider) {
editorRegistry.registerDefaultEditor(jsonFile, editorProvider);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
/*******************************************************************************
* 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.jsonexample.ide;

import com.google.inject.Inject;

import org.eclipse.che.ide.api.action.ActionManager;
import org.eclipse.che.ide.api.action.DefaultActionGroup;
import org.eclipse.che.ide.api.extension.Extension;
import org.eclipse.che.ide.api.icon.Icon;
import org.eclipse.che.ide.api.icon.IconRegistry;
import org.eclipse.che.plugin.jsonexample.ide.action.CountLinesAction;
import org.eclipse.che.plugin.jsonexample.ide.action.HelloWorldAction;

import static org.eclipse.che.plugin.jsonexample.shared.Constants.JSON_EXAMPLE_CATEGORY;

/**
* JSON Example extension that registers actions and icons.
*/
@Extension(title = "JSON Example Extension", version = "0.0.1")
public class JsonExampleExtension {

/**
* Constructor.
*
* @param actionManager
* the {@link ActionManager} that is used to register our actions
* @param helloWorldAction
* action to be registered
* @param countLinesAction
* action to be registered
* @param jsonExampleResources
* the resources that contains our icon
* @param iconRegistry
* the {@link IconRegistry} that is used to register our icon
*/
@Inject
public JsonExampleExtension(
ActionManager actionManager,
HelloWorldAction helloWorldAction,
CountLinesAction countLinesAction,
JsonExampleResources jsonExampleResources,
IconRegistry iconRegistry) {

DefaultActionGroup mainContextMenuGroup = (DefaultActionGroup)actionManager.getAction("resourceOperation");
DefaultActionGroup jsonGroup = new DefaultActionGroup("JSON Example", true, actionManager);
mainContextMenuGroup.add(jsonGroup);

actionManager.registerAction("jsonExample", jsonGroup);
jsonGroup.add(countLinesAction);

actionManager.registerAction("helloWorldAction", helloWorldAction);
jsonGroup.add(helloWorldAction);

iconRegistry.registerIcon(
new Icon(JSON_EXAMPLE_CATEGORY + ".samples.category.icon", jsonExampleResources.icon()));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*******************************************************************************
* 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.jsonexample.ide;

import com.google.gwt.core.client.GWT;
import com.google.gwt.resources.client.ClientBundle;

import org.vectomatic.dom.svg.ui.SVGResource;

public interface JsonExampleResources extends ClientBundle {

JsonExampleResources INSTANCE = GWT.create(JsonExampleResources.class);

@Source("svg/icon.svg")
SVGResource icon();

@Source("svg/completion.svg")
SVGResource completion();

}
Loading

0 comments on commit df409bd

Please sign in to comment.