-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1369 from eclipse/json-example
Add JSON Example
- Loading branch information
Showing
39 changed files
with
1,829 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
111
samples/sample-plugin-json/che-sample-plugin-json-ide/pom.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
43 changes: 43 additions & 0 deletions
43
...-ide/src/main/java/org/eclipse/che/plugin/jsonexample/ide/JsonExampleEditorExtension.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |
66 changes: 66 additions & 0 deletions
66
...n-json-ide/src/main/java/org/eclipse/che/plugin/jsonexample/ide/JsonExampleExtension.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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())); | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
...n-json-ide/src/main/java/org/eclipse/che/plugin/jsonexample/ide/JsonExampleResources.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
|
||
} |
Oops, something went wrong.