forked from eclipse-che/che
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move activity components to plugin-activity (eclipse-che#5896)
Move activity components to plugin-activity
- Loading branch information
1 parent
4291fed
commit 83e5f47
Showing
32 changed files
with
535 additions
and
68 deletions.
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
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
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,53 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
Copyright (c) 2012-2017 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-plugin-activity-parent</artifactId> | ||
<groupId>org.eclipse.che.plugin</groupId> | ||
<version>5.17.0-SNAPSHOT</version> | ||
<relativePath>../pom.xml</relativePath> | ||
</parent> | ||
<artifactId>che-plugin-activity-ide</artifactId> | ||
<packaging>jar</packaging> | ||
<name>Che Plugin :: Activity :: IDE</name> | ||
<dependencies> | ||
<dependency> | ||
<groupId>com.google.gwt</groupId> | ||
<artifactId>gwt-user</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>javax.inject</groupId> | ||
<artifactId>javax.inject</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> | ||
</dependencies> | ||
<build> | ||
<resources> | ||
<resource> | ||
<directory>src/main/java</directory> | ||
</resource> | ||
<resource> | ||
<directory>src/main/resources</directory> | ||
</resource> | ||
</resources> | ||
</build> | ||
</project> |
58 changes: 58 additions & 0 deletions
58
...vity-ide/src/main/java/org/eclipse/che/plugin/activity/ide/ActivityTrackingExtension.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,58 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2012-2017 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.activity.ide; | ||
|
||
|
||
import com.google.gwt.core.client.Callback; | ||
import com.google.gwt.core.client.ScriptInjector; | ||
|
||
import org.eclipse.che.ide.api.app.AppContext; | ||
import org.eclipse.che.ide.api.extension.Extension; | ||
import org.eclipse.che.ide.rest.RestContext; | ||
|
||
import javax.inject.Inject; | ||
import javax.inject.Singleton; | ||
|
||
import static com.google.gwt.core.client.ScriptInjector.TOP_WINDOW; | ||
|
||
/** | ||
* Adds activity tracking script to IDE. | ||
* | ||
* @author Max Shaposhnik (mshaposhnik@codenvy.com) | ||
*/ | ||
@Singleton | ||
@Extension(title = "Activity Tracking Extension", version = "1.0.0") | ||
public class ActivityTrackingExtension { | ||
|
||
@Inject | ||
public ActivityTrackingExtension(final @RestContext String restContext, | ||
final AppContext appContext) { | ||
|
||
ScriptInjector.fromUrl("/_app/activity.js") | ||
.setWindow(TOP_WINDOW) | ||
.setCallback(new Callback<Void, Exception>() { | ||
@Override | ||
public void onSuccess(Void result) { | ||
init(restContext, appContext.getWorkspaceId()); | ||
} | ||
|
||
@Override | ||
public void onFailure(Exception reason) { | ||
} | ||
|
||
private native void init(String restContext, String wsId) /*-{ | ||
$wnd.ActivityTracker.init(restContext, wsId); | ||
}-*/; | ||
}) | ||
.inject(); | ||
|
||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
...in-activity-ide/src/main/resources/org/eclipse/che/plugin/activity/ActivityModule.gwt.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,19 @@ | ||
<!-- | ||
Copyright (c) 2012-2017 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 | ||
--> | ||
<module> | ||
<inherits name="com.google.gwt.user.User"/> | ||
|
||
<public path="public"/> | ||
|
||
<source path="ide"/> | ||
</module> |
60 changes: 60 additions & 0 deletions
60
...plugin-activity-ide/src/main/resources/org/eclipse/che/plugin/activity/public/activity.js
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,60 @@ | ||
/* | ||
* Copyright (c) 2012-2017 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 | ||
*/ | ||
var ActivityTracker = new function () { | ||
|
||
var url; | ||
var timeoutInterval = 30000; | ||
var maxErrors = 10; | ||
var errors = 0; | ||
var active; | ||
|
||
this.init = function (restContext, workspaceId) { | ||
this.url = restContext + "/activity/" + workspaceId; | ||
document.addEventListener("mousemove", ActivityTracker.setActive); | ||
document.addEventListener("keypress", ActivityTracker.setActive); | ||
setInterval(ActivityTracker.sendRequest, timeoutInterval); | ||
|
||
}; | ||
|
||
this.setActive = function() { | ||
if (!active && errors < maxErrors) { | ||
active = true; | ||
} | ||
} | ||
|
||
|
||
this.sendRequest = function () { | ||
if (!active) { | ||
return; | ||
} | ||
active = false; | ||
|
||
var request; | ||
if (window.XMLHttpRequest) { | ||
request = new XMLHttpRequest(); | ||
} else { | ||
request = new ActiveXObject("Microsoft.XMLHTTP"); | ||
} | ||
|
||
request.onreadystatechange = function () { | ||
if (request.readyState == 4) { | ||
if (request.status == 204) { | ||
errors = 0; | ||
} else { | ||
errors++; | ||
} | ||
|
||
} | ||
}; | ||
request.open("PUT", ActivityTracker.url, true); | ||
request.send(); | ||
}; | ||
}; |
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
27 changes: 27 additions & 0 deletions
27
...-activity-server/src/main/java/org/eclipse/che/plugin/activity/ActivityServletModule.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,27 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2012-2017 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.activity; | ||
|
||
import com.google.inject.servlet.ServletModule; | ||
|
||
import org.eclipse.che.inject.DynaModule; | ||
|
||
/** | ||
* @author Mihail Kuznyetsov | ||
*/ | ||
@DynaModule | ||
public class ActivityServletModule extends ServletModule { | ||
|
||
@Override | ||
protected void configureServlets() { | ||
filter("/*").through(org.eclipse.che.plugin.activity.LastAccessTimeFilter.class); | ||
} | ||
} |
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
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
25 changes: 25 additions & 0 deletions
25
plugins/plugin-activity/che-plugin-activity-shared/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,25 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
Copyright (c) 2012-2017 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-plugin-activity-parent</artifactId> | ||
<groupId>org.eclipse.che.plugin</groupId> | ||
<version>5.17.0-SNAPSHOT</version> | ||
<relativePath>../pom.xml</relativePath> | ||
</parent> | ||
<artifactId>che-plugin-activity-shared</artifactId> | ||
<packaging>jar</packaging> | ||
<name>Che Plugin :: Activity :: Shared</name> | ||
</project> |
Oops, something went wrong.