CHE-1081: remove workspace id from services that deployed on wsagent (#1268)
remove workspace id from services that deployed on wsagent remove workspace Id usage in wsagent services in dashboard Add init params for websocket endpoint and eventbus end point It allow has different format of URL on wsmaster with ws-id like path param and on wsagent without it Signed-off-by: Vitaly Parfonov <vparfonov@codenvy.com>6.19.x
parent
b0c8dddfa5
commit
a63a856970
|
|
@ -343,8 +343,7 @@
|
|||
</goals>
|
||||
<configuration>
|
||||
<tasks>
|
||||
<echo append="false" file="${project.build.directory}/classes/org/eclipse/che/ide/ext/help/client/BuildInfo.properties">
|
||||
revision = ${revision}
|
||||
<echo append="false" file="${project.build.directory}/classes/org/eclipse/che/ide/ext/help/client/BuildInfo.properties">revision = ${revision}
|
||||
buildTime = ${timestamp}
|
||||
version = ${project.version}</echo>
|
||||
</tasks>
|
||||
|
|
|
|||
|
|
@ -21,6 +21,14 @@
|
|||
<param-name>org.everrest.websocket.context</param-name>
|
||||
<param-value>/ext</param-value>
|
||||
</context-param>
|
||||
<context-param>
|
||||
<param-name>org.eclipse.che.websocket.endpoint</param-name>
|
||||
<param-value>/ws</param-value>
|
||||
</context-param>
|
||||
<context-param>
|
||||
<param-name>org.eclipse.che.eventbus.endpoint</param-name>
|
||||
<param-value>/eventbus/</param-value>
|
||||
</context-param>
|
||||
<listener>
|
||||
<listener-class>org.eclipse.che.inject.CheBootstrap</listener-class>
|
||||
</listener>
|
||||
|
|
|
|||
|
|
@ -21,6 +21,14 @@
|
|||
<param-name>org.everrest.websocket.context</param-name>
|
||||
<param-value>/api</param-value>
|
||||
</context-param>
|
||||
<context-param>
|
||||
<param-name>org.eclipse.che.websocket.endpoint</param-name>
|
||||
<param-value>/ws/{ws-id}</param-value>
|
||||
</context-param>
|
||||
<context-param>
|
||||
<param-name>org.eclipse.che.eventbus.endpoint</param-name>
|
||||
<param-value>/eventbus/</param-value>
|
||||
</context-param>
|
||||
|
||||
<servlet>
|
||||
<servlet-name>IDE</servlet-name>
|
||||
|
|
|
|||
|
|
@ -73,11 +73,15 @@ public class ServerContainerInitializeListener implements ServletContextListener
|
|||
private ServerEndpointConfig wsServerEndpointConfig;
|
||||
private ServerEndpointConfig eventbusServerEndpointConfig;
|
||||
private String websocketContext;
|
||||
private String websocketEndPoint;
|
||||
private String eventBusEndPoint;
|
||||
|
||||
@Override
|
||||
public final void contextInitialized(ServletContextEvent sce) {
|
||||
final ServletContext servletContext = sce.getServletContext();
|
||||
websocketContext = MoreObjects.firstNonNull(servletContext.getInitParameter("org.everrest.websocket.context"), "");
|
||||
websocketEndPoint = MoreObjects.firstNonNull(servletContext.getInitParameter("org.eclipse.che.websocket.endpoint"), "");
|
||||
eventBusEndPoint = MoreObjects.firstNonNull(servletContext.getInitParameter("org.eclipse.che.eventbus.endpoint"), "");
|
||||
webApplicationDeclaredRoles = new WebApplicationDeclaredRoles(servletContext);
|
||||
everrestConfiguration = (EverrestConfiguration)servletContext.getAttribute(EVERREST_CONFIG_ATTRIBUTE);
|
||||
if (everrestConfiguration == null) {
|
||||
|
|
@ -115,7 +119,7 @@ public class ServerContainerInitializeListener implements ServletContextListener
|
|||
final List<Class<? extends Decoder>> decoders = new LinkedList<>();
|
||||
encoders.add(OutputMessageEncoder.class);
|
||||
decoders.add(InputMessageDecoder.class);
|
||||
final ServerEndpointConfig endpointConfig = create(CheWSConnection.class, websocketContext+"/ws/{ws-id}")
|
||||
final ServerEndpointConfig endpointConfig = create(CheWSConnection.class, websocketContext + websocketEndPoint)
|
||||
.configurator(createConfigurator()).encoders(encoders).decoders(decoders).build();
|
||||
endpointConfig.getUserProperties().put(EVERREST_PROCESSOR_ATTRIBUTE, getEverrestProcessor(servletContext));
|
||||
endpointConfig.getUserProperties().put(EVERREST_CONFIG_ATTRIBUTE, getEverrestConfiguration(servletContext));
|
||||
|
|
@ -128,7 +132,7 @@ public class ServerContainerInitializeListener implements ServletContextListener
|
|||
final List<Class<? extends Decoder>> decoders = new LinkedList<>();
|
||||
encoders.add(OutputMessageEncoder.class);
|
||||
decoders.add(InputMessageDecoder.class);
|
||||
final ServerEndpointConfig endpointConfig = create(CheWSConnection.class, websocketContext+"/eventbus/")
|
||||
final ServerEndpointConfig endpointConfig = create(CheWSConnection.class, websocketContext + eventBusEndPoint)
|
||||
.configurator(createConfigurator()).encoders(encoders).decoders(decoders).build();
|
||||
endpointConfig.getUserProperties().put(EVERREST_PROCESSOR_ATTRIBUTE, getEverrestProcessor(servletContext));
|
||||
endpointConfig.getUserProperties().put(EVERREST_CONFIG_ATTRIBUTE, getEverrestConfiguration(servletContext));
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ public class DebuggerServiceClientImpl implements DebuggerServiceClient {
|
|||
|
||||
@Override
|
||||
public Promise<DebugSessionDto> connect(String debuggerType, Map<String, String> connectionProperties) {
|
||||
final String requestUrl = getBaseUrl() + "?type=" + debuggerType;
|
||||
final String requestUrl = getBaseUrl(null) + "?type=" + debuggerType;
|
||||
return asyncRequestFactory.createPostRequest(requestUrl, null)
|
||||
.header(CONTENT_TYPE, APPLICATION_JSON)
|
||||
.data(JsonHelper.toJson(connectionProperties))
|
||||
|
|
@ -75,7 +75,7 @@ public class DebuggerServiceClientImpl implements DebuggerServiceClient {
|
|||
|
||||
@Override
|
||||
public Promise<Void> disconnect(String id) {
|
||||
final String requestUrl = getBaseUrl() + "/" + id;
|
||||
final String requestUrl = getBaseUrl(id);
|
||||
return asyncRequestFactory.createDeleteRequest(requestUrl)
|
||||
.loader(loaderFactory.newLoader())
|
||||
.send();
|
||||
|
|
@ -83,7 +83,7 @@ public class DebuggerServiceClientImpl implements DebuggerServiceClient {
|
|||
|
||||
@Override
|
||||
public Promise<DebugSessionDto> getSessionInfo(String id) {
|
||||
final String requestUrl = getBaseUrl() + "/" + id;
|
||||
final String requestUrl = getBaseUrl(id);
|
||||
return asyncRequestFactory.createGetRequest(requestUrl)
|
||||
.send(dtoUnmarshallerFactory.newUnmarshaller(DebugSessionDto.class));
|
||||
}
|
||||
|
|
@ -95,7 +95,7 @@ public class DebuggerServiceClientImpl implements DebuggerServiceClient {
|
|||
|
||||
@Override
|
||||
public Promise<Void> addBreakpoint(String id, BreakpointDto breakpointDto) {
|
||||
final String requestUrl = getBaseUrl() + "/" + id + "/breakpoint";
|
||||
final String requestUrl = getBaseUrl(id) + "/breakpoint";
|
||||
return asyncRequestFactory.createPostRequest(requestUrl, breakpointDto)
|
||||
.loader(loaderFactory.newLoader())
|
||||
.send();
|
||||
|
|
@ -103,7 +103,7 @@ public class DebuggerServiceClientImpl implements DebuggerServiceClient {
|
|||
|
||||
@Override
|
||||
public Promise<List<BreakpointDto>> getAllBreakpoints(String id) {
|
||||
final String requestUrl = getBaseUrl() + "/" + id + "/breakpoint";
|
||||
final String requestUrl = getBaseUrl(id) + "/breakpoint";
|
||||
return asyncRequestFactory.createGetRequest(requestUrl)
|
||||
.loader(loaderFactory.newLoader())
|
||||
.send(dtoUnmarshallerFactory.newListUnmarshaller(BreakpointDto.class));
|
||||
|
|
@ -111,20 +111,20 @@ public class DebuggerServiceClientImpl implements DebuggerServiceClient {
|
|||
|
||||
@Override
|
||||
public Promise<Void> deleteBreakpoint(String id, LocationDto locationDto) {
|
||||
final String requestUrl = getBaseUrl() + "/" + id + "/breakpoint";
|
||||
final String requestUrl = getBaseUrl(id) + "/breakpoint";
|
||||
final String params = "?target=" + locationDto.getTarget() + "&line=" + locationDto.getLineNumber();
|
||||
return asyncRequestFactory.createDeleteRequest(requestUrl + params).send();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Promise<Void> deleteAllBreakpoints(String id) {
|
||||
final String requestUrl = getBaseUrl() + "/" + id + "/breakpoint";
|
||||
final String requestUrl = getBaseUrl(id) + "/breakpoint";
|
||||
return asyncRequestFactory.createDeleteRequest(requestUrl).send();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Promise<StackFrameDumpDto> getStackFrameDump(String id) {
|
||||
final String requestUrl = getBaseUrl() + "/" + id + "/dump";
|
||||
final String requestUrl = getBaseUrl(id) + "/dump";
|
||||
return asyncRequestFactory.createGetRequest(requestUrl)
|
||||
.loader(loaderFactory.newLoader())
|
||||
.send(dtoUnmarshallerFactory.newUnmarshaller(StackFrameDumpDto.class));
|
||||
|
|
@ -137,7 +137,7 @@ public class DebuggerServiceClientImpl implements DebuggerServiceClient {
|
|||
|
||||
@Override
|
||||
public Promise<SimpleValueDto> getValue(String id, VariableDto variableDto) {
|
||||
final String requestUrl = getBaseUrl() + "/" + id + "/value";
|
||||
final String requestUrl = getBaseUrl(id) + "/value";
|
||||
List<String> path = variableDto.getVariablePath().getPath();
|
||||
|
||||
StringBuilder params = new StringBuilder();
|
||||
|
|
@ -156,7 +156,7 @@ public class DebuggerServiceClientImpl implements DebuggerServiceClient {
|
|||
|
||||
@Override
|
||||
public Promise<Void> setValue(String id, VariableDto variableDto) {
|
||||
final String requestUrl = getBaseUrl() + "/" + id + "/value";
|
||||
final String requestUrl = getBaseUrl(id) + "/value";
|
||||
return asyncRequestFactory.createPutRequest(requestUrl, variableDto)
|
||||
.loader(loaderFactory.newLoader())
|
||||
.send();
|
||||
|
|
@ -179,20 +179,23 @@ public class DebuggerServiceClientImpl implements DebuggerServiceClient {
|
|||
|
||||
@Override
|
||||
public Promise<String> evaluate(String id, String expression) {
|
||||
String requestUrl = getBaseUrl() + "/" + id + "/evaluation";
|
||||
String requestUrl = getBaseUrl(id) + "/evaluation";
|
||||
String params = "?expression=" + URL.encodeQueryString(expression);
|
||||
return asyncRequestFactory.createGetRequest(requestUrl + params)
|
||||
.loader(loaderFactory.newLoader())
|
||||
.send(new StringUnmarshaller());
|
||||
}
|
||||
|
||||
private String getBaseUrl() {
|
||||
DevMachine devMachine = appContext.getDevMachine();
|
||||
return devMachine.getWsAgentBaseUrl() + "/debugger/" + devMachine.getWorkspace();
|
||||
private String getBaseUrl(String id) {
|
||||
final String url = appContext.getDevMachine().getWsAgentBaseUrl() + "/debugger";
|
||||
if (id != null) {
|
||||
return url + "/" + id;
|
||||
}
|
||||
return url;
|
||||
}
|
||||
|
||||
protected Promise<Void> performAction(String id, ActionDto actionDto) {
|
||||
final String requestUrl = getBaseUrl() + "/" + id;
|
||||
final String requestUrl = getBaseUrl(id);
|
||||
return asyncRequestFactory.createPostRequest(requestUrl, actionDto)
|
||||
.loader(loaderFactory.newLoader())
|
||||
.send();
|
||||
|
|
|
|||
|
|
@ -71,10 +71,7 @@ public class DevMachine {
|
|||
String url = server.getUrl();
|
||||
String extUrl = url.substring(url.indexOf(':'), url.length());
|
||||
final String protocol = Window.Location.getProtocol().equals("https:") ? "wss" : "ws";
|
||||
return protocol
|
||||
+ extUrl
|
||||
+ (extUrl.endsWith("/") ? "ws/" : "/ws/")
|
||||
+ getWorkspace();
|
||||
return protocol + extUrl + (extUrl.endsWith("/") ? "ws" : "/ws");
|
||||
} else {
|
||||
//should not be
|
||||
String message = "Reference " + Constants.WSAGENT_REFERENCE + " not found in DevMachine description";
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ public class ProjectImportersServiceClientImpl implements ProjectImportersServic
|
|||
|
||||
@Override
|
||||
public void getProjectImporters(DevMachine devMachine, AsyncRequestCallback<ProjectImporterData> callback) {
|
||||
asyncRequestFactory.createGetRequest(devMachine.getWsAgentBaseUrl() + "/project-importers/" + devMachine.getWorkspace())
|
||||
asyncRequestFactory.createGetRequest(devMachine.getWsAgentBaseUrl() + "/project-importers")
|
||||
.header(HTTPHeader.CONTENT_TYPE, MimeType.APPLICATION_JSON)
|
||||
.send(callback);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,8 +33,8 @@ public interface ProjectServiceClient {
|
|||
/**
|
||||
* Get all projects in current workspace.
|
||||
*
|
||||
* @param workspaceId
|
||||
* id of current workspace
|
||||
* @param devMachine
|
||||
* of current devMachine
|
||||
* @param callback
|
||||
* the callback to use for the response
|
||||
*/
|
||||
|
|
@ -43,8 +43,8 @@ public interface ProjectServiceClient {
|
|||
/**
|
||||
* Get all projects in current workspace.
|
||||
*
|
||||
* @param workspaceId
|
||||
* id of current workspace
|
||||
* @param devMachine
|
||||
* of current devMachine
|
||||
* @return a promise that will provide a list of {@link ProjectConfigDto}s, or rejects with an error
|
||||
*/
|
||||
Promise<List<ProjectConfigDto>> getProjects(DevMachine devMachine);
|
||||
|
|
@ -52,8 +52,8 @@ public interface ProjectServiceClient {
|
|||
/**
|
||||
* Get project.
|
||||
*
|
||||
* @param workspaceId
|
||||
* id of current workspace
|
||||
* @param devMachine
|
||||
* of current devMachine
|
||||
* @param path
|
||||
* path to the project to get
|
||||
* @param callback
|
||||
|
|
@ -64,6 +64,8 @@ public interface ProjectServiceClient {
|
|||
/**
|
||||
* Get project.
|
||||
*
|
||||
* @param devMachine
|
||||
* of current devMachine
|
||||
* @param path
|
||||
* path to the project
|
||||
* @return a promise that resolves to the {@link ProjectConfigDto}, or rejects with an error
|
||||
|
|
@ -73,8 +75,8 @@ public interface ProjectServiceClient {
|
|||
/**
|
||||
* Get item.
|
||||
*
|
||||
* @param workspaceId
|
||||
* id of current workspace
|
||||
* @param devMachine
|
||||
* of current devMachine
|
||||
* @param path
|
||||
* path to the item to get
|
||||
* @param callback
|
||||
|
|
@ -85,8 +87,8 @@ public interface ProjectServiceClient {
|
|||
/**
|
||||
* Create project.
|
||||
*
|
||||
* @param workspaceId
|
||||
* id of current workspace
|
||||
* @param devMachine
|
||||
* of current devMachine
|
||||
* @param projectConfig
|
||||
* descriptor of the project to create
|
||||
* @param callback
|
||||
|
|
@ -98,8 +100,8 @@ public interface ProjectServiceClient {
|
|||
/**
|
||||
* Estimates if the folder supposed to be project of certain type.
|
||||
*
|
||||
* @param workspaceId
|
||||
* id of current workspace
|
||||
* @param devMachine
|
||||
* of current devMachine
|
||||
* @param path
|
||||
* path of the project to estimate
|
||||
* @param projectType
|
||||
|
|
@ -113,8 +115,8 @@ public interface ProjectServiceClient {
|
|||
/**
|
||||
* Gets list of {@link SourceEstimation} for all supposed project types.
|
||||
*
|
||||
* @param workspaceId
|
||||
* id of current workspace
|
||||
* @param devMachine
|
||||
* of current devMachine
|
||||
* @param path
|
||||
* path of the project to resolve
|
||||
* @param callback
|
||||
|
|
@ -127,8 +129,8 @@ public interface ProjectServiceClient {
|
|||
/**
|
||||
* Gets list of {@link SourceEstimation} for all supposed project types.
|
||||
*
|
||||
* @param workspaceId
|
||||
* id of current workspace
|
||||
* @param devMachine
|
||||
* of current devMachine
|
||||
* @param path
|
||||
* path of the project to resolve
|
||||
* @return a promise that will provide a list of {@code SourceEstimation} for the given {@code workspaceId} and {@code path},
|
||||
|
|
@ -136,40 +138,11 @@ public interface ProjectServiceClient {
|
|||
*/
|
||||
Promise<List<SourceEstimation>> resolveSources(DevMachine devMachine, String path);
|
||||
|
||||
/**
|
||||
* Get sub-project.
|
||||
*
|
||||
* @param workspaceId
|
||||
* id of current workspace
|
||||
* @param path
|
||||
* path to the parent project
|
||||
* @param callback
|
||||
* the callback to use for the response
|
||||
*/
|
||||
void getModules(DevMachine devMachine, String path, AsyncRequestCallback<List<ProjectConfigDto>> callback);
|
||||
|
||||
/**
|
||||
* Create sub-project.
|
||||
*
|
||||
* @param workspaceId
|
||||
* id of current workspace
|
||||
* @param parentProjectPath
|
||||
* path to the parent project
|
||||
* @param projectConfig
|
||||
* descriptor of the project to create
|
||||
* @param callback
|
||||
* the callback to use for the response
|
||||
*/
|
||||
void createModule(DevMachine devMachine,
|
||||
String parentProjectPath,
|
||||
ProjectConfigDto projectConfig,
|
||||
AsyncRequestCallback<ProjectConfigDto> callback);
|
||||
|
||||
/**
|
||||
* Update project.
|
||||
*
|
||||
* @param workspaceId
|
||||
* id of current workspace
|
||||
* @param devMachine
|
||||
* of current devMachine
|
||||
* @param path
|
||||
* path to the project to get
|
||||
* @param descriptor
|
||||
|
|
@ -184,8 +157,8 @@ public interface ProjectServiceClient {
|
|||
/**
|
||||
* Update project.
|
||||
*
|
||||
* @param workspaceId
|
||||
* id of current workspace
|
||||
* @param devMachine
|
||||
* of current devMachine
|
||||
* @param path
|
||||
* path to the project to get
|
||||
* @param descriptor
|
||||
|
|
@ -198,8 +171,8 @@ public interface ProjectServiceClient {
|
|||
/**
|
||||
* Create new file in the specified folder.
|
||||
*
|
||||
* @param workspaceId
|
||||
* id of current workspace
|
||||
* @param devMachine
|
||||
* of current devMachine
|
||||
* @param parentPath
|
||||
* path to parent for new file
|
||||
* @param name
|
||||
|
|
@ -214,8 +187,8 @@ public interface ProjectServiceClient {
|
|||
/**
|
||||
* Get file content.
|
||||
*
|
||||
* @param workspaceId
|
||||
* id of current workspace
|
||||
* @param devMachine
|
||||
* of current devMachine
|
||||
* @param path
|
||||
* path to file
|
||||
* @param callback
|
||||
|
|
@ -226,8 +199,8 @@ public interface ProjectServiceClient {
|
|||
/**
|
||||
* Update file content.
|
||||
*
|
||||
* @param workspaceId
|
||||
* id of current workspace
|
||||
* @param devMachine
|
||||
* of current devMachine
|
||||
* @param path
|
||||
* path to file
|
||||
* @param content
|
||||
|
|
@ -240,8 +213,8 @@ public interface ProjectServiceClient {
|
|||
/**
|
||||
* Create new folder in the specified folder.
|
||||
*
|
||||
* @param workspaceId
|
||||
* id of current workspace
|
||||
* @param devMachine
|
||||
* of current devMachine
|
||||
* @param path
|
||||
* path to parent for new folder
|
||||
* @param callback
|
||||
|
|
@ -252,8 +225,8 @@ public interface ProjectServiceClient {
|
|||
/**
|
||||
* Delete item.
|
||||
*
|
||||
* @param workspaceId
|
||||
* id of current workspace
|
||||
* @param devMachine
|
||||
* of current devMachine
|
||||
* @param path
|
||||
* path to item to delete
|
||||
* @param callback
|
||||
|
|
@ -261,25 +234,11 @@ public interface ProjectServiceClient {
|
|||
*/
|
||||
void delete(DevMachine devMachine, String path, AsyncRequestCallback<Void> callback);
|
||||
|
||||
/**
|
||||
* Delete module.
|
||||
*
|
||||
* @param workspaceId
|
||||
* id of current workspace
|
||||
* @param pathToParent
|
||||
* path to module's parent
|
||||
* @param modulePath
|
||||
* path to module to delete
|
||||
* @param callback
|
||||
* the callback to use for the response
|
||||
*/
|
||||
void deleteModule(DevMachine devMachine, String pathToParent, String modulePath, AsyncRequestCallback<Void> callback);
|
||||
|
||||
/**
|
||||
/**
|
||||
* Copy an item with new name to the specified target path. Original item name is used if new name isn't set.
|
||||
*
|
||||
* @param workspaceId
|
||||
* id of current workspace
|
||||
* @param devMachine
|
||||
* of current devMachine
|
||||
* @param path
|
||||
* path to the item to copy
|
||||
* @param newParentPath
|
||||
|
|
@ -294,8 +253,8 @@ public interface ProjectServiceClient {
|
|||
/**
|
||||
* Move an item to the specified target path. Set new name to rename the resource when moving.
|
||||
*
|
||||
* @param workspaceId
|
||||
* id of current workspace
|
||||
* @param devMachine
|
||||
* of current devMachine
|
||||
* @param path
|
||||
* path to the item to move
|
||||
* @param newParentPath
|
||||
|
|
@ -310,8 +269,8 @@ public interface ProjectServiceClient {
|
|||
/**
|
||||
* Rename and/or set new media type for item.
|
||||
*
|
||||
* @param workspaceId
|
||||
* id of current workspace
|
||||
* @param devMachine
|
||||
* of current devMachine
|
||||
* @param path
|
||||
* path to the item to rename
|
||||
* @param newName
|
||||
|
|
@ -326,8 +285,8 @@ public interface ProjectServiceClient {
|
|||
/**
|
||||
* Import sources into project.
|
||||
*
|
||||
* @param workspaceId
|
||||
* id of current workspace
|
||||
* @param devMachine
|
||||
* of current devMachine
|
||||
* @param path
|
||||
* path to the project to import sources
|
||||
* @param force
|
||||
|
|
@ -342,8 +301,8 @@ public interface ProjectServiceClient {
|
|||
/**
|
||||
* Import sources into project.
|
||||
*
|
||||
* @param workspaceId
|
||||
* id of current workspace
|
||||
* @param devMachine
|
||||
* of current devMachine
|
||||
* @param path
|
||||
* path to the project to import sources
|
||||
* @param force
|
||||
|
|
@ -357,8 +316,8 @@ public interface ProjectServiceClient {
|
|||
/**
|
||||
* Get children for the specified path.
|
||||
*
|
||||
* @param workspaceId
|
||||
* id of current workspace
|
||||
* @param devMachine
|
||||
* of current devMachine
|
||||
* @param path
|
||||
* path to get its children
|
||||
* @param callback
|
||||
|
|
@ -369,8 +328,8 @@ public interface ProjectServiceClient {
|
|||
/**
|
||||
* Get folders tree starts from the specified path.
|
||||
*
|
||||
* @param workspaceId
|
||||
* id of current workspace
|
||||
* @param devMachine
|
||||
* of current devMachine
|
||||
* @param path
|
||||
* path to get its folder tree
|
||||
* @param depth
|
||||
|
|
@ -383,8 +342,8 @@ public interface ProjectServiceClient {
|
|||
/**
|
||||
* Search an item(s) by the specified criteria.
|
||||
*
|
||||
* @param workspaceId
|
||||
* id of current workspace
|
||||
* @param devMachine
|
||||
* of current devMachine
|
||||
* @param expression
|
||||
* search query expression
|
||||
* @return a promise that will provide a list of {@link ItemReference}s, or rejects with an error
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ public class ProjectServiceClientImpl implements ProjectServiceClient {
|
|||
|
||||
@Override
|
||||
public void getProjects(DevMachine devMachine, AsyncRequestCallback<List<ProjectConfigDto>> callback) {
|
||||
String requestUrl = devMachine.getWsAgentBaseUrl() + "/project/" + devMachine.getWorkspace();
|
||||
String requestUrl = devMachine.getWsAgentBaseUrl() + "/project";
|
||||
asyncRequestFactory.createGetRequest(requestUrl)
|
||||
.header(ACCEPT, MimeType.APPLICATION_JSON)
|
||||
.loader(loaderFactory.newLoader("Getting projects..."))
|
||||
|
|
@ -102,7 +102,7 @@ public class ProjectServiceClientImpl implements ProjectServiceClient {
|
|||
|
||||
@Override
|
||||
public void getProject(DevMachine devMachine, String path, AsyncRequestCallback<ProjectConfigDto> callback) {
|
||||
final String requestUrl = devMachine.getWsAgentBaseUrl() + "/project/" + devMachine.getWorkspace() + normalizePath(path);
|
||||
final String requestUrl = devMachine.getWsAgentBaseUrl() + "/project/" + normalizePath(path);
|
||||
asyncRequestFactory.createGetRequest(requestUrl)
|
||||
.header(ACCEPT, MimeType.APPLICATION_JSON)
|
||||
.loader(loaderFactory.newLoader("Getting project..."))
|
||||
|
|
@ -111,7 +111,7 @@ public class ProjectServiceClientImpl implements ProjectServiceClient {
|
|||
|
||||
@Override
|
||||
public Promise<ProjectConfigDto> getProject(DevMachine devMachine, String path) {
|
||||
final String requestUrl = devMachine.getWsAgentBaseUrl() + "/project/" + devMachine.getWorkspace() + normalizePath(path);
|
||||
final String requestUrl = devMachine.getWsAgentBaseUrl() + "/project" + normalizePath(path);
|
||||
return asyncRequestFactory.createGetRequest(requestUrl)
|
||||
.header(ACCEPT, MimeType.APPLICATION_JSON)
|
||||
.loader(loaderFactory.newLoader("Getting project..."))
|
||||
|
|
@ -120,7 +120,7 @@ public class ProjectServiceClientImpl implements ProjectServiceClient {
|
|||
|
||||
@Override
|
||||
public void getItem(DevMachine devMachine, String path, AsyncRequestCallback<ItemReference> callback) {
|
||||
final String requestUrl = devMachine.getWsAgentBaseUrl() + "/project/" + devMachine.getWorkspace() + "/item" + normalizePath(path);
|
||||
final String requestUrl = devMachine.getWsAgentBaseUrl() + "/project/item" + normalizePath(path);
|
||||
asyncRequestFactory.createGetRequest(requestUrl)
|
||||
.header(ACCEPT, MimeType.APPLICATION_JSON)
|
||||
.loader(loaderFactory.newLoader("Getting item..."))
|
||||
|
|
@ -131,7 +131,7 @@ public class ProjectServiceClientImpl implements ProjectServiceClient {
|
|||
public void createProject(DevMachine devMachine,
|
||||
ProjectConfigDto projectConfig,
|
||||
AsyncRequestCallback<ProjectConfigDto> callback) {
|
||||
final String requestUrl = devMachine.getWsAgentBaseUrl() + "/project/" + devMachine.getWorkspace();
|
||||
final String requestUrl = devMachine.getWsAgentBaseUrl() + "/project";
|
||||
asyncRequestFactory.createPostRequest(requestUrl, projectConfig)
|
||||
.header(ACCEPT, MimeType.APPLICATION_JSON)
|
||||
.loader(loaderFactory.newLoader("Creating project..."))
|
||||
|
|
@ -143,7 +143,7 @@ public class ProjectServiceClientImpl implements ProjectServiceClient {
|
|||
String path,
|
||||
String projectType,
|
||||
AsyncRequestCallback<SourceEstimation> callback) {
|
||||
final String requestUrl = devMachine.getWsAgentBaseUrl() + "/project/" + devMachine.getWorkspace() + "/estimate" + normalizePath(path)
|
||||
final String requestUrl = devMachine.getWsAgentBaseUrl() + "/project/estimate" + normalizePath(path)
|
||||
+ "?type=" + projectType;
|
||||
asyncRequestFactory.createGetRequest(requestUrl)
|
||||
.header(ACCEPT, MimeType.APPLICATION_JSON)
|
||||
|
|
@ -153,7 +153,7 @@ public class ProjectServiceClientImpl implements ProjectServiceClient {
|
|||
|
||||
@Override
|
||||
public void resolveSources(DevMachine devMachine, String path, AsyncRequestCallback<List<SourceEstimation>> callback) {
|
||||
final String requestUrl = devMachine.getWsAgentBaseUrl() + "/project/" + devMachine.getWorkspace() + "/resolve" + normalizePath(path);
|
||||
final String requestUrl = devMachine.getWsAgentBaseUrl() + "/project/resolve" + normalizePath(path);
|
||||
asyncRequestFactory.createGetRequest(requestUrl)
|
||||
.header(ACCEPT, MimeType.APPLICATION_JSON)
|
||||
.loader(loaderFactory.newLoader("Resolving sources..."))
|
||||
|
|
@ -162,7 +162,7 @@ public class ProjectServiceClientImpl implements ProjectServiceClient {
|
|||
|
||||
@Override
|
||||
public Promise<List<SourceEstimation>> resolveSources(DevMachine devMachine, String path) {
|
||||
final String requestUrl = devMachine.getWsAgentBaseUrl() + "/project/" + devMachine.getWorkspace() + "/resolve" + normalizePath(path);
|
||||
final String requestUrl = devMachine.getWsAgentBaseUrl() + "/project/resolve" + normalizePath(path);
|
||||
return asyncRequestFactory.createGetRequest(requestUrl)
|
||||
.header(ACCEPT, MimeType.APPLICATION_JSON)
|
||||
.loader(loaderFactory.newLoader("Resolving sources..."))
|
||||
|
|
@ -170,33 +170,12 @@ public class ProjectServiceClientImpl implements ProjectServiceClient {
|
|||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void getModules(DevMachine devMachine, String path, AsyncRequestCallback<List<ProjectConfigDto>> callback) {
|
||||
final String requestUrl = devMachine.getWsAgentBaseUrl() + "/project/" + devMachine.getWorkspace() + "/modules" + normalizePath(path);
|
||||
asyncRequestFactory.createGetRequest(requestUrl)
|
||||
.header(ACCEPT, MimeType.APPLICATION_JSON)
|
||||
.loader(loaderFactory.newLoader("Getting modules..."))
|
||||
.send(callback);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createModule(DevMachine devMachine,
|
||||
String parentProjectPath,
|
||||
ProjectConfigDto projectConfig,
|
||||
AsyncRequestCallback<ProjectConfigDto> callback) {
|
||||
final String requestUrl = devMachine.getWsAgentBaseUrl() + "/project/" + devMachine.getWorkspace() + normalizePath(parentProjectPath);
|
||||
asyncRequestFactory.createPostRequest(requestUrl, projectConfig)
|
||||
.header(ACCEPT, MimeType.APPLICATION_JSON)
|
||||
.loader(loaderFactory.newLoader("Creating module..."))
|
||||
.send(callback);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateProject(DevMachine devMachine,
|
||||
String path,
|
||||
ProjectConfigDto projectConfig,
|
||||
AsyncRequestCallback<ProjectConfigDto> callback) {
|
||||
final String requestUrl = devMachine.getWsAgentBaseUrl() + "/project/" + devMachine.getWorkspace() + normalizePath(path);
|
||||
final String requestUrl = devMachine.getWsAgentBaseUrl() + "/project" + normalizePath(path);
|
||||
asyncRequestFactory.createRequest(PUT, requestUrl, projectConfig, false)
|
||||
.header(CONTENT_TYPE, MimeType.APPLICATION_JSON)
|
||||
.header(ACCEPT, MimeType.APPLICATION_JSON)
|
||||
|
|
@ -206,7 +185,7 @@ public class ProjectServiceClientImpl implements ProjectServiceClient {
|
|||
|
||||
@Override
|
||||
public Promise<ProjectConfigDto> updateProject(DevMachine devMachine, String path, ProjectConfigDto projectConfig) {
|
||||
final String requestUrl = devMachine.getWsAgentBaseUrl() + "/project/" + devMachine.getWorkspace() + normalizePath(path);
|
||||
final String requestUrl = devMachine.getWsAgentBaseUrl() + "/project" + normalizePath(path);
|
||||
return asyncRequestFactory.createRequest(PUT, requestUrl, projectConfig, false)
|
||||
.header(CONTENT_TYPE, MimeType.APPLICATION_JSON)
|
||||
.header(ACCEPT, MimeType.APPLICATION_JSON)
|
||||
|
|
@ -220,7 +199,7 @@ public class ProjectServiceClientImpl implements ProjectServiceClient {
|
|||
String name,
|
||||
String content,
|
||||
AsyncRequestCallback<ItemReference> callback) {
|
||||
final String requestUrl = devMachine.getWsAgentBaseUrl() + "/project/" + devMachine.getWorkspace() + "/file" + normalizePath(parentPath) +
|
||||
final String requestUrl = devMachine.getWsAgentBaseUrl() + "/project/file" + normalizePath(parentPath) +
|
||||
"?name=" + name;
|
||||
asyncRequestFactory.createPostRequest(requestUrl, null)
|
||||
.data(content)
|
||||
|
|
@ -230,7 +209,7 @@ public class ProjectServiceClientImpl implements ProjectServiceClient {
|
|||
|
||||
@Override
|
||||
public void getFileContent(DevMachine devMachine, String path, AsyncRequestCallback<String> callback) {
|
||||
final String requestUrl = devMachine.getWsAgentBaseUrl() + "/project/" + devMachine.getWorkspace() + "/file" + normalizePath(path);
|
||||
final String requestUrl = devMachine.getWsAgentBaseUrl() + "/project/file" + normalizePath(path);
|
||||
asyncRequestFactory.createGetRequest(requestUrl)
|
||||
.loader(loaderFactory.newLoader("Loading file content..."))
|
||||
.send(callback);
|
||||
|
|
@ -238,7 +217,7 @@ public class ProjectServiceClientImpl implements ProjectServiceClient {
|
|||
|
||||
@Override
|
||||
public void updateFile(DevMachine devMachine, String path, String content, AsyncRequestCallback<Void> callback) {
|
||||
final String requestUrl = devMachine.getWsAgentBaseUrl() + "/project/" + devMachine.getWorkspace() + "/file" + normalizePath(path);
|
||||
final String requestUrl = devMachine.getWsAgentBaseUrl() + "/project/file" + normalizePath(path);
|
||||
asyncRequestFactory.createRequest(PUT, requestUrl, null, false)
|
||||
.data(content)
|
||||
.loader(loaderFactory.newLoader("Updating file..."))
|
||||
|
|
@ -247,7 +226,7 @@ public class ProjectServiceClientImpl implements ProjectServiceClient {
|
|||
|
||||
@Override
|
||||
public void createFolder(DevMachine devMachine, String path, AsyncRequestCallback<ItemReference> callback) {
|
||||
final String requestUrl = devMachine.getWsAgentBaseUrl() + "/project/" + devMachine.getWorkspace() + "/folder" + normalizePath(path);
|
||||
final String requestUrl = devMachine.getWsAgentBaseUrl() + "/project/folder" + normalizePath(path);
|
||||
asyncRequestFactory.createPostRequest(requestUrl, null)
|
||||
.loader(loaderFactory.newLoader("Creating folder..."))
|
||||
.send(callback);
|
||||
|
|
@ -255,24 +234,15 @@ public class ProjectServiceClientImpl implements ProjectServiceClient {
|
|||
|
||||
@Override
|
||||
public void delete(DevMachine devMachine, String path, AsyncRequestCallback<Void> callback) {
|
||||
final String requestUrl = devMachine.getWsAgentBaseUrl() + "/project/" + devMachine.getWorkspace() + normalizePath(path);
|
||||
final String requestUrl = devMachine.getWsAgentBaseUrl() + "/project" + normalizePath(path);
|
||||
asyncRequestFactory.createRequest(DELETE, requestUrl, null, false)
|
||||
.loader(loaderFactory.newLoader("Deleting project..."))
|
||||
.send(callback);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteModule(DevMachine devMachine, String pathToParent, String modulePath, AsyncRequestCallback<Void> callback) {
|
||||
final String requestUrl = devMachine.getWsAgentBaseUrl() + "/project/" + devMachine.getWorkspace() + "/module" + normalizePath(pathToParent)
|
||||
+ "?module=" + modulePath;
|
||||
asyncRequestFactory.createRequest(DELETE, requestUrl, null, false)
|
||||
.loader(loaderFactory.newLoader("Deleting module..."))
|
||||
.send(callback);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void copy(DevMachine devMachine, String path, String newParentPath, String newName, AsyncRequestCallback<Void> callback) {
|
||||
final String requestUrl = devMachine.getWsAgentBaseUrl() + "/project/" + devMachine.getWorkspace() + "/copy" + normalizePath(path) +
|
||||
final String requestUrl = devMachine.getWsAgentBaseUrl() + "/project/copy" + normalizePath(path) +
|
||||
"?to=" + newParentPath;
|
||||
|
||||
final CopyOptions copyOptions = dtoFactory.createDto(CopyOptions.class);
|
||||
|
|
@ -286,7 +256,7 @@ public class ProjectServiceClientImpl implements ProjectServiceClient {
|
|||
|
||||
@Override
|
||||
public void move(DevMachine devMachine, String path, String newParentPath, String newName, AsyncRequestCallback<Void> callback) {
|
||||
final String requestUrl = devMachine.getWsAgentBaseUrl() + "/project/" + devMachine.getWorkspace() + "/move" + normalizePath(path)
|
||||
final String requestUrl = devMachine.getWsAgentBaseUrl() + "/project/move" + normalizePath(path)
|
||||
+ "?to=" + newParentPath;
|
||||
|
||||
final MoveOptions moveOptions = dtoFactory.createDto(MoveOptions.class);
|
||||
|
|
@ -311,7 +281,7 @@ public class ProjectServiceClientImpl implements ProjectServiceClient {
|
|||
boolean force,
|
||||
SourceStorageDto sourceStorage,
|
||||
RequestCallback<Void> callback) {
|
||||
final StringBuilder requestUrl = new StringBuilder("/project/" + devMachine.getWorkspace());
|
||||
final StringBuilder requestUrl = new StringBuilder("/project");
|
||||
requestUrl.append("/import").append(normalizePath(path));
|
||||
if (force) {
|
||||
requestUrl.append("?force=true");
|
||||
|
|
@ -335,7 +305,7 @@ public class ProjectServiceClientImpl implements ProjectServiceClient {
|
|||
return PromiseHelper.newPromise(new AsyncPromiseHelper.RequestCall<Void>() {
|
||||
@Override
|
||||
public void makeCall(final AsyncCallback<Void> callback) {
|
||||
final StringBuilder requestUrl = new StringBuilder("/project/" + devMachine.getWorkspace());
|
||||
final StringBuilder requestUrl = new StringBuilder("/project");
|
||||
requestUrl.append("/import").append(normalizePath(path));
|
||||
if (force) {
|
||||
requestUrl.append("?force=true");
|
||||
|
|
@ -388,7 +358,7 @@ public class ProjectServiceClientImpl implements ProjectServiceClient {
|
|||
|
||||
@Override
|
||||
public void getChildren(DevMachine devMachine, String path, AsyncRequestCallback<List<ItemReference>> callback) {
|
||||
final String requestUrl = devMachine.getWsAgentBaseUrl() + "/project/" + devMachine.getWorkspace() + "/children" + normalizePath(path);
|
||||
final String requestUrl = devMachine.getWsAgentBaseUrl() + "/project/children" + normalizePath(path);
|
||||
asyncRequestFactory.createGetRequest(requestUrl)
|
||||
.header(ACCEPT, MimeType.APPLICATION_JSON)
|
||||
.send(callback);
|
||||
|
|
@ -396,7 +366,7 @@ public class ProjectServiceClientImpl implements ProjectServiceClient {
|
|||
|
||||
@Override
|
||||
public void getTree(DevMachine devMachine, String path, int depth, AsyncRequestCallback<TreeElement> callback) {
|
||||
final String requestUrl = devMachine.getWsAgentBaseUrl() + "/project/" + devMachine.getWorkspace() + "/tree" + normalizePath(path) +
|
||||
final String requestUrl = devMachine.getWsAgentBaseUrl() + "/project/tree" + normalizePath(path) +
|
||||
"?depth=" + depth;
|
||||
asyncRequestFactory.createGetRequest(requestUrl)
|
||||
.header(ACCEPT, MimeType.APPLICATION_JSON)
|
||||
|
|
@ -406,7 +376,7 @@ public class ProjectServiceClientImpl implements ProjectServiceClient {
|
|||
|
||||
@Override
|
||||
public Promise<List<ItemReference>> search(DevMachine devMachine, QueryExpression expression) {
|
||||
StringBuilder requestUrl = new StringBuilder(devMachine.getWsAgentBaseUrl() + "/project/" + devMachine.getWorkspace() + "/search");
|
||||
StringBuilder requestUrl = new StringBuilder(devMachine.getWsAgentBaseUrl() + "/project/search");
|
||||
if (expression.getPath() != null) {
|
||||
requestUrl.append(normalizePath(expression.getPath()));
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ public class ProjectTypeServiceClientImpl implements ProjectTypeServiceClient {
|
|||
}
|
||||
|
||||
private void getProjectTypes(DevMachine devMachine, @NotNull AsyncCallback<List<ProjectTypeDto>> callback) {
|
||||
final String url = devMachine.getWsAgentBaseUrl() + "/project-type/" + devMachine.getWorkspace();
|
||||
final String url = devMachine.getWsAgentBaseUrl() + "/project-type";
|
||||
asyncRequestFactory.createGetRequest(url)
|
||||
.header(ACCEPT, APPLICATION_JSON)
|
||||
.loader(loaderFactory.newLoader("Getting info about registered project types..."))
|
||||
|
|
@ -89,7 +89,7 @@ public class ProjectTypeServiceClientImpl implements ProjectTypeServiceClient {
|
|||
}
|
||||
|
||||
private void getProjectType(@NotNull DevMachine devMachine, @NotNull String id, @NotNull AsyncCallback<ProjectTypeDto> callback) {
|
||||
final String url = devMachine.getWsAgentBaseUrl() + "/project-type/" + devMachine.getWorkspace() + '/' + id;
|
||||
final String url = devMachine.getWsAgentBaseUrl() + "/project-type/" + id;
|
||||
asyncRequestFactory.createGetRequest(url)
|
||||
.header(ACCEPT, APPLICATION_JSON)
|
||||
.loader(loaderFactory.newLoader("Getting info about project type..."))
|
||||
|
|
|
|||
|
|
@ -169,56 +169,9 @@ public class ProjectNode extends AbstractTreeNode<ProjectConfigDto> implements S
|
|||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public void refreshChildren(final AsyncCallback<TreeNode<?>> callback) {
|
||||
getModules(getData(), new AsyncCallback<List<ProjectConfigDto>>() {
|
||||
@Override
|
||||
public void onSuccess(final List<ProjectConfigDto> modules) {
|
||||
getChildren(getData().getPath(), new AsyncCallback<List<ItemReference>>() {
|
||||
@Override
|
||||
public void onSuccess(List<ItemReference> childItems) {
|
||||
setChildren(getChildNodesForItems(childItems, modules));
|
||||
callback.onSuccess(ProjectNode.this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
callback.onFailure(caught);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
//can be if pom.xml not found
|
||||
getChildren(getData().getPath(), new AsyncCallback<List<ItemReference>>() {
|
||||
@Override
|
||||
public void onSuccess(List<ItemReference> childItems) {
|
||||
callback.onSuccess(ProjectNode.this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
callback.onFailure(caught);
|
||||
}
|
||||
});
|
||||
callback.onFailure(caught);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected void getModules(ProjectConfigDto project, final AsyncCallback<List<ProjectConfigDto>> callback) {
|
||||
final Unmarshallable<List<ProjectConfigDto>> unmarshaller = dtoUnmarshallerFactory.newListUnmarshaller(ProjectConfigDto.class);
|
||||
projectServiceClient.getModules(appContext.getDevMachine(), project.getPath(), new AsyncRequestCallback<List<ProjectConfigDto>>(unmarshaller) {
|
||||
@Override
|
||||
protected void onSuccess(List<ProjectConfigDto> result) {
|
||||
callback.onSuccess(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onFailure(Throwable exception) {
|
||||
callback.onFailure(exception);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private List<TreeNode<?>> getChildNodesForItems(List<ItemReference> childItems, List<ProjectConfigDto> modules) {
|
||||
List<TreeNode<?>> oldChildren = getChildren();
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@
|
|||
<inherits name="com.google.gwt.user.Debug"/>
|
||||
<inherits name="org.vectomatic.libgwtsvg"/>
|
||||
<inherits name="org.eclipse.che.api.promises.Promises"/>
|
||||
<inherits name="org.eclipse.che.api.project.Project"/>
|
||||
|
||||
<source path="api"/>
|
||||
</module>
|
||||
|
|
|
|||
|
|
@ -79,7 +79,6 @@ public class DeleteItemAction extends AbstractPerspectiveAction implements Promi
|
|||
private final GitServiceClient gitService;
|
||||
private final CoreLocalizationConstant locale;
|
||||
private final NotificationManager notificationManager;
|
||||
private final String workspaceId;
|
||||
|
||||
private Callback<Void, Throwable> actionCompletedCallBack;
|
||||
|
||||
|
|
@ -109,8 +108,6 @@ public class DeleteItemAction extends AbstractPerspectiveAction implements Promi
|
|||
this.gitService = gitServiceClient;
|
||||
this.locale = coreLocalizationConstant;
|
||||
this.notificationManager = notificationManager;
|
||||
|
||||
this.workspaceId = appContext.getWorkspaceId();
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ public class DownloadAsZipAction extends AbstractPerspectiveAction {
|
|||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
String url = appContext.getDevMachine().getWsAgentBaseUrl() + "/project/" + appContext.getWorkspaceId() + "/export/" + getPath();
|
||||
String url = appContext.getDevMachine().getWsAgentBaseUrl() + "/project/export/" + getPath();
|
||||
downloadContainer.setUrl(url);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@ import org.eclipse.che.ide.api.selection.Selection;
|
|||
import org.eclipse.che.ide.api.selection.SelectionAgent;
|
||||
import org.eclipse.che.ide.project.node.FileReferenceNode;
|
||||
import org.eclipse.che.ide.project.node.FolderReferenceNode;
|
||||
import org.eclipse.che.ide.project.node.ModuleNode;
|
||||
import org.eclipse.che.ide.project.node.ProjectNode;
|
||||
import org.eclipse.che.ide.project.node.ResourceBasedNode;
|
||||
import org.eclipse.che.ide.api.dialogs.CancelCallback;
|
||||
|
|
@ -111,10 +110,9 @@ public class RenameItemAction extends AbstractPerspectiveAction {
|
|||
|
||||
final Object possibleNode = selection.getHeadElement();
|
||||
|
||||
boolean isModuleNode = possibleNode instanceof ModuleNode;
|
||||
boolean isSupportRename = possibleNode instanceof SupportRename;
|
||||
|
||||
boolean enable = !isModuleNode && isSupportRename && ((SupportRename)possibleNode).getRenameProcessor() != null;
|
||||
boolean enable = isSupportRename && ((SupportRename)possibleNode).getRenameProcessor() != null;
|
||||
|
||||
e.getPresentation().setEnabled(enable);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,7 +56,6 @@ import org.eclipse.che.ide.project.event.ResourceNodeRenamedEvent;
|
|||
import org.eclipse.che.ide.project.node.FileReferenceNode;
|
||||
import org.eclipse.che.ide.project.node.FolderReferenceNode;
|
||||
import org.eclipse.che.ide.project.node.ItemReferenceBasedNode;
|
||||
import org.eclipse.che.ide.project.node.ModuleNode;
|
||||
import org.eclipse.che.ide.project.node.NodeManager;
|
||||
import org.eclipse.che.ide.project.node.ResourceBasedNode;
|
||||
import org.eclipse.che.ide.resource.Path;
|
||||
|
|
@ -180,23 +179,6 @@ public class EditorAgentImpl implements EditorAgent {
|
|||
eventBus.fireEvent(new FileEvent(editor.getEditorInput().getFile(), CLOSE));
|
||||
}
|
||||
}
|
||||
} else if (node instanceof ModuleNode) {
|
||||
for (EditorPartPresenter editor : openedEditors) {
|
||||
VirtualFile virtualFile = editor.getEditorInput().getFile();
|
||||
if (moduleHasFile(node.getProjectConfig(), virtualFile)) {
|
||||
eventBus.fireEvent(new FileEvent(virtualFile, CLOSE));
|
||||
}
|
||||
if (node.getParent() == null || !(node.getParent() instanceof HasStorablePath)) {
|
||||
return;
|
||||
}
|
||||
|
||||
String parentPath = ((HasStorablePath)node.getParent()).getStorablePath();
|
||||
String openFileName = virtualFile.getName();
|
||||
String openFilePath = virtualFile.getPath();
|
||||
if (openFilePath.contains(parentPath) && openFileName.equals("modules")) {
|
||||
eventBus.fireEvent(new FileContentUpdateEvent(openFilePath));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
@ -217,15 +199,10 @@ public class EditorAgentImpl implements EditorAgent {
|
|||
public void onResourceRenamedEvent(ResourceNodeRenamedEvent event) {
|
||||
ResourceBasedNode<?> resourceBaseNode = event.getNode();
|
||||
|
||||
if (resourceBaseNode instanceof FolderReferenceNode || resourceBaseNode instanceof ModuleNode) {
|
||||
if (resourceBaseNode instanceof FolderReferenceNode) {
|
||||
HasStorablePath renamedTargetStoragePath = ((HasStorablePath)resourceBaseNode);
|
||||
final String oldTargetPath = renamedTargetStoragePath.getStorablePath();
|
||||
final String newTargetPath;
|
||||
if (resourceBaseNode instanceof FolderReferenceNode) {
|
||||
newTargetPath = ((ItemReference)event.getNewDataObject()).getPath();
|
||||
} else {
|
||||
newTargetPath = ((ProjectConfigDto)event.getNewDataObject()).getPath();
|
||||
}
|
||||
final String newTargetPath = ((ItemReference)event.getNewDataObject()).getPath();
|
||||
final Unmarshallable<ItemReference> unmarshaller = unmarshallerFactory.newUnmarshaller(ItemReference.class);
|
||||
updateEditorPartsAfterRename(new LinkedList<>(openedEditors),
|
||||
oldTargetPath,
|
||||
|
|
|
|||
|
|
@ -71,7 +71,6 @@ import org.eclipse.che.ide.project.event.ResourceNodeRenamedEvent.ResourceNodeRe
|
|||
import org.eclipse.che.ide.project.node.FileReferenceNode;
|
||||
import org.eclipse.che.ide.project.node.FolderReferenceNode;
|
||||
import org.eclipse.che.ide.project.node.ItemReferenceBasedNode;
|
||||
import org.eclipse.che.ide.project.node.ModuleNode;
|
||||
import org.eclipse.che.ide.project.node.NodeManager;
|
||||
import org.eclipse.che.ide.project.node.ProjectNode;
|
||||
import org.eclipse.che.ide.projecttype.wizard.presenter.ProjectWizardPresenter;
|
||||
|
|
@ -398,13 +397,8 @@ public class ProjectExplorerPresenter extends BasePresenter implements ActionDel
|
|||
editorAgentProvider.get().updateEditorNode(node.getData().getPath(), (FileReferenceNode)wrapped);
|
||||
}
|
||||
|
||||
node.setData(newDTO);
|
||||
} else if (event.getNode() instanceof ModuleNode) {
|
||||
ProjectConfigDto newDTO = (ProjectConfigDto)event.getNewDataObject();
|
||||
ModuleNode node = (ModuleNode)event.getNode();
|
||||
node.setData(newDTO);
|
||||
}
|
||||
|
||||
if (!view.reIndex(oldNodeId, event.getNode())) {
|
||||
Log.info(getClass(), "Node wasn't re-indexed");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,120 +0,0 @@
|
|||
/*******************************************************************************
|
||||
* 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.ide.project.node;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.assistedinject.Assisted;
|
||||
import com.google.web.bindery.event.shared.EventBus;
|
||||
|
||||
import org.eclipse.che.api.promises.client.Promise;
|
||||
import org.eclipse.che.api.workspace.shared.dto.ProjectConfigDto;
|
||||
import org.eclipse.che.commons.annotation.Nullable;
|
||||
import org.eclipse.che.ide.api.project.node.HasStorablePath;
|
||||
import org.eclipse.che.ide.api.project.node.Node;
|
||||
import org.eclipse.che.ide.api.project.node.resource.DeleteProcessor;
|
||||
import org.eclipse.che.ide.api.project.node.resource.RenameProcessor;
|
||||
import org.eclipse.che.ide.api.project.node.settings.NodeSettings;
|
||||
import org.eclipse.che.ide.project.node.resource.ModuleConfigProcessor;
|
||||
import org.eclipse.che.ide.ui.smartTree.presentation.NodePresentation;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Vlad Zhukovskiy
|
||||
* @author Dmitry Shnurenko
|
||||
* @deprecated will be removed after release GA
|
||||
*/
|
||||
@Deprecated
|
||||
public class ModuleNode extends ResourceBasedNode<ProjectConfigDto> implements HasStorablePath {
|
||||
|
||||
private final ModuleConfigProcessor resourceProcessor;
|
||||
private final ProjectConfigDto projectConfigDto;
|
||||
|
||||
@Inject
|
||||
public ModuleNode(@Assisted ProjectConfigDto projectConfigDto,
|
||||
@Assisted NodeSettings nodeSettings,
|
||||
EventBus eventBus,
|
||||
NodeManager nodeManager,
|
||||
ModuleConfigProcessor resourceProcessor) {
|
||||
super(projectConfigDto, projectConfigDto, nodeSettings, eventBus, nodeManager);
|
||||
this.resourceProcessor = resourceProcessor;
|
||||
this.projectConfigDto = projectConfigDto;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected Promise<List<Node>> getChildrenImpl() {
|
||||
return nodeManager.getChildren(projectConfigDto.getPath(), getProjectConfig(), getSettings());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updatePresentation(@NotNull NodePresentation presentation) {
|
||||
presentation.setPresentableText(getData().getName());
|
||||
presentation.setPresentableIcon(nodeManager.getNodesResources().moduleFolder());
|
||||
presentation.setPresentableTextCss("font-weight:bold");
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String getName() {
|
||||
return getData().getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLeaf() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public DeleteProcessor<ProjectConfigDto> getDeleteProcessor() {
|
||||
return resourceProcessor;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public RenameProcessor<ProjectConfigDto> getRenameProcessor() {
|
||||
return resourceProcessor;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String getStorablePath() {
|
||||
if (getParent() == null || !(getParent() instanceof HasStorablePath)) {
|
||||
return getData().getPath();
|
||||
}
|
||||
|
||||
return ((HasStorablePath)getParent()).getStorablePath() + "/" + getData().getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportGoInto() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (!(o instanceof HasStorablePath)) return false;
|
||||
|
||||
HasStorablePath that = (HasStorablePath)o;
|
||||
|
||||
if (!getStorablePath().equals(that.getStorablePath())) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return getStorablePath().hashCode();
|
||||
}
|
||||
}
|
||||
|
|
@ -325,7 +325,7 @@ public class NodeManager {
|
|||
|
||||
@Deprecated
|
||||
public static boolean isProjectOrModuleNode(Node node) {
|
||||
return node instanceof ProjectNode || node instanceof ModuleNode;
|
||||
return node instanceof ProjectNode;
|
||||
}
|
||||
|
||||
protected <T> Function<T, Promise<T>> self() {
|
||||
|
|
|
|||
|
|
@ -1,88 +0,0 @@
|
|||
/*******************************************************************************
|
||||
* 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.ide.project.node.resource;
|
||||
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.google.inject.Inject;
|
||||
import com.google.web.bindery.event.shared.EventBus;
|
||||
|
||||
import org.eclipse.che.ide.api.project.ProjectServiceClient;
|
||||
import org.eclipse.che.api.promises.client.Promise;
|
||||
import org.eclipse.che.api.promises.client.callback.AsyncPromiseHelper;
|
||||
import org.eclipse.che.api.promises.client.js.JsPromiseError;
|
||||
import org.eclipse.che.api.promises.client.js.Promises;
|
||||
import org.eclipse.che.api.workspace.shared.dto.ProjectConfigDto;
|
||||
import org.eclipse.che.ide.api.app.AppContext;
|
||||
import org.eclipse.che.ide.api.project.node.HasDataObject;
|
||||
import org.eclipse.che.ide.api.project.node.HasProjectConfig;
|
||||
import org.eclipse.che.ide.api.project.node.HasStorablePath;
|
||||
import org.eclipse.che.ide.api.project.node.Node;
|
||||
import org.eclipse.che.ide.project.node.ModuleNode;
|
||||
import org.eclipse.che.ide.rest.AsyncRequestCallback;
|
||||
import org.eclipse.che.ide.rest.DtoUnmarshallerFactory;
|
||||
|
||||
/**
|
||||
* @author Dmitry Shnurenko
|
||||
* @deprecated will be removed after release GA
|
||||
*/
|
||||
@Deprecated
|
||||
public class ModuleConfigProcessor extends AbstractResourceProcessor<ProjectConfigDto> {
|
||||
|
||||
private final AppContext appContext;
|
||||
|
||||
@Inject
|
||||
public ModuleConfigProcessor(EventBus eventBus,
|
||||
ProjectServiceClient projectServiceClient,
|
||||
AppContext appContext,
|
||||
DtoUnmarshallerFactory unmarshallerFactory) {
|
||||
super(eventBus, projectServiceClient, unmarshallerFactory);
|
||||
this.appContext = appContext;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Promise<ProjectConfigDto> delete(final HasDataObject<ProjectConfigDto> node) {
|
||||
if (node instanceof ModuleNode) {
|
||||
Node parent = ((ModuleNode)node).getParent();
|
||||
if (!(parent instanceof HasProjectConfig)) {
|
||||
return Promises.reject(JsPromiseError.create("Failed to search parent project descriptor"));
|
||||
}
|
||||
|
||||
final String parentPath = ((HasProjectConfig)parent).getProjectConfig().getPath();
|
||||
final String modulePath = node.getData().getPath();
|
||||
|
||||
return AsyncPromiseHelper.createFromAsyncRequest(new AsyncPromiseHelper.RequestCall<ProjectConfigDto>() {
|
||||
@Override
|
||||
public void makeCall(final AsyncCallback<ProjectConfigDto> callback) {
|
||||
projectService.deleteModule(appContext.getDevMachine(), parentPath, modulePath, new AsyncRequestCallback<Void>() {
|
||||
@Override
|
||||
protected void onSuccess(Void result) {
|
||||
callback.onSuccess(node.getData());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onFailure(Throwable exception) {
|
||||
callback.onFailure(exception);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
return Promises.reject(JsPromiseError.create("Internal error"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Promise<ProjectConfigDto> rename(HasStorablePath parent,
|
||||
HasDataObject<ProjectConfigDto> node,
|
||||
String newName) {
|
||||
return Promises.reject(JsPromiseError.create(""));
|
||||
}
|
||||
}
|
||||
|
|
@ -63,7 +63,6 @@ public class ProjectWizard extends AbstractWizard<ProjectConfigDto> {
|
|||
private final SelectionAgent selectionAgent;
|
||||
private final ProjectImporter importer;
|
||||
private final ProjectUpdater updater;
|
||||
private final String workspaceId;
|
||||
private final CoreLocalizationConstant locale;
|
||||
|
||||
@Inject
|
||||
|
|
@ -92,7 +91,6 @@ public class ProjectWizard extends AbstractWizard<ProjectConfigDto> {
|
|||
this.importer = importer;
|
||||
this.updater = updater;
|
||||
this.locale = locale;
|
||||
this.workspaceId = appContext.getWorkspaceId();
|
||||
|
||||
context.put(WIZARD_MODE_KEY, mode.toString());
|
||||
context.put(PROJECT_NAME_KEY, dataObject.getName());
|
||||
|
|
|
|||
|
|
@ -87,7 +87,6 @@ public class ProjectImporterTest {
|
|||
|
||||
@Before
|
||||
public void setUp() {
|
||||
when(appContext.getWorkspaceId()).thenReturn(ID);
|
||||
when(appContext.getDevMachine()).thenReturn(devMachine);
|
||||
when(devMachine.getWsAgentBaseUrl()).thenReturn("/ext");
|
||||
when(projectConfig.getName()).thenReturn(PROJECT_NAME);
|
||||
|
|
|
|||
|
|
@ -104,7 +104,6 @@ public class ProjectUpdaterTest {
|
|||
@Before
|
||||
@SuppressWarnings("unchecked")
|
||||
public void setUp() {
|
||||
when(appContext.getWorkspaceId()).thenReturn(WORKSPACE_ID);
|
||||
when(appContext.getWorkspace()).thenReturn(usersWorkspaceDtoMock);
|
||||
when(appContext.getDevMachine()).thenReturn(devMachine);
|
||||
when(devMachine.getWsAgentBaseUrl()).thenReturn("/ext");
|
||||
|
|
|
|||
|
|
@ -124,7 +124,6 @@ public class ProjectWizardTest {
|
|||
|
||||
@Before
|
||||
public void setUp() {
|
||||
when(appContext.getWorkspaceId()).thenReturn(WORKSPACE_ID);
|
||||
when(appContext.getDevMachine()).thenReturn(devMachine);
|
||||
when(dataObject.getName()).thenReturn(PROJECT_NAME);
|
||||
when(dataObject.getSource()).thenReturn(storage);
|
||||
|
|
|
|||
|
|
@ -472,7 +472,7 @@ export class CreateProjectCtrl {
|
|||
let deferredResolve = this.$q.defer();
|
||||
let deferredResolvePromise = deferredResolve.promise;
|
||||
|
||||
let importPromise = this.cheAPI.getWorkspace().getWorkspaceAgent(workspaceId).getProject().importProject(workspaceId, projectName, projectData.source);
|
||||
let importPromise = this.cheAPI.getWorkspace().getWorkspaceAgent(workspaceId).getProject().importProject(projectName, projectData.source);
|
||||
|
||||
importPromise.then(() => {
|
||||
// add commands if there are some that have been defined
|
||||
|
|
@ -528,20 +528,20 @@ export class CreateProjectCtrl {
|
|||
let projectTypeService = this.cheAPI.getWorkspace().getWorkspaceAgent(workspaceId).getProjectType();
|
||||
|
||||
if (projectDetails.type) {
|
||||
let updateProjectPromise = projectService.updateProject(workspaceId, projectName, projectDetails);
|
||||
let updateProjectPromise = projectService.updateProject(projectName, projectDetails);
|
||||
updateProjectPromise.then(() => {
|
||||
deferredResolve.resolve();
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
let resolvePromise = projectService.fetchResolve(workspaceId, projectName);
|
||||
let resolvePromise = projectService.fetchResolve(projectName);
|
||||
resolvePromise.then(() => {
|
||||
let resultResolve = projectService.getResolve(workspaceId, projectName);
|
||||
let resultResolve = projectService.getResolve(projectName);
|
||||
// get project-types
|
||||
let fetchTypePromise = projectTypeService.fetchTypes(workspaceId);
|
||||
let fetchTypePromise = projectTypeService.fetchTypes();
|
||||
fetchTypePromise.then(() => {
|
||||
let projectTypesByCategory = projectTypeService.getProjectTypesIDs(workspaceId);
|
||||
let projectTypesByCategory = projectTypeService.getProjectTypesIDs();
|
||||
// now try the estimate for each source
|
||||
let deferredEstimate = this.$q.defer();
|
||||
let deferredEstimatePromise = deferredResolve.promise;
|
||||
|
|
@ -559,7 +559,7 @@ export class CreateProjectCtrl {
|
|||
let projectType = projectTypesByCategory.get(sourceResolve.type);
|
||||
if (projectType.primaryable) {
|
||||
// call estimate
|
||||
let estimatePromise = projectService.fetchEstimate(workspaceId, projectName, sourceResolve.type);
|
||||
let estimatePromise = projectService.fetchEstimate(projectName, sourceResolve.type);
|
||||
estimatePromises.push(estimatePromise);
|
||||
estimateTypes.push(sourceResolve.type);
|
||||
}
|
||||
|
|
@ -573,7 +573,7 @@ export class CreateProjectCtrl {
|
|||
var firstMatchingType;
|
||||
var firstMatchingResult;
|
||||
estimateTypes.forEach((type) => {
|
||||
let resultEstimate = projectService.getEstimate(workspaceId, projectName, type);
|
||||
let resultEstimate = projectService.getEstimate(projectName, type);
|
||||
// add attributes
|
||||
// there is a matching estimate
|
||||
if (Object.keys(resultEstimate.attributes).length > 0 && 'java' !== type && !firstMatchingType) {
|
||||
|
|
@ -585,7 +585,7 @@ export class CreateProjectCtrl {
|
|||
if (firstMatchingType) {
|
||||
projectDetails.attributes = firstMatchingResult;
|
||||
projectDetails.type = firstMatchingType;
|
||||
let updateProjectPromise = projectService.updateProject(workspaceId, projectName, projectDetails);
|
||||
let updateProjectPromise = projectService.updateProject(projectName, projectDetails);
|
||||
updateProjectPromise.then(() => {
|
||||
deferredResolve.resolve();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -192,7 +192,7 @@ export class ListProjectsCtrl {
|
|||
let wsagent = this.cheAPI.getWorkspace().getWorkspaceAgent(workspaceId);
|
||||
|
||||
if (wsagent) {
|
||||
return wsagent.getProject().remove(workspaceId, projectPath);
|
||||
return wsagent.getProject().remove(projectPath);
|
||||
} else {
|
||||
return this.cheAPI.getWorkspace().deleteProject(workspaceId, projectPath);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ export class ProjectDetailsCtrl {
|
|||
fetchProjectDetails() {
|
||||
this.projectService = this.cheAPI.getWorkspace().getWorkspaceAgent(this.workspaceId).getProject();
|
||||
|
||||
if (!this.projectService.getProjectDetailsByKey(this.workspaceId, this.projectPath)) {
|
||||
if (!this.projectService.getProjectDetailsByKey(this.projectPath)) {
|
||||
let promise = this.projectService.fetchProjectDetails(this.workspaceId, this.projectPath);
|
||||
promise.then(() => {
|
||||
this.updateProjectDetails();
|
||||
|
|
@ -91,7 +91,7 @@ export class ProjectDetailsCtrl {
|
|||
}
|
||||
|
||||
updateProjectDetails() {
|
||||
this.projectDetails = this.projectService.getProjectDetailsByKey(this.workspaceId, this.projectPath);
|
||||
this.projectDetails = this.projectService.getProjectDetailsByKey(this.projectPath);
|
||||
this.projectName = angular.copy(this.projectDetails.name);
|
||||
this.projectDescription = angular.copy(this.projectDetails.description);
|
||||
this.loading = false;
|
||||
|
|
@ -111,7 +111,7 @@ export class ProjectDetailsCtrl {
|
|||
this.cheNotification.showInfo('Project information successfully updated.');
|
||||
this.updateLocation();
|
||||
if (this.isNameChanged()) {
|
||||
this.projectService.fetchProjectDetails(this.workspaceId, this.projectPath).then(() => {
|
||||
this.projectService.fetchProjectDetails(this.projectPath).then(() => {
|
||||
this.updateProjectDetails();
|
||||
});
|
||||
} else {
|
||||
|
|
@ -147,10 +147,10 @@ export class ProjectDetailsCtrl {
|
|||
}
|
||||
|
||||
if (this.isNameChanged()) {
|
||||
let promise = this.projectService.rename(this.projectDetails.workspaceId, this.projectName, this.projectDetails.name);
|
||||
let promise = this.projectService.rename(this.projectName, this.projectDetails.name);
|
||||
|
||||
promise.then(() => {
|
||||
this.projectService.removeProjectDetailsByKey(this.workspaceId, this.projectPath);
|
||||
this.projectService.removeProjectDetailsByKey(this.projectPath);
|
||||
if (!this.isDescriptionChanged()) {
|
||||
this.cheNotification.showInfo('Project information successfully updated.');
|
||||
this.updateLocation();
|
||||
|
|
@ -181,7 +181,7 @@ export class ProjectDetailsCtrl {
|
|||
.targetEvent(event);
|
||||
this.$mdDialog.show(confirm).then(() => {
|
||||
// remove it !
|
||||
let promise = this.projectService.remove(this.projectDetails.workspaceId, this.projectDetails.name);
|
||||
let promise = this.projectService.remove(this.projectDetails.name);
|
||||
promise.then(() => {
|
||||
this.$location.path('/projects');
|
||||
}, (error) => {
|
||||
|
|
|
|||
|
|
@ -33,15 +33,15 @@ export class ProjectRepositoryCtrl {
|
|||
|
||||
this.wsagent = this.cheAPI.getWorkspace().getWorkspaceAgent(workspaceId);
|
||||
|
||||
if (!this.wsagent.getProject().getProjectDetailsByKey(workspaceId, projectPath)) {
|
||||
if (!this.wsagent.getProject().getProjectDetailsByKey(projectPath)) {
|
||||
let promise = this.wsagent.getProject().fetchProjectDetails(workspaceId, projectPath);
|
||||
|
||||
promise.then(() => {
|
||||
var projectDetails = this.wsagent.getProject().getProjectDetailsByKey(workspaceId, projectPath);
|
||||
var projectDetails = this.wsagent.getProject().getProjectDetailsByKey(projectPath);
|
||||
this.updateRepositories(projectDetails);
|
||||
});
|
||||
} else {
|
||||
var projectDetails = this.wsagent.getProject().getProjectDetailsByKey(workspaceId, projectPath);
|
||||
var projectDetails = this.wsagent.getProject().getProjectDetailsByKey(projectPath);
|
||||
this.updateRepositories(projectDetails);
|
||||
}
|
||||
|
||||
|
|
@ -68,25 +68,25 @@ export class ProjectRepositoryCtrl {
|
|||
|
||||
if (projectDetails.mixins.indexOf(gitMixinId) !== -1) {
|
||||
//update git local url
|
||||
if (!this.wsagent.getGit().getLocalUrlByKey(projectDetails.workspaceId, projectDetails.path)) {
|
||||
let promise = this.wsagent.getGit().fetchLocalUrl(projectDetails.workspaceId, projectDetails.path);
|
||||
if (!this.wsagent.getGit().getLocalUrlByKey(projectDetails.path)) {
|
||||
let promise = this.wsagent.getGit().fetchLocalUrl(projectDetails.path);
|
||||
|
||||
promise.then(() => {
|
||||
this.localGitRepository = this.wsagent.getGit().getLocalUrlByKey(projectDetails.workspaceId, projectDetails.path);
|
||||
this.localGitRepository = this.wsagent.getGit().getLocalUrlByKey(projectDetails.path);
|
||||
});
|
||||
} else {
|
||||
this.localGitRepository = this.wsagent.getGit().getLocalUrlByKey(projectDetails.workspaceId, projectDetails.path);
|
||||
this.localGitRepository = this.wsagent.getGit().getLocalUrlByKey(projectDetails.path);
|
||||
}
|
||||
|
||||
//update git remote urls
|
||||
if (!this.wsagent.getGit().getRemoteUrlArrayByKey(projectDetails.workspaceId, projectDetails.path)) {
|
||||
let promise = this.wsagent.getGit().fetchRemoteUrlArray(projectDetails.workspaceId, projectDetails.path);
|
||||
if (!this.wsagent.getGit().getRemoteUrlArrayByKey(projectDetails.path)) {
|
||||
let promise = this.wsagent.getGit().fetchRemoteUrlArray(projectDetails.path);
|
||||
|
||||
promise.then(() => {
|
||||
this.remoteGitRepositories = this.wsagent.getGit().getRemoteUrlArrayByKey(projectDetails.workspaceId, projectDetails.path);
|
||||
this.remoteGitRepositories = this.wsagent.getGit().getRemoteUrlArrayByKey(projectDetails.path);
|
||||
});
|
||||
} else {
|
||||
this.remoteGitRepositories = this.wsagent.getGit().getRemoteUrlArrayByKey(projectDetails.workspaceId, projectDetails.path);
|
||||
this.remoteGitRepositories = this.wsagent.getGit().getRemoteUrlArrayByKey(projectDetails.path);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -184,11 +184,11 @@ export class ExportWorkspaceDialogController {
|
|||
let deferred = this.$q.defer();
|
||||
let deferredPromise = deferred.promise;
|
||||
projectPromises.push(deferredPromise);
|
||||
let importProjectPromise = remoteProjectAPI.importProject(workspace.id, project.name, project.source);
|
||||
let importProjectPromise = remoteProjectAPI.importProject(project.name, project.source);
|
||||
|
||||
importProjectPromise.then(() => {
|
||||
this.exportInCloudSteps += 'Importing project ' + project.name + '...<br>';
|
||||
let updateProjectPromise = remoteProjectAPI.updateProject(workspace.id, project.name, project);
|
||||
let updateProjectPromise = remoteProjectAPI.updateProject(project.name, project);
|
||||
updateProjectPromise.then(() => {
|
||||
deferred.resolve(workspace);
|
||||
}, (error) => {
|
||||
|
|
|
|||
|
|
@ -29,19 +29,17 @@ export class CheGit {
|
|||
|
||||
// remote call
|
||||
this.remoteGitAPI = this.$resource(wsagentPath + '/git', {}, {
|
||||
getLocalUrl: {method: 'GET', url: wsagentPath + '/git/:workspaceId/read-only-url?projectPath=:path', isArray: false},
|
||||
getRemoteUrlArray: {method: 'POST', url: wsagentPath + '/git/:workspaceId/remote-list?projectPath=:path', isArray: true}
|
||||
getLocalUrl: {method: 'GET', url: wsagentPath + '/git/read-only-url?projectPath=:path', isArray: false},
|
||||
getRemoteUrlArray: {method: 'POST', url: wsagentPath + '/git/remote-list?projectPath=:path', isArray: true}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Ask for loading local repository url for the given project
|
||||
* @param workspaceId
|
||||
* @param projectPath
|
||||
*/
|
||||
fetchLocalUrl(workspaceId, projectPath) {
|
||||
fetchLocalUrl(projectPath) {
|
||||
let promise = this.remoteGitAPI.getLocalUrl({
|
||||
workspaceId: workspaceId,
|
||||
path: projectPath
|
||||
}, null).$promise;
|
||||
|
||||
|
|
@ -58,7 +56,7 @@ export class CheGit {
|
|||
}
|
||||
});
|
||||
}
|
||||
this.localGitUrlsMap.set(workspaceId + projectPath, localUrl);
|
||||
this.localGitUrlsMap.set(projectPath, localUrl);
|
||||
});
|
||||
|
||||
return parsedResultPromise;
|
||||
|
|
@ -66,31 +64,29 @@ export class CheGit {
|
|||
|
||||
/**
|
||||
* Ask for loading remote repository urls for the given project
|
||||
* @param workspaceId
|
||||
* @param projectPath
|
||||
*/
|
||||
fetchRemoteUrlArray(workspaceId, projectPath) {
|
||||
fetchRemoteUrlArray(projectPath) {
|
||||
var data = {remote: null, verbose: true, attributes: {}};
|
||||
|
||||
let promise = this.remoteGitAPI.getRemoteUrlArray({
|
||||
workspaceId: workspaceId,
|
||||
path: projectPath
|
||||
}, data).$promise;
|
||||
|
||||
// check if it was OK or not
|
||||
let parsedResultPromise = promise.then((remoteArray) => {
|
||||
this.remoteGitUrlArraysMap.set(workspaceId + projectPath, remoteArray);
|
||||
this.remoteGitUrlArraysMap.set(projectPath, remoteArray);
|
||||
});
|
||||
|
||||
return parsedResultPromise;
|
||||
}
|
||||
|
||||
getRemoteUrlArrayByKey(workspaceId, projectPath) {
|
||||
return this.remoteGitUrlArraysMap.get(workspaceId + projectPath);
|
||||
getRemoteUrlArrayByKey(projectPath) {
|
||||
return this.remoteGitUrlArraysMap.get(projectPath);
|
||||
}
|
||||
|
||||
getLocalUrlByKey(workspaceId, projectPath) {
|
||||
return this.localGitUrlsMap.get(workspaceId + projectPath);
|
||||
getLocalUrlByKey(projectPath) {
|
||||
return this.localGitUrlsMap.get(projectPath);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -93,16 +93,16 @@ describe('CheGit', function () {
|
|||
cheBackend.getLocalGitUrl(workspaceId, encodeURIComponent(projectPath));
|
||||
|
||||
// fetch localUrl
|
||||
factory.fetchLocalUrl(workspaceId, projectPath);
|
||||
factory.fetchLocalUrl(projectPath);
|
||||
|
||||
// expecting GETs
|
||||
httpBackend.expectGET(agentUrl + '/git/' + workspaceId + '/read-only-url?projectPath=' + encodeURIComponent(projectPath));
|
||||
httpBackend.expectGET(agentUrl + '/git/read-only-url?projectPath=' + encodeURIComponent(projectPath));
|
||||
|
||||
// flush command
|
||||
httpBackend.flush();
|
||||
|
||||
// now, check url
|
||||
var url = factory.getLocalUrlByKey(workspaceId, projectPath);
|
||||
var url = factory.getLocalUrlByKey(projectPath);
|
||||
|
||||
// check local url
|
||||
expect(localUrl).toEqual(url);
|
||||
|
|
@ -148,16 +148,16 @@ describe('CheGit', function () {
|
|||
cheBackend.getRemoteGitUrlArray(workspaceId, encodeURIComponent(projectPath));
|
||||
|
||||
// fetch localUrl
|
||||
factory.fetchRemoteUrlArray(workspaceId, projectPath);
|
||||
factory.fetchRemoteUrlArray(projectPath);
|
||||
|
||||
// expecting POSTs
|
||||
httpBackend.expectPOST(agentUrl + '/git/' + workspaceId + '/remote-list?projectPath=' + encodeURIComponent(projectPath));
|
||||
httpBackend.expectPOST(agentUrl + '/git/remote-list?projectPath=' + encodeURIComponent(projectPath));
|
||||
|
||||
// flush command
|
||||
httpBackend.flush();
|
||||
|
||||
// now, check url
|
||||
var urlArray = factory.getRemoteUrlArrayByKey(workspaceId, projectPath);
|
||||
var urlArray = factory.getRemoteUrlArrayByKey(projectPath);
|
||||
remoteArray.sort(function (a, b) {
|
||||
if (a.name > b.name) {
|
||||
return 1;
|
||||
|
|
|
|||
|
|
@ -25,44 +25,28 @@ export class CheProjectType {
|
|||
this.$resource = $resource;
|
||||
|
||||
// types per category per workspace ID : workspace ID ==> map<projectTypeId, projectType>
|
||||
this.typesIdPerWorkspace = new Map();
|
||||
this.typesIds = new Map();
|
||||
|
||||
// project types per workspace ID
|
||||
this.typesWorkspaces = new Map();
|
||||
this.workspaceTypes = [];
|
||||
// remote call
|
||||
this.remoteProjectTypeAPI = this.$resource(wsagentPath + '/project-type/:workspaceId');
|
||||
this.remoteProjectTypeAPI = this.$resource(wsagentPath + '/project-type');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Fetch the project types
|
||||
*/
|
||||
fetchTypes(workspaceId) {
|
||||
fetchTypes() {
|
||||
var defer = this.$q.defer();
|
||||
let promise = this.remoteProjectTypeAPI.query({workspaceId: workspaceId}).$promise;
|
||||
let promise = this.remoteProjectTypeAPI.query().$promise;
|
||||
let updatedPromise = promise.then((projectTypes) => {
|
||||
|
||||
var idProjectTypesMap = this.typesIdPerWorkspace.get(workspaceId);
|
||||
if (!idProjectTypesMap) {
|
||||
idProjectTypesMap = new Map();
|
||||
this.typesIdPerWorkspace.set(workspaceId, idProjectTypesMap);
|
||||
}
|
||||
|
||||
var typesWorkspace = this.typesWorkspaces.get(workspaceId);
|
||||
if (!typesWorkspace) {
|
||||
typesWorkspace = [];
|
||||
this.typesWorkspaces.set(workspaceId, typesWorkspace);
|
||||
}
|
||||
|
||||
// reset global list
|
||||
typesWorkspace.length = 0;
|
||||
this.workspaceTypes = projectTypes;
|
||||
|
||||
projectTypes.forEach((projectType) => {
|
||||
var id = projectType.id;
|
||||
// add in map
|
||||
idProjectTypesMap.set(id, projectType);
|
||||
// add in global list
|
||||
typesWorkspace.push(projectType);
|
||||
this.typesIds.set(projectType.id, projectType);
|
||||
});
|
||||
defer.resolve();
|
||||
}, (error) => {
|
||||
|
|
@ -76,25 +60,20 @@ export class CheProjectType {
|
|||
return defer.promise;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets all project types
|
||||
* @returns {Array}
|
||||
*/
|
||||
getAllProjectTypes(workspaceId) {
|
||||
let val = this.typesWorkspaces.get(workspaceId);
|
||||
return !val ? [] : val;
|
||||
getAllProjectTypes() {
|
||||
return this.workspaceTypes;
|
||||
}
|
||||
|
||||
/**
|
||||
* The types per category
|
||||
* @returns {CheProjectType.typesPerCategory|*}
|
||||
*/
|
||||
getProjectTypesIDs(workspaceId) {
|
||||
let val = this.typesIdPerWorkspace.get(workspaceId);
|
||||
return !val ? {} : val;
|
||||
getProjectTypesIDs() {
|
||||
return this.typesIds;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -99,25 +99,25 @@ describe('CheProjectType', function(){
|
|||
var factory = workspace.getWorkspaceAgent(workspaceId).getProjectType();
|
||||
|
||||
// no types now on factory
|
||||
expect(factory.getAllProjectTypes(workspaceId).length).toEqual(0);
|
||||
expect(factory.getAllProjectTypes().length).toEqual(0);
|
||||
|
||||
// fetch types
|
||||
factory.fetchTypes(workspaceId);
|
||||
factory.fetchTypes();
|
||||
|
||||
// expecting a GET
|
||||
httpBackend.expectGET(agentUrl + '/project-type/' + workspaceId);
|
||||
httpBackend.expectGET(agentUrl + '/project-type');
|
||||
|
||||
// flush command
|
||||
httpBackend.flush();
|
||||
|
||||
expect(factory.getAllProjectTypes(workspaceId).length).toEqual(2);
|
||||
expect(factory.getAllProjectTypes().length).toEqual(2);
|
||||
|
||||
// now, check types
|
||||
var projectTypes = factory.getAllProjectTypes(workspaceId);
|
||||
var projectTypes = factory.getAllProjectTypes();
|
||||
// check we have 2 PT
|
||||
expect(projectTypes.length).toEqual(2);
|
||||
|
||||
var typesIds = factory.getProjectTypesIDs(workspaceId);
|
||||
var typesIds = factory.getProjectTypesIDs();
|
||||
expect(typesIds.size).toEqual(2);
|
||||
|
||||
var firstType = typesIds.get('maven');
|
||||
|
|
|
|||
|
|
@ -30,54 +30,52 @@ export class CheProject {
|
|||
|
||||
this.$q = $q;
|
||||
|
||||
// project details map with key = workspaceId+projectPath
|
||||
// project details map with key projectPath
|
||||
this.projectDetailsMap = new Map();
|
||||
|
||||
// map of estimate per workspace Id + project + project type: <workspaceID:project:projectType> --> Estimate
|
||||
// map of estimate per project + project type: <project:projectType> --> Estimate
|
||||
this.estimateMap = new Map();
|
||||
|
||||
// map of resolve per workspace Id/project <workspaceID:project:projectType> --> Source Estimation
|
||||
// map of resolve per project <project:projectType> --> Source Estimation
|
||||
this.resolveMap = new Map();
|
||||
|
||||
// remote call
|
||||
this.remoteProjectsAPI = this.$resource(wsagentPath + '/project/:workspaceId', {workspaceId: '@id'}, {
|
||||
import: {method: 'POST', url: wsagentPath + '/project/:workspaceId/import/:path'},
|
||||
create: {method: 'POST', url: wsagentPath + '/project/:workspaceId?name=:path'},
|
||||
details: {method: 'GET', url: wsagentPath + '/project/:workspaceId/:path'},
|
||||
estimate: {method: 'GET', url: wsagentPath + '/project/:workspaceId/estimate/:path?type=:type'},
|
||||
rename: {method: 'POST', url: wsagentPath + '/project/:workspaceId/rename/:path?name=:name'},
|
||||
remove: {method: 'DELETE', url: wsagentPath + '/project/:workspaceId/:path'},
|
||||
resolve: {method: 'GET', url: wsagentPath + '/project/:workspaceId/resolve/:path', isArray: true},
|
||||
update: {method: 'PUT', url: wsagentPath + '/project/:workspaceId/:path'}
|
||||
this.remoteProjectsAPI = this.$resource(wsagentPath + '/project', {}, {
|
||||
import: {method: 'POST', url: wsagentPath + '/project/import/:path'},
|
||||
create: {method: 'POST', url: wsagentPath + '/project?name=:path'},
|
||||
details: {method: 'GET', url: wsagentPath + '/project/:path'},
|
||||
estimate: {method: 'GET', url: wsagentPath + '/project/estimate/:path?type=:type'},
|
||||
rename: {method: 'POST', url: wsagentPath + '/project/rename/:path?name=:name'},
|
||||
remove: {method: 'DELETE', url: wsagentPath + '/project/:path'},
|
||||
resolve: {method: 'GET', url: wsagentPath + '/project/resolve/:path', isArray: true},
|
||||
update: {method: 'PUT', url: wsagentPath + '/project/:path'}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Import a project based located on the given workspace id and path
|
||||
* @param workspaceId the workspace ID to use
|
||||
* Import a project based located on the given path
|
||||
* @param path the path of the project
|
||||
* @param data the project body description
|
||||
* @returns {$promise|*|T.$promise}
|
||||
*/
|
||||
importProject(workspaceId, path, data) {
|
||||
importProject(path, data) {
|
||||
// remove unused description because we cannot set project description without project type
|
||||
if ((!data.type || data.type.length === 0) && data.description) {
|
||||
delete(data.description);
|
||||
}
|
||||
let promise = this.remoteProjectsAPI.import({workspaceId: workspaceId, path: path}, data).$promise;
|
||||
let promise = this.remoteProjectsAPI.import({path: path}, data).$promise;
|
||||
return promise;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create a project based located on the given workspace id and path
|
||||
* @param workspaceId the workspace ID to use
|
||||
* Create a project based located on the given path
|
||||
* @param path the path of the project
|
||||
* @param data the project body description
|
||||
* @returns {$promise|*|T.$promise}
|
||||
*/
|
||||
createProject(workspaceId, path, data) {
|
||||
let promise = this.remoteProjectsAPI.create({workspaceId: workspaceId, path: path}, data).$promise;
|
||||
createProject(path, data) {
|
||||
let promise = this.remoteProjectsAPI.create({path: path}, data).$promise;
|
||||
return promise;
|
||||
}
|
||||
|
||||
|
|
@ -100,111 +98,107 @@ export class CheProject {
|
|||
}
|
||||
|
||||
/**
|
||||
* Fetch project details on the given workspace id and path
|
||||
* @param workspaceId the workspace ID to use
|
||||
* Fetch project details on the given path
|
||||
* @param projectPath the path of the project
|
||||
*/
|
||||
fetchProjectDetails(workspaceId, projectPath) {
|
||||
//TODO why we cannot use project path
|
||||
var projectName = projectPath[0] === '/' ? projectPath.slice(1) : projectPath;
|
||||
let promise = this.remoteProjectsAPI.details({workspaceId: workspaceId, path: projectName}).$promise;
|
||||
let promise = this.remoteProjectsAPI.details({path: projectName}).$promise;
|
||||
|
||||
// check if it was OK or not
|
||||
let parsedResultPromise = promise.then((projectDetails) => {
|
||||
if (projectDetails) {
|
||||
projectDetails.workspaceId = workspaceId;
|
||||
this.projectDetailsMap.set(workspaceId + projectPath, projectDetails);
|
||||
this.projectDetailsMap.set(projectPath, projectDetails);
|
||||
}
|
||||
});
|
||||
|
||||
return parsedResultPromise;
|
||||
}
|
||||
|
||||
getProjectDetailsByKey(workspaceId, projectPath) {
|
||||
return this.projectDetailsMap.get(workspaceId + projectPath);
|
||||
getProjectDetailsByKey(projectPath) {
|
||||
return this.projectDetailsMap.get(projectPath);
|
||||
}
|
||||
|
||||
removeProjectDetailsByKey(workspaceId, projectPath) {
|
||||
this.projectDetailsMap.delete(workspaceId + projectPath);
|
||||
removeProjectDetailsByKey(projectPath) {
|
||||
this.projectDetailsMap.delete(projectPath);
|
||||
}
|
||||
|
||||
updateProjectDetails(projectDetails) {
|
||||
return this.updateProject(projectDetails.workspaceId, projectDetails.name, projectDetails);
|
||||
return this.updateProject(projectDetails.name, projectDetails);
|
||||
}
|
||||
|
||||
updateProject(workspaceId, path, projectDetails) {
|
||||
updateProject(path, projectDetails) {
|
||||
let newProjectDetails = angular.copy(projectDetails);
|
||||
if(newProjectDetails.workspaceId){
|
||||
delete(newProjectDetails.workspaceId);
|
||||
}
|
||||
let promiseUpdateProjectDetails = this.remoteProjectsAPI.update({
|
||||
workspaceId: workspaceId,
|
||||
path: path
|
||||
}, newProjectDetails).$promise;
|
||||
|
||||
return promiseUpdateProjectDetails;
|
||||
}
|
||||
|
||||
rename(workspaceId, projectName, newProjectName) {
|
||||
let promise = this.remoteProjectsAPI.rename({workspaceId: workspaceId, path: projectName, name: newProjectName}, null).$promise;
|
||||
rename(projectName, newProjectName) {
|
||||
let promise = this.remoteProjectsAPI.rename({path: projectName, name: newProjectName}, null).$promise;
|
||||
return promise;
|
||||
}
|
||||
|
||||
remove(workspaceId, projectName) {
|
||||
let promiseDelete = this.remoteProjectsAPI.remove({workspaceId: workspaceId, path: projectName}).$promise;
|
||||
remove(projectName) {
|
||||
let promiseDelete = this.remoteProjectsAPI.remove({path: projectName}).$promise;
|
||||
return promiseDelete;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch estimate and return promise for this estimate
|
||||
* @param workspaceId the workspace ID of the project
|
||||
* @param projectPath the path to the project in the workspace
|
||||
* @param projectType the project type in the list of available types
|
||||
* @returns {Promise}
|
||||
*/
|
||||
fetchEstimate(workspaceId, projectPath, projectType) {
|
||||
fetchEstimate(projectPath, projectType) {
|
||||
let projectName = projectPath[0] === '/' ? projectPath.slice(1) : projectPath;
|
||||
let promise = this.remoteProjectsAPI.estimate({workspaceId: workspaceId, path: projectName, type: projectType}).$promise;
|
||||
let promise = this.remoteProjectsAPI.estimate({path: projectName, type: projectType}).$promise;
|
||||
let parsedResultPromise = promise.then((estimate) => {
|
||||
if (estimate) {
|
||||
this.estimateMap.set(workspaceId + projectName + projectType, estimate);
|
||||
this.estimateMap.set(projectName + projectType, estimate);
|
||||
}
|
||||
});
|
||||
return parsedResultPromise;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the estimation based on the given 3 inputs : workspace ID, project path and project type
|
||||
* @return the estimation based on the given 2 inputs : project path and project type
|
||||
*/
|
||||
getEstimate(workspaceId, projectPath, projectType) {
|
||||
getEstimate(projectPath, projectType) {
|
||||
let projectName = projectPath[0] === '/' ? projectPath.slice(1) : projectPath;
|
||||
return this.estimateMap.get(workspaceId + projectName + projectType);
|
||||
return this.estimateMap.get(projectName + projectType);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Fetch resolve and return promise for this resolution
|
||||
* @param workspaceId the workspace ID of the project
|
||||
* @param projectPath the path to the project in the workspace
|
||||
* @returns {Promise}
|
||||
*/
|
||||
fetchResolve(workspaceId, projectPath) {
|
||||
fetchResolve(projectPath) {
|
||||
let projectName = projectPath[0] === '/' ? projectPath.slice(1) : projectPath;
|
||||
let promise = this.remoteProjectsAPI.resolve({workspaceId: workspaceId, path: projectName}).$promise;
|
||||
let promise = this.remoteProjectsAPI.resolve({path: projectName}).$promise;
|
||||
let parsedResultPromise = promise.then((resolve) => {
|
||||
if (resolve) {
|
||||
this.resolveMap.set(workspaceId + projectName, resolve);
|
||||
this.resolveMap.set(projectName, resolve);
|
||||
}
|
||||
});
|
||||
return parsedResultPromise;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the estimation based on the given 2 inputs : workspace ID, project path
|
||||
* @return the estimation based on the given input : project path
|
||||
*/
|
||||
getResolve(workspaceId, projectPath) {
|
||||
getResolve(projectPath) {
|
||||
let projectName = projectPath[0] === '/' ? projectPath.slice(1) : projectPath;
|
||||
return this.resolveMap.get(workspaceId + projectName);
|
||||
return this.resolveMap.get(projectName);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -98,13 +98,13 @@ describe('CheProject', function () {
|
|||
factory.fetchProjectDetails(testProjectDetails.workspaceId, '/' + testProjectDetails.name);
|
||||
|
||||
// expecting GET
|
||||
httpBackend.expectGET(agentUrl + '/project/' + testProjectDetails.workspaceId + '/' + testProjectDetails.name);
|
||||
httpBackend.expectGET(agentUrl + '/project/' + testProjectDetails.name);
|
||||
|
||||
// flush command
|
||||
httpBackend.flush();
|
||||
|
||||
// now, check
|
||||
var projectDetails = factory.getProjectDetailsByKey(testProjectDetails.workspaceId, '/' + testProjectDetails.name);
|
||||
var projectDetails = factory.getProjectDetailsByKey('/' + testProjectDetails.name);
|
||||
|
||||
// check project details
|
||||
expect(projectDetails.name).toEqual(testProjectDetails.name);
|
||||
|
|
|
|||
|
|
@ -334,26 +334,17 @@ export class CheWorkspace {
|
|||
*/
|
||||
getWebsocketUrl(workspaceId) {
|
||||
let workspace = this.workspacesById.get(workspaceId);
|
||||
if (!workspace || !workspace.runtime) {
|
||||
if (!workspace || !workspace.runtime || !workspace.runtime.links) {
|
||||
return '';
|
||||
}
|
||||
let runtimeData = workspace.runtime;
|
||||
|
||||
// extract the Websocket URL of the runtime
|
||||
let servers = runtimeData.devMachine.runtime.servers;
|
||||
|
||||
var wsagentServerAddress;
|
||||
for (var key in servers) {
|
||||
let server = servers[key];
|
||||
if ('wsagent' === server.ref) {
|
||||
wsagentServerAddress = server.address;
|
||||
for (let i = 0; i < workspace.runtime.links.length; i++) {
|
||||
let link = workspace.runtime.links[i];
|
||||
if (link.rel === 'wsagent.websocket') {
|
||||
return link.href;
|
||||
}
|
||||
}
|
||||
let endpoint = runtimeData.devMachine.runtime.envVariables.CHE_API_ENDPOINT;
|
||||
|
||||
var contextPath;
|
||||
|
||||
return 'ws://' + wsagentServerAddress + '/wsagent/ext/ws/' + workspaceId;
|
||||
return '';
|
||||
}
|
||||
|
||||
getIdeUrl(workspaceName) {
|
||||
|
|
|
|||
|
|
@ -24,33 +24,31 @@ export class CheRemoteProject {
|
|||
this.authData = authData;
|
||||
|
||||
// remote call
|
||||
this.remoteProjectsAPI = this.$resource('', {workspaceId: '@id'}, {
|
||||
import: {method: 'POST', url: authData.url + '/project/:workspaceId/import/:path?token=' + authData.token},
|
||||
update: {method: 'PUT', url: authData.url + '/project/:workspaceId/:path?token=' + authData.token}
|
||||
this.remoteProjectsAPI = this.$resource('', {}, {
|
||||
import: {method: 'POST', url: authData.url + '/project/import/:path?token=' + authData.token},
|
||||
update: {method: 'PUT', url: authData.url + '/project/:path?token=' + authData.token}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Import a project based located on the given workspace id and path
|
||||
* @param workspaceId the workspace ID to use
|
||||
* Import a project based located on the given path
|
||||
* @param path the path of the project
|
||||
* @param data the project body description
|
||||
* @returns {$promise|*|T.$promise}
|
||||
*/
|
||||
importProject(workspaceId, path, data) {
|
||||
importProject(path, data) {
|
||||
// remove unused description because we cannot set project description without project type
|
||||
if ((!data.type || data.type.length === 0) && data.description) {
|
||||
delete(data.description);
|
||||
}
|
||||
return this.remoteProjectsAPI.import({workspaceId: workspaceId, path: path}, data).$promise;
|
||||
return this.remoteProjectsAPI.import({path: path}, data).$promise;
|
||||
}
|
||||
|
||||
|
||||
updateProject(workspaceId, path, projectDetails) {
|
||||
updateProject(path, projectDetails) {
|
||||
return this.remoteProjectsAPI.update({
|
||||
workspaceId: workspaceId,
|
||||
path: path
|
||||
}, projectDetails).$promise;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ export class CheHttpBackend {
|
|||
|
||||
var projectTypeKeys = this.projectTypesWorkspaces.keys();
|
||||
for (let key of projectTypeKeys) {
|
||||
this.httpBackend.when('GET', this.workspaceAgentMap.get(key) + '/project-type/' + key).respond(this.projectTypesWorkspaces.get(key));
|
||||
this.httpBackend.when('GET', this.workspaceAgentMap.get(key) + '/project-type').respond(this.projectTypesWorkspaces.get(key));
|
||||
}
|
||||
|
||||
//memberships:
|
||||
|
|
@ -95,7 +95,8 @@ export class CheHttpBackend {
|
|||
var projectDetailsKeys = this.projectDetailsMap.keys();
|
||||
for (let projectKey of projectDetailsKeys) {
|
||||
let workspaceKey = projectKey.split('/')[0];
|
||||
this.httpBackend.when('GET', this.workspaceAgentMap.get(workspaceKey) + '/project/' + projectKey).respond(this.projectDetailsMap.get(projectKey));
|
||||
let projectId = projectKey.split('/')[1];
|
||||
this.httpBackend.when('GET', this.workspaceAgentMap.get(workspaceKey) + '/project/' + projectId).respond(this.projectDetailsMap.get(projectKey));
|
||||
}
|
||||
|
||||
// branding
|
||||
|
|
@ -164,7 +165,7 @@ export class CheHttpBackend {
|
|||
);
|
||||
|
||||
// add call to the backend
|
||||
this.httpBackend.when('GET', this.workspaceAgentMap.get(workspace.id) + '/project/' + workspace.id).respond(this.projectsPerWorkspace.get(workspace.id));
|
||||
this.httpBackend.when('GET', this.workspaceAgentMap.get(workspace.id) + '/project/').respond(this.projectsPerWorkspace.get(workspace.id));
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -308,7 +309,7 @@ export class CheHttpBackend {
|
|||
* @param projectName the project name
|
||||
*/
|
||||
addFetchProjectDetails(workspaceId, projectName) {
|
||||
this.httpBackend.when('GET', '/project/' + workspaceId + '/' + projectName)
|
||||
this.httpBackend.when('GET', '/project/' + projectName)
|
||||
.respond(this.projectDetailsMap.get(workspaceId + '/' + projectName));
|
||||
}
|
||||
|
||||
|
|
@ -319,7 +320,7 @@ export class CheHttpBackend {
|
|||
* @param newProjectName the new project name
|
||||
*/
|
||||
addUpdatedProjectName(workspaceId, projectName, newProjectName) {
|
||||
this.httpBackend.when('POST', '/project/' + workspaceId + '/rename/' + projectName + '?name=' + newProjectName).respond(newProjectName);
|
||||
this.httpBackend.when('POST', '/project/rename/' + projectName + '?name=' + newProjectName).respond(newProjectName);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -358,7 +359,7 @@ export class CheHttpBackend {
|
|||
* @param projectPath
|
||||
*/
|
||||
getLocalGitUrl(workspaceId, projectPath) {
|
||||
this.httpBackend.when('GET', this.workspaceAgentMap.get(workspaceId) + '/git/' + workspaceId + '/read-only-url?projectPath=' + projectPath)
|
||||
this.httpBackend.when('GET', this.workspaceAgentMap.get(workspaceId) + '/git/read-only-url?projectPath=' + projectPath)
|
||||
.respond(this.localGitUrlsMap.get(workspaceId + projectPath));
|
||||
}
|
||||
|
||||
|
|
@ -368,7 +369,7 @@ export class CheHttpBackend {
|
|||
* @param projectPath
|
||||
*/
|
||||
getRemoteGitUrlArray(workspaceId, projectPath) {
|
||||
this.httpBackend.when('POST', this.workspaceAgentMap.get(workspaceId) + '/git/' + workspaceId + '/remote-list?projectPath=' + projectPath)
|
||||
this.httpBackend.when('POST', this.workspaceAgentMap.get(workspaceId) + '/git/remote-list?projectPath=' + projectPath)
|
||||
.respond(this.remoteGitUrlArraysMap.get(workspaceId + projectPath));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -138,7 +138,6 @@ public class GitExtension {
|
|||
historyGroup.add(historyAction);
|
||||
actionManager.registerAction("gitStatus", showStatusAction);
|
||||
historyGroup.add(showStatusAction);
|
||||
|
||||
actionManager.registerAction("gitPush", pushAction);
|
||||
remoteGroup.add(pushAction);
|
||||
actionManager.registerAction("gitFetch", fetchAction);
|
||||
|
|
|
|||
|
|
@ -99,7 +99,6 @@ public abstract class BaseTest {
|
|||
|
||||
@Before
|
||||
public void disarm() {
|
||||
when(appContext.getWorkspaceId()).thenReturn("id");
|
||||
when(appContext.getCurrentProject()).thenReturn(currentProject);
|
||||
|
||||
when(currentProject.getProjectConfig()).thenReturn(projectConfig);
|
||||
|
|
|
|||
|
|
@ -75,7 +75,6 @@ public class AddToIndexPresenterTest extends BaseTest {
|
|||
@Override
|
||||
public void disarm() {
|
||||
super.disarm();
|
||||
when(appContext.getWorkspaceId()).thenReturn("id");
|
||||
presenter = new AddToIndexPresenter(view,
|
||||
appContext,
|
||||
dtoUnmarshallerFactory,
|
||||
|
|
|
|||
|
|
@ -113,7 +113,6 @@ public class BranchPresenterTest extends BaseTest {
|
|||
public void disarm() {
|
||||
super.disarm();
|
||||
|
||||
when(appContext.getWorkspaceId()).thenReturn("id");
|
||||
presenter = new BranchPresenter(view,
|
||||
dtoFactory,
|
||||
editorAgent,
|
||||
|
|
|
|||
|
|
@ -64,8 +64,6 @@ public class CommitPresenterTest extends BaseTest {
|
|||
public void disarm() {
|
||||
super.disarm();
|
||||
|
||||
when(appContext.getWorkspaceId()).thenReturn("id");
|
||||
|
||||
presenter = new CommitPresenter(view,
|
||||
service,
|
||||
constant,
|
||||
|
|
|
|||
|
|
@ -60,7 +60,6 @@ public class FetchPresenterTest extends BaseTest {
|
|||
@Override
|
||||
public void disarm() {
|
||||
super.disarm();
|
||||
when(appContext.getWorkspaceId()).thenReturn("id");
|
||||
presenter = new FetchPresenter(dtoFactory,
|
||||
view,
|
||||
service,
|
||||
|
|
|
|||
|
|
@ -87,9 +87,6 @@ public class HistoryPresenterTest extends BaseTest {
|
|||
@Override
|
||||
public void disarm() {
|
||||
super.disarm();
|
||||
|
||||
when(appContext.getWorkspaceId()).thenReturn("id");
|
||||
|
||||
presenter = new HistoryPresenter(view,
|
||||
eventBus,
|
||||
resources,
|
||||
|
|
|
|||
|
|
@ -69,7 +69,6 @@ public class MergePresenterTest extends BaseTest {
|
|||
@Override
|
||||
public void disarm() {
|
||||
super.disarm();
|
||||
when(appContext.getWorkspaceId()).thenReturn("id");
|
||||
presenter = new MergePresenter(view,
|
||||
eventBus,
|
||||
editorAgent,
|
||||
|
|
|
|||
|
|
@ -80,9 +80,6 @@ public class PullPresenterTest extends BaseTest {
|
|||
@Override
|
||||
public void disarm() {
|
||||
super.disarm();
|
||||
|
||||
when(appContext.getWorkspaceId()).thenReturn("id");
|
||||
|
||||
List<EditorPartPresenter> partPresenterList = new ArrayList<>();
|
||||
partPresenterList.add(partPresenter);
|
||||
|
||||
|
|
|
|||
|
|
@ -89,9 +89,6 @@ public class PushToRemotePresenterTest extends BaseTest {
|
|||
|
||||
public void disarm() {
|
||||
super.disarm();
|
||||
|
||||
when(appContext.getWorkspaceId()).thenReturn("id");
|
||||
|
||||
when(view.getRepository()).thenReturn(REPOSITORY_NAME);
|
||||
when(view.getLocalBranch()).thenReturn(LOCAL_BRANCH);
|
||||
when(view.getRemoteBranch()).thenReturn(REMOTE_BRANCH);
|
||||
|
|
|
|||
|
|
@ -71,8 +71,6 @@ public class ResetToCommitPresenterTest extends BaseTest {
|
|||
@Override
|
||||
public void disarm() {
|
||||
super.disarm();
|
||||
when(appContext.getWorkspaceId()).thenReturn("id");
|
||||
|
||||
presenter = new ResetToCommitPresenter(view,
|
||||
service,
|
||||
constant,
|
||||
|
|
|
|||
|
|
@ -51,9 +51,6 @@ public class ResetFilesPresenterTest extends BaseTest {
|
|||
@Override
|
||||
public void disarm() {
|
||||
super.disarm();
|
||||
|
||||
when(appContext.getWorkspaceId()).thenReturn("id");
|
||||
|
||||
presenter = new ResetFilesPresenter(view,
|
||||
service,
|
||||
appContext,
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ public class GitHubClientServiceImpl implements GitHubClientService {
|
|||
|
||||
|
||||
private String baseUrl() {
|
||||
return appContext.getDevMachine().getWsAgentBaseUrl() + "/github/" + appContext.getWorkspaceId();
|
||||
return appContext.getDevMachine().getWsAgentBaseUrl() + "/github";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ import static org.eclipse.che.dto.server.DtoFactory.newDto;
|
|||
* @author Kevin Pollet
|
||||
* @author Igor vinokur
|
||||
*/
|
||||
@Path("/github/{ws-id}")
|
||||
@Path("/github")
|
||||
public class GitHubService {
|
||||
@Inject
|
||||
private GitHubFactory gitHubFactory;
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ import org.eclipse.che.jdt.rest.CompilerSetupService;
|
|||
import org.eclipse.che.jdt.rest.FormatService;
|
||||
import org.eclipse.che.jdt.rest.JavaNavigationService;
|
||||
import org.eclipse.che.jdt.rest.JavaReconcileService;
|
||||
import org.eclipse.che.jdt.rest.JavadocService;
|
||||
import org.eclipse.che.jdt.rest.JdtExceptionMapper;
|
||||
import org.eclipse.che.jdt.rest.RefactoringService;
|
||||
import org.eclipse.che.jdt.rest.SearchService;
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ import java.util.List;
|
|||
/**
|
||||
* @author Evgen Vidolob
|
||||
*/
|
||||
@Path("jdt/{wsId}/code-assist")
|
||||
@Path("jdt/code-assist")
|
||||
public class CodeAssistService {
|
||||
|
||||
private static final JavaModel model = JavaModelManager.getJavaModelManager().getJavaModel();
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
|
|||
*
|
||||
* @author Dmitry Shnurenko
|
||||
*/
|
||||
@Path("/jdt/{wsId}/compiler-settings")
|
||||
@Path("/jdt/compiler-settings")
|
||||
public class CompilerSetupService {
|
||||
|
||||
private static final JavaModel JAVA_MODEL = JavaModelManager.getJavaModelManager().getJavaModel();
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ import java.util.List;
|
|||
/**
|
||||
* @author Roman Nikitenko
|
||||
*/
|
||||
@Path("code-formatting/{wsId}")
|
||||
@Path("code-formatting")
|
||||
public class FormatService {
|
||||
private Formatter formatter;
|
||||
|
||||
|
|
|
|||
|
|
@ -28,12 +28,10 @@ import java.util.concurrent.ExecutionException;
|
|||
*
|
||||
* @author Evgen Vidolob
|
||||
*/
|
||||
@Path("jdt/{wsId}/classpath")
|
||||
@Path("jdt/classpath")
|
||||
public class JavaClasspathService {
|
||||
@Inject
|
||||
private ClassPathBuilder classPathBuilder;
|
||||
@PathParam("wsId")
|
||||
private String workspaceId;
|
||||
|
||||
/**
|
||||
* Update dependencies.
|
||||
|
|
@ -47,6 +45,6 @@ public class JavaClasspathService {
|
|||
@GET
|
||||
public ClassPathBuilderResult update(@QueryParam("projectpath") final String projectPath) throws ExecutionException,
|
||||
InterruptedException {
|
||||
return classPathBuilder.buildClassPath(workspaceId, projectPath);
|
||||
return classPathBuilder.buildClassPath(projectPath);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ import java.util.List;
|
|||
/**
|
||||
* @author Evgen Vidolob
|
||||
*/
|
||||
@Path("jdt/{wsId}/navigation")
|
||||
@Path("jdt/navigation")
|
||||
public class JavaNavigationService {
|
||||
JavaModel MODEL = JavaModelManager.getJavaModelManager().getJavaModel();
|
||||
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ import javax.ws.rs.QueryParam;
|
|||
/**
|
||||
* @author Evgen Vidolob
|
||||
*/
|
||||
@Path("jdt/{wsId}/reconcile")
|
||||
@Path("jdt/reconcile")
|
||||
public class JavaReconcileService {
|
||||
|
||||
private static final JavaModel model = JavaModelManager.getJavaModelManager().getJavaModel();
|
||||
|
|
|
|||
|
|
@ -8,15 +8,15 @@
|
|||
* Contributors:
|
||||
* Codenvy, S.A. - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.che.jdt;
|
||||
package org.eclipse.che.jdt.rest;
|
||||
|
||||
import org.eclipse.che.jdt.JavadocFinder;
|
||||
import org.eclipse.jdt.internal.core.JavaModelManager;
|
||||
import org.eclipse.jdt.core.IJavaProject;
|
||||
import org.eclipse.jdt.core.JavaModelException;
|
||||
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.PathParam;
|
||||
import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.QueryParam;
|
||||
import javax.ws.rs.core.Context;
|
||||
|
|
@ -26,13 +26,9 @@ import javax.ws.rs.core.UriInfo;
|
|||
/**
|
||||
* @author Evgen Vidolob
|
||||
*/
|
||||
@Path("jdt/{wsId}/javadoc")
|
||||
@Path("jdt/javadoc")
|
||||
public class JavadocService {
|
||||
|
||||
@PathParam("wsId")
|
||||
private String wsId;
|
||||
|
||||
|
||||
@Path("find")
|
||||
@GET
|
||||
@Produces("text/html")
|
||||
|
|
@ -53,7 +49,7 @@ public class JavadocService {
|
|||
}
|
||||
|
||||
private String getUrlPart(String projectPath, UriBuilder uriBuilder) {
|
||||
return uriBuilder.clone().path(JavadocService.class).path(JavadocService.class, "get").build(wsId).toString() + "?projectpath=" + projectPath + "&handle=";
|
||||
return uriBuilder.clone().path(JavadocService.class).path(JavadocService.class, "get").build().toString() + "?projectpath=" + projectPath + "&handle=";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -56,7 +56,7 @@ import java.util.function.Function;
|
|||
*
|
||||
* @author Evgen Vidolob
|
||||
*/
|
||||
@Path("/jdt/{ws-id}/refactoring")
|
||||
@Path("/jdt/refactoring")
|
||||
public class RefactoringService {
|
||||
private static final JavaModel model = JavaModelManager.getJavaModelManager().getJavaModel();
|
||||
private RefactoringManager manager;
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
|
|||
*
|
||||
* @author Evgen Vidolob
|
||||
*/
|
||||
@Path("jdt/{ws-id}/search")
|
||||
@Path("jdt/search")
|
||||
public class SearchService {
|
||||
|
||||
@Inject
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ public class JavaClasspathServiceClientImpl implements JavaClasspathServiceClien
|
|||
protected JavaClasspathServiceClientImpl(AppContext appContext,
|
||||
WsAgentStateController wsAgentStateController) {
|
||||
this.wsAgentStateController = wsAgentStateController;
|
||||
this.baseHttpUrl = "/jdt/" + appContext.getWorkspace().getId();
|
||||
this.baseHttpUrl = "/jdt/";
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
|
|
|
|||
|
|
@ -47,7 +47,6 @@ public class JavaCodeAssistClient {
|
|||
|
||||
private final DtoUnmarshallerFactory unmarshallerFactory;
|
||||
private final AsyncRequestFactory asyncRequestFactory;
|
||||
private final String workspaceId;
|
||||
private final MessageLoader loader;
|
||||
private final AppContext appContext;
|
||||
|
||||
|
|
@ -57,21 +56,20 @@ public class JavaCodeAssistClient {
|
|||
LoaderFactory loaderFactory,
|
||||
AsyncRequestFactory asyncRequestFactory) {
|
||||
this.appContext = appContext;
|
||||
this.workspaceId = appContext.getWorkspaceId();
|
||||
this.unmarshallerFactory = unmarshallerFactory;
|
||||
this.loader = loaderFactory.newLoader();
|
||||
this.asyncRequestFactory = asyncRequestFactory;
|
||||
}
|
||||
|
||||
public void computeProposals(String projectPath, String fqn, int offset, String contents, AsyncRequestCallback<Proposals> callback) {
|
||||
String url = appContext.getDevMachine().getWsAgentBaseUrl() + "/jdt/" + workspaceId + "/code-assist/compute/completion" + "/?projectpath=" +
|
||||
String url = appContext.getDevMachine().getWsAgentBaseUrl() + "/jdt/code-assist/compute/completion" + "/?projectpath=" +
|
||||
projectPath + "&fqn=" + fqn + "&offset=" + offset;
|
||||
asyncRequestFactory.createPostRequest(url, null).data(contents).send(callback);
|
||||
}
|
||||
|
||||
public void computeAssistProposals(String projectPath, String fqn, int offset, List<Problem> problems,
|
||||
AsyncRequestCallback<Proposals> callback) {
|
||||
String url = appContext.getDevMachine().getWsAgentBaseUrl() + "/jdt/" + workspaceId + "/code-assist/compute/assist" + "/?projectpath=" +
|
||||
String url = appContext.getDevMachine().getWsAgentBaseUrl() + "/jdt/code-assist/compute/assist" + "/?projectpath=" +
|
||||
projectPath + "&fqn=" + fqn + "&offset=" + offset;
|
||||
List<Problem> prob = new ArrayList<>();
|
||||
prob.addAll(problems);
|
||||
|
|
@ -80,7 +78,7 @@ public class JavaCodeAssistClient {
|
|||
|
||||
|
||||
public void applyProposal(String sessionId, int index, boolean insert, final AsyncCallback<ProposalApplyResult> callback) {
|
||||
String url = appContext.getDevMachine().getWsAgentBaseUrl() + "/jdt/" + workspaceId + "/code-assist/apply/completion/?sessionid=" +
|
||||
String url = appContext.getDevMachine().getWsAgentBaseUrl() + "/jdt/code-assist/apply/completion/?sessionid=" +
|
||||
sessionId + "&index=" + index + "&insert=" + insert;
|
||||
Unmarshallable<ProposalApplyResult> unmarshaller =
|
||||
unmarshallerFactory.newUnmarshaller(ProposalApplyResult.class);
|
||||
|
|
@ -98,7 +96,7 @@ public class JavaCodeAssistClient {
|
|||
}
|
||||
|
||||
public String getProposalDocUrl(int id, String sessionId) {
|
||||
return appContext.getDevMachine().getWsAgentBaseUrl() + "/jdt/" + workspaceId + "/code-assist/compute/info?sessionid=" + sessionId +
|
||||
return appContext.getDevMachine().getWsAgentBaseUrl() + "/jdt/code-assist/compute/info?sessionid=" + sessionId +
|
||||
"&index=" + id;
|
||||
}
|
||||
|
||||
|
|
@ -118,7 +116,7 @@ public class JavaCodeAssistClient {
|
|||
return newPromise(new AsyncPromiseHelper.RequestCall<List<Change>>() {
|
||||
@Override
|
||||
public void makeCall(AsyncCallback<List<Change>> callback) {
|
||||
String url = appContext.getDevMachine().getWsAgentBaseUrl() + "/code-formatting/" + workspaceId + "/format?offset=" + offset +
|
||||
String url = appContext.getDevMachine().getWsAgentBaseUrl() + "/code-formatting/format?offset=" + offset +
|
||||
"&length=" + length;
|
||||
asyncRequestFactory.createPostRequest(url, null)
|
||||
.header(CONTENT_TYPE, MimeType.TEXT_PLAIN)
|
||||
|
|
@ -148,9 +146,7 @@ public class JavaCodeAssistClient {
|
|||
*/
|
||||
public Promise<List<ConflictImportDTO>> organizeImports(String projectPath, String fqn) {
|
||||
String url = appContext.getDevMachine().getWsAgentBaseUrl() +
|
||||
"/jdt/" +
|
||||
workspaceId +
|
||||
"/code-assist/organize-imports?projectpath=" + projectPath +
|
||||
"/jdt/code-assist/organize-imports?projectpath=" + projectPath +
|
||||
"&fqn=" + fqn;
|
||||
|
||||
return asyncRequestFactory.createPostRequest(url, null)
|
||||
|
|
@ -168,9 +164,7 @@ public class JavaCodeAssistClient {
|
|||
*/
|
||||
public Promise<Void> applyChosenImports(String projectPath, String fqn, ConflictImportDTO chosen) {
|
||||
String url = appContext.getDevMachine().getWsAgentBaseUrl() +
|
||||
"/jdt/" +
|
||||
workspaceId +
|
||||
"/code-assist/apply-imports?projectpath=" + projectPath +
|
||||
"/jdt/code-assist/apply-imports?projectpath=" + projectPath +
|
||||
"&fqn=" + fqn;
|
||||
|
||||
return asyncRequestFactory.createPostRequest(url, chosen)
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ public class JavaReconcileClient {
|
|||
}
|
||||
|
||||
public void reconcile(String projectPath, String fqn, final ReconcileCallback callback) {
|
||||
String url = appContext.getDevMachine().getWsAgentBaseUrl() + "/jdt/" + appContext.getWorkspaceId() + "/reconcile/?projectpath=" + projectPath + "&fqn=" + fqn;
|
||||
String url = appContext.getDevMachine().getWsAgentBaseUrl() + "/jdt/reconcile/?projectpath=" + projectPath + "&fqn=" + fqn;
|
||||
asyncRequestFactory.createGetRequest(url)
|
||||
.send(new AsyncRequestCallback<ReconcileResult>(dtoUnmarshallerFactory.newUnmarshaller(ReconcileResult.class)) {
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -47,7 +47,6 @@ public class JavaNavigationServiceImpl implements JavaNavigationService {
|
|||
private final AppContext appContext;
|
||||
private final LoaderFactory loaderFactory;
|
||||
private final AsyncRequestFactory requestFactory;
|
||||
private final String workspaceId;
|
||||
private final DtoUnmarshallerFactory unmarshallerFactory;
|
||||
|
||||
@Inject
|
||||
|
|
@ -58,40 +57,39 @@ public class JavaNavigationServiceImpl implements JavaNavigationService {
|
|||
this.appContext = appContext;
|
||||
this.loaderFactory = loaderFactory;
|
||||
this.requestFactory = asyncRequestFactory;
|
||||
this.workspaceId = appContext.getWorkspaceId();
|
||||
this.unmarshallerFactory = unmarshallerFactory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void findDeclaration(String projectPath, String fqn, int offset, AsyncRequestCallback<OpenDeclarationDescriptor> callback) {
|
||||
String url = appContext.getDevMachine().getWsAgentBaseUrl() + "/jdt/" + workspaceId + "/navigation/find-declaration" +
|
||||
String url = appContext.getDevMachine().getWsAgentBaseUrl() + "/jdt/navigation/find-declaration" +
|
||||
"?projectpath=" + projectPath + "&fqn=" + fqn + "&offset=" + offset;
|
||||
requestFactory.createGetRequest(url).send(callback);
|
||||
}
|
||||
|
||||
public void getExternalLibraries(String projectPath, AsyncRequestCallback<List<Jar>> callback) {
|
||||
String url =
|
||||
appContext.getDevMachine().getWsAgentBaseUrl() + "/jdt/" + workspaceId + "/navigation/libraries?projectpath=" + projectPath;
|
||||
appContext.getDevMachine().getWsAgentBaseUrl() + "/jdt/navigation/libraries?projectpath=" + projectPath;
|
||||
requestFactory.createGetRequest(url).send(callback);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getLibraryChildren(String projectPath, int libId, AsyncRequestCallback<List<JarEntry>> callback) {
|
||||
String url = appContext.getDevMachine().getWsAgentBaseUrl() + "/jdt/" + workspaceId + "/navigation/lib/children" +
|
||||
String url = appContext.getDevMachine().getWsAgentBaseUrl() + "/jdt/navigation/lib/children" +
|
||||
"?projectpath=" + projectPath + "&root=" + libId;
|
||||
requestFactory.createGetRequest(url).send(callback);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getChildren(String projectPath, int libId, String path, AsyncRequestCallback<List<JarEntry>> callback) {
|
||||
String url = appContext.getDevMachine().getWsAgentBaseUrl() + "/jdt/" + workspaceId + "/navigation/children" +
|
||||
String url = appContext.getDevMachine().getWsAgentBaseUrl() + "/jdt/navigation/children" +
|
||||
"?projectpath=" + projectPath + "&root=" + libId + "&path=" + path;
|
||||
requestFactory.createGetRequest(url).send(callback);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getEntry(String projectPath, int libId, String path, AsyncRequestCallback<JarEntry> callback) {
|
||||
String url = appContext.getDevMachine().getWsAgentBaseUrl() + "/jdt/" + workspaceId + "/navigation/entry" +
|
||||
String url = appContext.getDevMachine().getWsAgentBaseUrl() + "/jdt/navigation/entry" +
|
||||
"?projectpath=" + projectPath + "&root=" + libId + "&path=" + path;
|
||||
requestFactory.createGetRequest(url).send(callback);
|
||||
}
|
||||
|
|
@ -105,14 +103,14 @@ public class JavaNavigationServiceImpl implements JavaNavigationService {
|
|||
|
||||
@Override
|
||||
public void getContent(String projectPath, String fqn, AsyncRequestCallback<ClassContent> callback) {
|
||||
String url = appContext.getDevMachine().getWsAgentBaseUrl() + "/jdt/" + workspaceId + "/navigation/contentbyfqn?projectpath=" + projectPath + "&fqn=" + fqn;
|
||||
String url = appContext.getDevMachine().getWsAgentBaseUrl() + "/jdt/navigation/contentbyfqn?projectpath=" + projectPath + "&fqn=" + fqn;
|
||||
requestFactory.createGetRequest(url).send(callback);
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public Promise<CompilationUnit> getCompilationUnit(String projectPath, String fqn, boolean showInherited) {
|
||||
final String url = appContext.getDevMachine().getWsAgentBaseUrl() + "/jdt/" + workspaceId + "/navigation/compilation-unit" +
|
||||
final String url = appContext.getDevMachine().getWsAgentBaseUrl() + "/jdt/navigation/compilation-unit" +
|
||||
"?projectpath=" + projectPath + "&fqn=" + fqn + "&showinherited=" + showInherited;
|
||||
|
||||
return newPromise(new AsyncPromiseHelper.RequestCall<CompilationUnit>() {
|
||||
|
|
@ -127,7 +125,7 @@ public class JavaNavigationServiceImpl implements JavaNavigationService {
|
|||
|
||||
@Override
|
||||
public Promise<ImplementationsDescriptorDTO> getImplementations(String projectPath, String fqn, int offset) {
|
||||
final String url = appContext.getDevMachine().getWsAgentBaseUrl() + "/jdt/" + workspaceId + "/navigation/implementations" +
|
||||
final String url = appContext.getDevMachine().getWsAgentBaseUrl() + "/jdt/navigation/implementations" +
|
||||
"?projectpath=" + projectPath + "&fqn=" + fqn + "&offset=" + offset;
|
||||
|
||||
return requestFactory.createGetRequest(url)
|
||||
|
|
@ -138,8 +136,7 @@ public class JavaNavigationServiceImpl implements JavaNavigationService {
|
|||
|
||||
@Override
|
||||
public Promise<List<JavaProject>> getProjectsAndPackages(boolean includePackage) {
|
||||
final String url = appContext.getDevMachine().getWsAgentBaseUrl() + "/jdt/" + workspaceId +
|
||||
"/navigation/get/projects/and/packages"
|
||||
final String url = appContext.getDevMachine().getWsAgentBaseUrl() + "/jdt/navigation/get/projects/and/packages"
|
||||
+ "?includepackages=" + includePackage;
|
||||
|
||||
return newPromise(new AsyncPromiseHelper.RequestCall<List<JavaProject>>() {
|
||||
|
|
@ -156,13 +153,13 @@ public class JavaNavigationServiceImpl implements JavaNavigationService {
|
|||
|
||||
@Override
|
||||
public String getContentUrl(String projectPath, int libId, String path) {
|
||||
return appContext.getDevMachine().getWsAgentBaseUrl() + "/jdt/" + workspaceId + "/navigation/content" +
|
||||
return appContext.getDevMachine().getWsAgentBaseUrl() + "/jdt/navigation/content" +
|
||||
"?projectpath=" + projectPath + "&root=" + libId + "&path=" + path;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Promise<List<MethodParameters>> getMethodParametersHints(String projectPath, String fqn, int offset, int lineStartOffset) {
|
||||
String url = appContext.getDevMachine().getWsAgentBaseUrl() + "/jdt/" + workspaceId + "/navigation/parameters" +
|
||||
String url = appContext.getDevMachine().getWsAgentBaseUrl() + "/jdt/navigation/parameters" +
|
||||
"?projectpath=" + projectPath + "&fqn=" + fqn + "&offset=" + offset + "&lineStart=" + lineStartOffset;
|
||||
|
||||
return requestFactory.createGetRequest(url)
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ public class ClasspathServiceClientImpl implements ClasspathServiceClient {
|
|||
this.appContext = appContext;
|
||||
this.loader = loaderFactory.newLoader();
|
||||
|
||||
this.pathToService = "/jdt/" + appContext.getWorkspaceId() + "/classpath";
|
||||
this.pathToService = "/jdt/classpath";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ public abstract class AbstractExternalLibrariesNodeInterceptor implements NodeIn
|
|||
@Override
|
||||
public Promise<List<Node>> intercept(Node parent, List<Node> children) {
|
||||
|
||||
if (!(isProjectOrModuleNode(parent)/* || isJavaProject(parent)*/)) {
|
||||
if (!isProjectOrModuleNode(parent)) {
|
||||
return Promises.resolve(children);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ final class RefactoringServiceClientImpl implements RefactoringServiceClient {
|
|||
this.unmarshallerFactory = unmarshallerFactory;
|
||||
this.appContext = appContext;
|
||||
this.loader = loaderFactory.newLoader();
|
||||
this.pathToService = "/jdt/" + appContext.getWorkspaceId() + "/refactoring/";
|
||||
this.pathToService = "/jdt/refactoring/";
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ public class JavaSearchServiceRest implements JavaSearchService {
|
|||
this.unmarshallerFactory = unmarshallerFactory;
|
||||
this.appContext = appContext;
|
||||
this.loader = loaderFactory.newLoader();
|
||||
this.pathToService = "/jdt/" + appContext.getWorkspaceId() + "/search/";
|
||||
this.pathToService = "/jdt/search/find/usages";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -61,7 +61,7 @@ public class JavaSearchServiceRest implements JavaSearchService {
|
|||
@Override
|
||||
public void makeCall(AsyncCallback<FindUsagesResponse> callback) {
|
||||
|
||||
asyncRequestFactory.createPostRequest(appContext.getDevMachine().getWsAgentBaseUrl() + pathToService + "find/usages", request)
|
||||
asyncRequestFactory.createPostRequest(appContext.getDevMachine().getWsAgentBaseUrl() + pathToService, request)
|
||||
.header(CONTENT_TYPE, APPLICATION_JSON)
|
||||
.loader(loader)
|
||||
.send(newCallback(callback, unmarshallerFactory.newUnmarshaller(FindUsagesResponse.class)));
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ public class JavaSearchServiceWS implements JavaSearchService {
|
|||
this.dtoFactory = dtoFactory;
|
||||
this.loader = loaderFactory.newLoader();
|
||||
this.unmarshallerFactory = unmarshallerFactory;
|
||||
this.pathToService = "/jdt/" + appContext.getWorkspace().getId() + "/search/";
|
||||
this.pathToService = "/jdt/search/";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ public class SettingsServiceClientImpl implements SettingsServiceClient {
|
|||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public Promise<Void> applyCompileParameters(@NotNull final Map<String, String> parameters) {
|
||||
String url = appContext.getDevMachine().getWsAgentBaseUrl() + "/jdt/" + appContext.getWorkspaceId() + "/compiler-settings/set";
|
||||
String url = appContext.getDevMachine().getWsAgentBaseUrl() + "/jdt/compiler-settings/set";
|
||||
|
||||
JsonSerializable data = new JsonSerializable() {
|
||||
@Override
|
||||
|
|
@ -62,7 +62,7 @@ public class SettingsServiceClientImpl implements SettingsServiceClient {
|
|||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public Promise<Map<String, String>> getCompileParameters() {
|
||||
String url = appContext.getDevMachine().getWsAgentBaseUrl() + "/jdt/" + appContext.getWorkspaceId() + "/compiler-settings/all";
|
||||
String url = appContext.getDevMachine().getWsAgentBaseUrl() + "/jdt/compiler-settings/all";
|
||||
|
||||
return asyncRequestFactory.createGetRequest(url)
|
||||
.header(ACCEPT, APPLICATION_JSON)
|
||||
|
|
|
|||
|
|
@ -107,9 +107,6 @@ public class OrganizeImportsPresenterTest {
|
|||
when(projectConfigDto.getPath()).thenReturn(PATH);
|
||||
when(file.getName()).thenReturn("A.java");
|
||||
when(file.getPath()).thenReturn(PATH);
|
||||
|
||||
when(appContext.getWorkspaceId()).thenReturn(WS_ID);
|
||||
|
||||
when(javaCodeAssistClient.organizeImports(anyString(), anyString())).thenReturn(importsPromise);
|
||||
when(importsPromise.then(Matchers.<Operation<List<ConflictImportDTO>>>anyObject())).thenReturn(importsPromise);
|
||||
|
||||
|
|
|
|||
|
|
@ -25,8 +25,6 @@ public interface ClassPathBuilder {
|
|||
/**
|
||||
* Builds classpath for the current project.
|
||||
*
|
||||
* @param workspaceId
|
||||
* id of current workspace
|
||||
* @param projectPath
|
||||
* relative path to current project from the workspace
|
||||
* @return information about building project classpath
|
||||
|
|
@ -35,5 +33,5 @@ public interface ClassPathBuilder {
|
|||
* @throws InterruptedException
|
||||
* if the current thread was interrupted
|
||||
*/
|
||||
ClassPathBuilderResult buildClassPath(String workspaceId, String projectPath) throws ExecutionException, InterruptedException;
|
||||
ClassPathBuilderResult buildClassPath(String projectPath) throws ExecutionException, InterruptedException;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ import static java.util.Collections.emptyList;
|
|||
*
|
||||
* @author Valeriy Svydenko
|
||||
*/
|
||||
@Path("jdt/{wsId}/classpath/")
|
||||
@Path("jdt/classpath/")
|
||||
public class ClasspathService {
|
||||
|
||||
private static final JavaModel model = JavaModelManager.getJavaModelManager().getJavaModel();
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ public class ClasspathUpdaterServiceClientImpl implements ClasspathUpdaterServic
|
|||
this.appContext = appContext;
|
||||
this.loader = loaderFactory.newLoader();
|
||||
|
||||
this.pathToService = "/jdt/" + appContext.getWorkspaceId() + "/classpath/";
|
||||
this.pathToService = "/jdt/classpath/";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ import static org.eclipse.jdt.core.JavaCore.newVariableEntry;
|
|||
*
|
||||
* @author Valeriy Svydenko
|
||||
*/
|
||||
@Path("jdt/{wsId}/classpath/update")
|
||||
@Path("jdt/classpath/update")
|
||||
public class ClasspathUpdaterService {
|
||||
private static final JavaModel model = JavaModelManager.getJavaModelManager().getJavaModel();
|
||||
|
||||
|
|
|
|||
|
|
@ -1,76 +0,0 @@
|
|||
/*******************************************************************************
|
||||
* 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.maven.client.actions;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.Singleton;
|
||||
|
||||
import org.eclipse.che.ide.api.action.AbstractPerspectiveAction;
|
||||
import org.eclipse.che.ide.api.action.ActionEvent;
|
||||
import org.eclipse.che.ide.api.action.Presentation;
|
||||
import org.eclipse.che.ide.api.app.AppContext;
|
||||
import org.eclipse.che.ide.api.app.CurrentProject;
|
||||
import org.eclipse.che.plugin.maven.client.MavenLocalizationConstant;
|
||||
import org.eclipse.che.plugin.maven.client.MavenResources;
|
||||
import org.eclipse.che.plugin.maven.client.module.CreateMavenModulePresenter;
|
||||
import org.eclipse.che.plugin.maven.shared.MavenAttributes;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Collections;
|
||||
|
||||
import static org.eclipse.che.ide.workspace.perspectives.project.ProjectPerspective.PROJECT_PERSPECTIVE_ID;
|
||||
|
||||
/**
|
||||
* Action for creating Maven module.
|
||||
*
|
||||
* @author Evgen Vidolob
|
||||
* @author Artem Zatsarynnyi
|
||||
*/
|
||||
@Singleton
|
||||
public class CreateMavenModuleAction extends AbstractPerspectiveAction {
|
||||
|
||||
private final AppContext appContext;
|
||||
private final CreateMavenModulePresenter presenter;
|
||||
|
||||
@Inject
|
||||
public CreateMavenModuleAction(MavenLocalizationConstant constant,
|
||||
CreateMavenModulePresenter presenter,
|
||||
AppContext appContext,
|
||||
MavenResources mavenResources) {
|
||||
super(Collections.singletonList(PROJECT_PERSPECTIVE_ID),
|
||||
constant.actionCreateMavenModuleText(),
|
||||
constant.actionCreateMavenModuleDescription(),
|
||||
null,
|
||||
mavenResources.maven());
|
||||
this.presenter = presenter;
|
||||
this.appContext = appContext;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
if (appContext.getCurrentProject() != null) {
|
||||
presenter.showDialog(appContext.getCurrentProject());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateInPerspective(@NotNull ActionEvent event) {
|
||||
final Presentation presentation = event.getPresentation();
|
||||
final CurrentProject currentProject = appContext.getCurrentProject();
|
||||
if (currentProject == null) {
|
||||
presentation.setEnabledAndVisible(false);
|
||||
return;
|
||||
}
|
||||
|
||||
presentation.setVisible(MavenAttributes.MAVEN_ID.equals(currentProject.getRootProject().getType()));
|
||||
presentation.setEnabled("pom".equals(currentProject.getAttributeValue(MavenAttributes.PACKAGING)));
|
||||
}
|
||||
}
|
||||
|
|
@ -1,265 +0,0 @@
|
|||
/*******************************************************************************
|
||||
* 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.maven.client.module;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.Singleton;
|
||||
|
||||
import org.eclipse.che.ide.api.project.ProjectServiceClient;
|
||||
import org.eclipse.che.api.project.shared.dto.GeneratorDescription;
|
||||
import org.eclipse.che.api.workspace.shared.dto.ProjectConfigDto;
|
||||
import org.eclipse.che.ide.api.app.AppContext;
|
||||
import org.eclipse.che.ide.api.app.CurrentProject;
|
||||
import org.eclipse.che.ide.api.project.node.HasStorablePath;
|
||||
import org.eclipse.che.ide.api.selection.Selection;
|
||||
import org.eclipse.che.ide.api.selection.SelectionAgent;
|
||||
import org.eclipse.che.ide.dto.DtoFactory;
|
||||
import org.eclipse.che.plugin.maven.client.MavenArchetype;
|
||||
import org.eclipse.che.plugin.maven.client.MavenExtension;
|
||||
import org.eclipse.che.plugin.maven.client.MavenLocalizationConstant;
|
||||
import org.eclipse.che.ide.part.explorer.project.ProjectExplorerPresenter;
|
||||
import org.eclipse.che.ide.project.node.ModuleNode;
|
||||
import org.eclipse.che.ide.project.node.ProjectNode;
|
||||
import org.eclipse.che.ide.rest.AsyncRequestCallback;
|
||||
import org.eclipse.che.ide.rest.DtoUnmarshallerFactory;
|
||||
import org.eclipse.che.ide.api.dialogs.DialogFactory;
|
||||
import org.eclipse.che.ide.util.NameUtils;
|
||||
import org.eclipse.che.ide.util.loging.Log;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.eclipse.che.plugin.maven.shared.MavenAttributes.ARCHETYPE_GENERATION_STRATEGY;
|
||||
import static org.eclipse.che.plugin.maven.shared.MavenAttributes.ARTIFACT_ID;
|
||||
import static org.eclipse.che.plugin.maven.shared.MavenAttributes.GROUP_ID;
|
||||
import static org.eclipse.che.plugin.maven.shared.MavenAttributes.MAVEN_ID;
|
||||
import static org.eclipse.che.plugin.maven.shared.MavenAttributes.PACKAGING;
|
||||
import static org.eclipse.che.plugin.maven.shared.MavenAttributes.PARENT_ARTIFACT_ID;
|
||||
import static org.eclipse.che.plugin.maven.shared.MavenAttributes.PARENT_GROUP_ID;
|
||||
import static org.eclipse.che.plugin.maven.shared.MavenAttributes.PARENT_VERSION;
|
||||
import static org.eclipse.che.plugin.maven.shared.MavenAttributes.VERSION;
|
||||
|
||||
/**
|
||||
* @author Evgen Vidolob
|
||||
* @author Dmitry Shnurenko
|
||||
*/
|
||||
@Singleton
|
||||
public class CreateMavenModulePresenter implements CreateMavenModuleView.ActionDelegate {
|
||||
|
||||
private final AppContext appContext;
|
||||
private final CreateMavenModuleView view;
|
||||
private final ProjectServiceClient projectService;
|
||||
private final DtoFactory dtoFactory;
|
||||
private final DialogFactory dialogFactory;
|
||||
private final ProjectExplorerPresenter projectExplorer;
|
||||
private final MavenLocalizationConstant locale;
|
||||
private final SelectionAgent selectionAgent;
|
||||
private final DtoUnmarshallerFactory unmarshallerFactory;
|
||||
|
||||
private String moduleName;
|
||||
|
||||
private String artifactId;
|
||||
private CurrentProject parentProject;
|
||||
|
||||
@Inject
|
||||
public CreateMavenModulePresenter(AppContext appContext,
|
||||
CreateMavenModuleView view,
|
||||
ProjectServiceClient projectServiceClient,
|
||||
DtoFactory dtoFactory,
|
||||
DialogFactory dialogFactory,
|
||||
ProjectExplorerPresenter projectExplorer,
|
||||
MavenLocalizationConstant locale,
|
||||
SelectionAgent selectionAgent,
|
||||
DtoUnmarshallerFactory unmarshallerFactory) {
|
||||
this.view = view;
|
||||
this.view.setDelegate(this);
|
||||
|
||||
this.appContext = appContext;
|
||||
this.projectService = projectServiceClient;
|
||||
this.dtoFactory = dtoFactory;
|
||||
this.dialogFactory = dialogFactory;
|
||||
this.projectExplorer = projectExplorer;
|
||||
this.locale = locale;
|
||||
this.selectionAgent = selectionAgent;
|
||||
this.unmarshallerFactory = unmarshallerFactory;
|
||||
}
|
||||
|
||||
public void showDialog(@NotNull CurrentProject project) {
|
||||
parentProject = project;
|
||||
view.setParentArtifactId(project.getAttributeValue(ARTIFACT_ID));
|
||||
view.setGroupId(project.getAttributeValue(GROUP_ID));
|
||||
view.setVersion(project.getAttributeValue(VERSION));
|
||||
view.reset();
|
||||
view.show();
|
||||
updateViewState();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClose() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void create() {
|
||||
ProjectConfigDto projectConfig = dtoFactory.createDto(ProjectConfigDto.class);
|
||||
projectConfig.setType(MAVEN_ID);
|
||||
|
||||
Map<String, List<String>> attributes = new HashMap<>();
|
||||
attributes.put(ARTIFACT_ID, Arrays.asList(artifactId));
|
||||
attributes.put(GROUP_ID, Arrays.asList(view.getGroupId()));
|
||||
attributes.put(VERSION, Arrays.asList(view.getVersion()));
|
||||
attributes.put(PACKAGING, Arrays.asList(view.getPackaging()));
|
||||
attributes.put(PARENT_ARTIFACT_ID, Arrays.asList(parentProject.getAttributeValue(ARTIFACT_ID)));
|
||||
attributes.put(PARENT_GROUP_ID, Arrays.asList(parentProject.getAttributeValue(GROUP_ID)));
|
||||
attributes.put(PARENT_VERSION, Arrays.asList(parentProject.getAttributeValue(VERSION)));
|
||||
|
||||
projectConfig.setAttributes(attributes);
|
||||
projectConfig.setName(view.getName());
|
||||
|
||||
view.showButtonLoader(true);
|
||||
|
||||
String pathToSelectedNode = getPathToSelectedNode();
|
||||
|
||||
if (pathToSelectedNode.isEmpty()) {
|
||||
showErrorDialog(locale.mavenCreateModuleMultySelectionError());
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
projectService.createModule(appContext.getDevMachine(),
|
||||
pathToSelectedNode,
|
||||
projectConfig,
|
||||
new AsyncRequestCallback<ProjectConfigDto>(
|
||||
unmarshallerFactory.newUnmarshaller(ProjectConfigDto.class)) {
|
||||
@Override
|
||||
protected void onSuccess(ProjectConfigDto addedModule) {
|
||||
view.close();
|
||||
view.showButtonLoader(false);
|
||||
|
||||
Selection<?> selection = selectionAgent.getSelection();
|
||||
|
||||
HasStorablePath parentFolder = (HasStorablePath)selection.getHeadElement();
|
||||
|
||||
boolean isModule = parentFolder instanceof ModuleNode;
|
||||
boolean isProject = parentFolder instanceof ProjectNode;
|
||||
|
||||
// TODO: rework after new Project API
|
||||
ProjectConfigDto projectConfigDto = appContext.getCurrentProject().getProjectConfig();
|
||||
|
||||
// ProjectConfigDto parentConfig =
|
||||
// projectConfigDto.findModule(parentFolder.getStorablePath());
|
||||
|
||||
// if (parentConfig == null) {
|
||||
// throw new IllegalArgumentException("Parent folder not found for " + addedModule.getPath());
|
||||
// }
|
||||
|
||||
// parentConfig.getModules().add(addedModule);
|
||||
|
||||
if (isModule) {
|
||||
projectExplorer.reloadChildren((ModuleNode)parentFolder);
|
||||
}
|
||||
|
||||
if (isProject) {
|
||||
projectExplorer.reloadChildren((ProjectNode)parentFolder);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onFailure(Throwable exception) {
|
||||
showErrorDialog(exception.getMessage());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private String getPathToSelectedNode() {
|
||||
Selection<?> selection = projectExplorer.getSelection();
|
||||
|
||||
if (selection.isMultiSelection() || selection.isEmpty()) {
|
||||
return "";
|
||||
}
|
||||
|
||||
Object selectedElement = selection.getHeadElement();
|
||||
|
||||
if (selectedElement instanceof HasStorablePath) {
|
||||
return ((HasStorablePath)selectedElement).getStorablePath();
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
private void showErrorDialog(String error) {
|
||||
view.showButtonLoader(false);
|
||||
dialogFactory.createMessageDialog("", error, null).show();
|
||||
Log.error(CreateMavenModulePresenter.class, error);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void projectNameChanged(String name) {
|
||||
if (NameUtils.checkProjectName(name)) {
|
||||
moduleName = name;
|
||||
} else {
|
||||
moduleName = null;
|
||||
}
|
||||
updateViewState();
|
||||
}
|
||||
|
||||
private void updateViewState() {
|
||||
if (moduleName == null) {
|
||||
view.setNameError(true);
|
||||
view.setCreateButtonEnabled(false);
|
||||
} else {
|
||||
view.setNameError(false);
|
||||
if (artifactId == null) {
|
||||
view.setArtifactIdError(true);
|
||||
view.setCreateButtonEnabled(false);
|
||||
} else {
|
||||
view.setArtifactIdError(false);
|
||||
view.setCreateButtonEnabled(true);
|
||||
}
|
||||
}
|
||||
view.enableArchetypes(view.isGenerateFromArchetypeSelected());
|
||||
view.setPackagingVisibility(!view.isGenerateFromArchetypeSelected());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void artifactIdChanged(String artifactId) {
|
||||
if (NameUtils.checkProjectName(artifactId)) {
|
||||
this.artifactId = artifactId;
|
||||
} else {
|
||||
this.artifactId = null;
|
||||
}
|
||||
updateViewState();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generateFromArchetypeChanged(boolean isGenerateFromArchetype) {
|
||||
updateViewState();
|
||||
if (!isGenerateFromArchetype) {
|
||||
view.clearArchetypes();
|
||||
} else {
|
||||
view.setArchetypes(MavenExtension.getAvailableArchetypes());
|
||||
}
|
||||
}
|
||||
|
||||
private GeneratorDescription getGeneratorDescription(MavenArchetype archetype) {
|
||||
HashMap<String, String> options = new HashMap<>();
|
||||
options.put("type", ARCHETYPE_GENERATION_STRATEGY);
|
||||
options.put("archetypeGroupId", archetype.getGroupId());
|
||||
options.put("archetypeArtifactId", archetype.getArtifactId());
|
||||
options.put("archetypeVersion", archetype.getVersion());
|
||||
if (archetype.getRepository() != null) {
|
||||
options.put("archetypeRepository", archetype.getRepository());
|
||||
}
|
||||
return dtoFactory.createDto(GeneratorDescription.class).withOptions(options);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,81 +0,0 @@
|
|||
/*******************************************************************************
|
||||
* 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.maven.client.module;
|
||||
|
||||
import org.eclipse.che.ide.api.mvp.View;
|
||||
import org.eclipse.che.plugin.maven.client.MavenArchetype;
|
||||
|
||||
import com.google.inject.ImplementedBy;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Evgen Vidolob
|
||||
* @author Dmitry Shnurenko
|
||||
*/
|
||||
@ImplementedBy(CreateMavenModuleViewImpl.class)
|
||||
public interface CreateMavenModuleView extends View<CreateMavenModuleView.ActionDelegate> {
|
||||
|
||||
MavenArchetype getArchetype();
|
||||
|
||||
void setArchetypes(List<MavenArchetype> archetypes);
|
||||
|
||||
void enableArchetypes(boolean enabled);
|
||||
|
||||
boolean isGenerateFromArchetypeSelected();
|
||||
|
||||
void setParentArtifactId(String artifactId);
|
||||
|
||||
void setGroupId(String groupId);
|
||||
|
||||
void setVersion(String version);
|
||||
|
||||
void setCreateButtonEnabled(boolean enabled);
|
||||
|
||||
void setNameError(boolean hasError);
|
||||
|
||||
void setArtifactIdError(boolean hasError);
|
||||
|
||||
void reset();
|
||||
|
||||
String getPackaging();
|
||||
|
||||
String getGroupId();
|
||||
|
||||
String getVersion();
|
||||
|
||||
String getArtifactId();
|
||||
|
||||
String getName();
|
||||
|
||||
void setPackagingVisibility(boolean visible);
|
||||
|
||||
void close();
|
||||
|
||||
void showButtonLoader(boolean showLoader);
|
||||
|
||||
void clearArchetypes();
|
||||
|
||||
public interface ActionDelegate{
|
||||
|
||||
void onClose();
|
||||
|
||||
void create();
|
||||
|
||||
void projectNameChanged(String name);
|
||||
|
||||
void artifactIdChanged(String artifactId);
|
||||
|
||||
void generateFromArchetypeChanged(boolean isGenerateFromArchetype);
|
||||
}
|
||||
|
||||
void show();
|
||||
}
|
||||
|
|
@ -1,258 +0,0 @@
|
|||
/*******************************************************************************
|
||||
* 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.maven.client.module;
|
||||
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.event.dom.client.ClickEvent;
|
||||
import com.google.gwt.event.dom.client.ClickHandler;
|
||||
import com.google.gwt.event.dom.client.KeyCodes;
|
||||
import com.google.gwt.event.dom.client.KeyUpEvent;
|
||||
import com.google.gwt.event.logical.shared.ValueChangeEvent;
|
||||
import com.google.gwt.uibinder.client.UiBinder;
|
||||
import com.google.gwt.uibinder.client.UiField;
|
||||
import com.google.gwt.uibinder.client.UiHandler;
|
||||
import com.google.gwt.user.client.ui.Button;
|
||||
import com.google.gwt.user.client.ui.CheckBox;
|
||||
import com.google.gwt.user.client.ui.FlowPanel;
|
||||
import com.google.gwt.user.client.ui.Label;
|
||||
import com.google.gwt.user.client.ui.ListBox;
|
||||
import com.google.gwt.user.client.ui.TextBox;
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.Singleton;
|
||||
|
||||
import org.eclipse.che.plugin.maven.client.MavenArchetype;
|
||||
import org.eclipse.che.ide.ui.buttonLoader.ButtonLoaderResources;
|
||||
import org.eclipse.che.ide.ui.window.Window;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Evgen Vidolob
|
||||
* @author Dmitry Shnurenko
|
||||
*/
|
||||
@Singleton
|
||||
public class CreateMavenModuleViewImpl extends Window implements CreateMavenModuleView {
|
||||
public static final String CREATE = "Create";
|
||||
private static CreateMavenModuleViewImplUiBinder ourUiBinder = GWT.create(CreateMavenModuleViewImplUiBinder.class);
|
||||
private final Button createButton;
|
||||
@UiField
|
||||
CheckBox generateFromArchetype;
|
||||
@UiField
|
||||
Label archetypeLabel;
|
||||
@UiField
|
||||
ListBox archetypeField;
|
||||
@UiField
|
||||
TextBox parentArtifactId;
|
||||
@UiField
|
||||
TextBox nameField;
|
||||
@UiField
|
||||
TextBox artifactId;
|
||||
@UiField
|
||||
TextBox groupIdField;
|
||||
@UiField
|
||||
TextBox versionField;
|
||||
@UiField
|
||||
Label packagingLabel;
|
||||
@UiField
|
||||
ListBox packagingField;
|
||||
@UiField(provided = true)
|
||||
CreateMavenModuleResources.Css styles;
|
||||
private List<MavenArchetype> archetypes;
|
||||
private ActionDelegate delegate;
|
||||
|
||||
@Inject
|
||||
public CreateMavenModuleViewImpl(CreateMavenModuleResources resources,
|
||||
ButtonLoaderResources buttonLoaderResources) {
|
||||
super(true);
|
||||
styles = resources.css();
|
||||
styles.ensureInjected();
|
||||
archetypes = new ArrayList<>();
|
||||
setTitle("Create Maven Module");
|
||||
FlowPanel rootElement = ourUiBinder.createAndBindUi(this);
|
||||
setWidget(rootElement);
|
||||
createButton = createPrimaryButton(CREATE, "mavenPageView-createButton", new ClickHandler() {
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
delegate.create();
|
||||
}
|
||||
});
|
||||
addButtonToFooter(createButton);
|
||||
createButton.addStyleName(buttonLoaderResources.Css().buttonLoader());
|
||||
}
|
||||
|
||||
@UiHandler("nameField")
|
||||
void onNameChanged(KeyUpEvent event) {
|
||||
if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
|
||||
return;
|
||||
}
|
||||
|
||||
delegate.projectNameChanged(nameField.getText());
|
||||
}
|
||||
|
||||
@UiHandler("artifactId")
|
||||
void onArtifactChanged(KeyUpEvent event) {
|
||||
if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
|
||||
return;
|
||||
}
|
||||
|
||||
delegate.artifactIdChanged(artifactId.getText());
|
||||
}
|
||||
|
||||
@UiHandler({"generateFromArchetype"})
|
||||
void generateFromArchetypeHandler(ValueChangeEvent<Boolean> event) {
|
||||
delegate.generateFromArchetypeChanged(generateFromArchetype.getValue());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onClose() {
|
||||
delegate.onClose();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDelegate(ActionDelegate delegate) {
|
||||
this.delegate = delegate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MavenArchetype getArchetype() {
|
||||
final String coordinates = archetypeField.getValue(archetypeField.getSelectedIndex());
|
||||
for (MavenArchetype archetype : archetypes) {
|
||||
if (coordinates.equals(archetype.toString())) {
|
||||
return archetype;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setArchetypes(List<MavenArchetype> archetypes) {
|
||||
this.archetypes.clear();
|
||||
this.archetypes.addAll(archetypes);
|
||||
archetypeField.clear();
|
||||
for (MavenArchetype archetype : archetypes) {
|
||||
archetypeField.addItem(archetype.toString(), archetype.toString());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enableArchetypes(boolean enabled) {
|
||||
archetypeField.setEnabled(enabled);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isGenerateFromArchetypeSelected() {
|
||||
return generateFromArchetype.getValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setParentArtifactId(String artifactId) {
|
||||
parentArtifactId.setValue(artifactId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCreateButtonEnabled(boolean enabled) {
|
||||
createButton.setEnabled(enabled);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setNameError(boolean hasError) {
|
||||
if (hasError) {
|
||||
nameField.addStyleName(styles.inputError());
|
||||
} else {
|
||||
nameField.removeStyleName(styles.inputError());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setArtifactIdError(boolean hasError) {
|
||||
if (hasError) {
|
||||
artifactId.addStyleName(styles.inputError());
|
||||
} else {
|
||||
artifactId.removeStyleName(styles.inputError());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
nameField.setValue("");
|
||||
artifactId.setValue("");
|
||||
generateFromArchetype.setValue(false);
|
||||
archetypes.clear();
|
||||
archetypeField.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPackaging() {
|
||||
return packagingField.getValue(packagingField.getSelectedIndex());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGroupId() {
|
||||
return groupIdField.getText();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGroupId(String groupId) {
|
||||
groupIdField.setValue(groupId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getVersion() {
|
||||
return versionField.getText();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getArtifactId() {
|
||||
return artifactId.getText();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return nameField.getText();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setVersion(String version) {
|
||||
versionField.setValue(version);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPackagingVisibility(boolean visible) {
|
||||
packagingLabel.setVisible(visible);
|
||||
packagingField.setVisible(visible);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
hide();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showButtonLoader(boolean showLoader) {
|
||||
if (showLoader) {
|
||||
createButton.setEnabled(false);
|
||||
createButton.setHTML("<i></i>");
|
||||
} else {
|
||||
createButton.setEnabled(true);
|
||||
createButton.setText(CREATE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearArchetypes() {
|
||||
archetypes.clear();
|
||||
archetypeField.clear();
|
||||
}
|
||||
|
||||
interface CreateMavenModuleViewImplUiBinder extends UiBinder<FlowPanel, CreateMavenModuleViewImpl> {
|
||||
}
|
||||
}
|
||||
|
|
@ -1,166 +0,0 @@
|
|||
<!--
|
||||
|
||||
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
|
||||
|
||||
-->
|
||||
<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'
|
||||
xmlns:g='urn:import:com.google.gwt.user.client.ui'>
|
||||
<ui:with field="styles" type="org.eclipse.che.plugin.maven.client.module.CreateMavenModuleResources.Css"/>
|
||||
<ui:style>
|
||||
.rootPanel {
|
||||
position: relative;
|
||||
text-shadow: 0 .4px 0 rgba(0, 0, 0, 0.5);
|
||||
}
|
||||
|
||||
.projectNamePosition {
|
||||
position: relative;
|
||||
line-height: 29px;
|
||||
margin-left: 20px;
|
||||
|
||||
}
|
||||
|
||||
.spaceRight {
|
||||
margin-right: 8px;
|
||||
margin-top: 1px;
|
||||
}
|
||||
|
||||
.mainDoc {
|
||||
margin: 15px;
|
||||
}
|
||||
|
||||
.checkBoxPosition {
|
||||
position: relative;
|
||||
top: 5px;
|
||||
}
|
||||
</ui:style>
|
||||
<g:FlowPanel width="620px" height="360px" addStyleNames="{style.rootPanel}">
|
||||
<g:DockLayoutPanel unit="PX" debugId="mavenPageView-mainPanel" addStyleNames="{style.mainDoc}">
|
||||
<g:north size="50">
|
||||
<g:DockLayoutPanel unit="PX" width="100%" height="100%">
|
||||
<g:west size="138">
|
||||
<g:FlowPanel>
|
||||
<g:CheckBox ui:field="generateFromArchetype" debugId="mavenPageView-generateFromArchetype"
|
||||
addStyleNames="{style.checkBoxPosition}"/>
|
||||
<g:Label ui:field="archetypeLabel" text="From Archetype:" addStyleNames="{style.projectNamePosition}"/>
|
||||
</g:FlowPanel>
|
||||
</g:west>
|
||||
<g:center>
|
||||
<g:SimplePanel addStyleNames="{style.spaceRight}">
|
||||
<g:ListBox ui:field="archetypeField" multipleSelect="false" visibleItemCount="1" selectedIndex="0"
|
||||
debugId="mavenPageView-archetypeField" width="432px" height="29px" addStyleNames="{styles.inputField}"/>
|
||||
</g:SimplePanel>
|
||||
</g:center>
|
||||
</g:DockLayoutPanel>
|
||||
</g:north>
|
||||
<g:north size="50">
|
||||
<g:DockLayoutPanel unit="PX" width="100%" height="100%">
|
||||
<g:west size="138">
|
||||
<g:FlowPanel>
|
||||
<g:Label text="Parent name:" addStyleNames="{style.projectNamePosition}"/>
|
||||
</g:FlowPanel>
|
||||
</g:west>
|
||||
<g:center>
|
||||
<g:SimplePanel addStyleNames="{style.spaceRight}">
|
||||
<g:SimplePanel>
|
||||
<g:TextBox width="420px" ui:field="parentArtifactId"
|
||||
addStyleNames="{styles.inputField}" enabled="false"/>
|
||||
</g:SimplePanel>
|
||||
</g:SimplePanel>
|
||||
</g:center>
|
||||
</g:DockLayoutPanel>
|
||||
</g:north>
|
||||
<g:north size="50">
|
||||
<g:DockLayoutPanel unit="PX" width="100%" height="100%">
|
||||
<g:west size="138">
|
||||
<g:FlowPanel>
|
||||
<g:Label text="Module name:" addStyleNames="{style.projectNamePosition}"/>
|
||||
</g:FlowPanel>
|
||||
</g:west>
|
||||
<g:center>
|
||||
<g:SimplePanel addStyleNames="{style.spaceRight}">
|
||||
<g:SimplePanel>
|
||||
<g:TextBox width="420px" ui:field="nameField"
|
||||
addStyleNames="{styles.inputField}"/>
|
||||
</g:SimplePanel>
|
||||
</g:SimplePanel>
|
||||
</g:center>
|
||||
</g:DockLayoutPanel>
|
||||
</g:north>
|
||||
<g:north size="50">
|
||||
<g:DockLayoutPanel unit="PX" width="100%" height="100%">
|
||||
<g:west size="138">
|
||||
<g:FlowPanel>
|
||||
<g:Label text="Artifact Id:" addStyleNames="{style.projectNamePosition}"/>
|
||||
</g:FlowPanel>
|
||||
</g:west>
|
||||
<g:center>
|
||||
<g:SimplePanel addStyleNames="{style.spaceRight}">
|
||||
<g:SimplePanel>
|
||||
<g:TextBox width="420px" ui:field="artifactId"
|
||||
addStyleNames="{styles.inputField}"/>
|
||||
</g:SimplePanel>
|
||||
</g:SimplePanel>
|
||||
</g:center>
|
||||
</g:DockLayoutPanel>
|
||||
</g:north>
|
||||
<g:north size="50">
|
||||
<g:DockLayoutPanel unit="PX" width="100%" height="100%">
|
||||
<g:west size="138">
|
||||
<g:FlowPanel>
|
||||
<g:Label text="Group Id:" addStyleNames="{style.projectNamePosition}"/>
|
||||
</g:FlowPanel>
|
||||
</g:west>
|
||||
<g:center>
|
||||
<g:SimplePanel addStyleNames="{style.spaceRight}">
|
||||
<g:SimplePanel>
|
||||
<g:TextBox width="420px" ui:field="groupIdField" addStyleNames="{styles.inputField}" enabled="false"/>
|
||||
</g:SimplePanel>
|
||||
</g:SimplePanel>
|
||||
</g:center>
|
||||
</g:DockLayoutPanel>
|
||||
</g:north>
|
||||
<g:north size="50">
|
||||
<g:DockLayoutPanel unit="PX" width="100%" height="100%">
|
||||
<g:west size="138">
|
||||
<g:FlowPanel>
|
||||
<g:Label text="Version:" addStyleNames="{style.projectNamePosition}"/>
|
||||
</g:FlowPanel>
|
||||
</g:west>
|
||||
<g:center>
|
||||
<g:SimplePanel addStyleNames="{style.spaceRight}">
|
||||
<g:TextBox width="420px" ui:field="versionField" addStyleNames="{styles.inputField}" enabled="false" />
|
||||
</g:SimplePanel>
|
||||
</g:center>
|
||||
</g:DockLayoutPanel>
|
||||
</g:north>
|
||||
<g:north size="50">
|
||||
<g:DockLayoutPanel unit="PX" width="100%" height="100%">
|
||||
<g:west size="138">
|
||||
<g:FlowPanel>
|
||||
<g:Label ui:field="packagingLabel" text="Packaging:" addStyleNames="{style.projectNamePosition}"/>
|
||||
</g:FlowPanel>
|
||||
</g:west>
|
||||
<g:center>
|
||||
<g:SimplePanel addStyleNames="{style.spaceRight}">
|
||||
<g:SimplePanel>
|
||||
<g:ListBox ui:field="packagingField" multipleSelect="false" visibleItemCount="1" selectedIndex="0"
|
||||
width="432px" height="29px" addStyleNames="{styles.inputField}">
|
||||
<g:item value="jar">JAR</g:item>
|
||||
<g:item value="war">WAR</g:item>
|
||||
<g:item value="pom">POM</g:item>
|
||||
</g:ListBox>
|
||||
</g:SimplePanel>
|
||||
</g:SimplePanel>
|
||||
</g:center>
|
||||
</g:DockLayoutPanel>
|
||||
</g:north>
|
||||
</g:DockLayoutPanel>
|
||||
</g:FlowPanel>
|
||||
</ui:UiBinder>
|
||||
|
|
@ -49,7 +49,7 @@ public class MavenServerServiceClientImpl implements MavenServerServiceClient {
|
|||
this.loaderFactory = loaderFactory;
|
||||
this.asyncRequestFactory = asyncRequestFactory;
|
||||
this.dtoUnmarshallerFactory = dtoUnmarshallerFactory;
|
||||
this.servicePath = "/maven/" + appContext.getWorkspace().getId() + "/server/";
|
||||
this.servicePath = "/maven/server/";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -86,6 +86,10 @@
|
|||
<groupId>org.eclipse.che.core</groupId>
|
||||
<artifactId>che-core-commons-xml</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.che.core</groupId>
|
||||
<artifactId>wsagent-local</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.che.plugin</groupId>
|
||||
<artifactId>che-plugin-java-ext-lang-server</artifactId>
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ package org.eclipse.che.plugin.maven.server.core;
|
|||
import com.google.common.util.concurrent.ThreadFactoryBuilder;
|
||||
import com.google.inject.Inject;
|
||||
|
||||
import org.eclipse.che.WorkspaceIdProvider;
|
||||
import org.eclipse.che.api.core.util.CancellableProcessWrapper;
|
||||
import org.eclipse.che.api.core.util.ProcessUtil;
|
||||
import org.eclipse.che.api.core.util.StreamPump;
|
||||
|
|
@ -55,13 +56,11 @@ public class MavenClassPathBuilder implements ClassPathBuilder {
|
|||
private final ExecutorService executorService;
|
||||
private final ProjectManager projectManager;
|
||||
|
||||
private String workspaceId;
|
||||
|
||||
@Inject
|
||||
public MavenClassPathBuilder(ProjectManager projectManager, MavenClasspathContainerInitializer containerInitializer) {
|
||||
public MavenClassPathBuilder(ProjectManager projectManager,
|
||||
MavenClasspathContainerInitializer containerInitializer) {
|
||||
this.projectManager = projectManager;
|
||||
|
||||
|
||||
ThreadFactory threadFactory = new ThreadFactoryBuilder().setNameFormat(MavenClassPathBuilder.class.getSimpleName() + "-%d").build();
|
||||
|
||||
executorService = Executors.newFixedThreadPool(5, threadFactory);
|
||||
|
|
@ -69,9 +68,7 @@ public class MavenClassPathBuilder implements ClassPathBuilder {
|
|||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public ClassPathBuilderResult buildClassPath(String workspaceId, String projectPath) throws ExecutionException, InterruptedException {
|
||||
this.workspaceId = workspaceId;
|
||||
|
||||
public ClassPathBuilderResult buildClassPath(String projectPath) throws ExecutionException, InterruptedException {
|
||||
//TODO Temporary solution for IDEX-4270
|
||||
try {
|
||||
RegisteredProject project = projectManager.getProject(projectPath);
|
||||
|
|
@ -140,7 +137,7 @@ public class MavenClassPathBuilder implements ClassPathBuilder {
|
|||
+ "due to timeout. Project: "
|
||||
+ projectPath)));
|
||||
|
||||
String channel = "dependencyUpdate:output:" + workspaceId + ':' + projectPath;
|
||||
String channel = "dependencyUpdate:output:" + WorkspaceIdProvider.getWorkspaceId() + ':' + projectPath;
|
||||
|
||||
classPathBuilderResult.setChannel(channel);
|
||||
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ import static javax.ws.rs.core.MediaType.TEXT_XML;
|
|||
*
|
||||
* @author Valeriy Svydenko
|
||||
*/
|
||||
@Path("/maven/{wsId}/server")
|
||||
@Path("/maven/server")
|
||||
public class MavenServerService {
|
||||
private static final Logger LOG = LoggerFactory.getLogger(MavenServerService.class);
|
||||
|
||||
|
|
@ -65,9 +65,6 @@ public class MavenServerService {
|
|||
private final MavenProjectManager mavenProjectManager;
|
||||
private final ProjectManager cheProjectManager;
|
||||
|
||||
@PathParam("wsId")
|
||||
private String workspaceId;
|
||||
|
||||
@Inject
|
||||
private MavenProgressNotifier notifier;
|
||||
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ public class SubversionClientServiceImpl implements SubversionClientService {
|
|||
}
|
||||
|
||||
private String getBaseUrl() {
|
||||
return appContext.getDevMachine().getWsAgentBaseUrl() + "/svn/" + appContext.getWorkspaceId();
|
||||
return appContext.getDevMachine().getWsAgentBaseUrl() + "/svn";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ import java.io.IOException;
|
|||
/**
|
||||
* REST API endpoints for this extension.
|
||||
*/
|
||||
@Path("svn/{ws-id}")
|
||||
@Path("svn")
|
||||
public class SubversionService extends Service {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(SubversionService.class);
|
||||
|
|
@ -85,8 +85,6 @@ public class SubversionService extends Service {
|
|||
@Inject
|
||||
private CredentialsProvider credentialsProvider;
|
||||
|
||||
@PathParam("ws-id")
|
||||
private String vfsId;
|
||||
|
||||
/**
|
||||
* Add the selected paths to version control.
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ import static org.eclipse.che.dto.server.DtoFactory.newDto;
|
|||
*
|
||||
* @author Anatoliy Bazko
|
||||
*/
|
||||
@Path("debugger/{ws-id}")
|
||||
@Path("debugger")
|
||||
public class DebuggerService {
|
||||
private final DebuggerManager debuggerManager;
|
||||
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
|
||||
/** @author andrew00x */
|
||||
@Path("git/{ws-id}")
|
||||
@Path("git")
|
||||
public class GitService {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(GitService.class);
|
||||
|
|
@ -86,9 +86,6 @@ public class GitService {
|
|||
@Inject
|
||||
private ProjectRegistry projectRegistry;
|
||||
|
||||
@PathParam("ws-id")
|
||||
private String workspace;
|
||||
|
||||
@QueryParam("projectPath")
|
||||
private String projectPath;
|
||||
|
||||
|
|
|
|||
|
|
@ -119,6 +119,10 @@
|
|||
<groupId>org.eclipse.che.core</groupId>
|
||||
<artifactId>che-core-commons-lang</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.che.core</groupId>
|
||||
<artifactId>wsagent-local</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.everrest</groupId>
|
||||
<artifactId>everrest-core</artifactId>
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ import io.swagger.annotations.ApiResponses;
|
|||
|
||||
import org.apache.commons.fileupload.FileItem;
|
||||
import org.apache.tika.Tika;
|
||||
import org.eclipse.che.WorkspaceIdProvider;
|
||||
import org.eclipse.che.api.core.BadRequestException;
|
||||
import org.eclipse.che.api.core.ConflictException;
|
||||
import org.eclipse.che.api.core.ForbiddenException;
|
||||
|
|
@ -105,19 +106,21 @@ import static org.eclipse.che.dto.server.DtoFactory.newDto;
|
|||
* @author Dmitry Shnurenko
|
||||
*/
|
||||
@Api(value = "/project", description = "Project REST API")
|
||||
@Path("/project/{ws-id}")
|
||||
@Path("/project")
|
||||
@Singleton
|
||||
public class ProjectService extends Service {
|
||||
private static final Logger LOG = LoggerFactory.getLogger(ProjectService.class);
|
||||
private static final Tika TIKA = new Tika();
|
||||
|
||||
private ProjectManager projectManager;
|
||||
private EventService eventService;
|
||||
private final ProjectManager projectManager;
|
||||
private final EventService eventService;
|
||||
private final String workspace;
|
||||
|
||||
@Inject
|
||||
public ProjectService(ProjectManager projectManager, EventService eventService) {
|
||||
this.projectManager = projectManager;
|
||||
this.eventService = eventService;
|
||||
this.workspace = WorkspaceIdProvider.getWorkspaceId();
|
||||
}
|
||||
|
||||
@GET
|
||||
|
|
@ -128,14 +131,13 @@ public class ProjectService extends Service {
|
|||
@ApiResponses({@ApiResponse(code = 200, message = "OK"),
|
||||
@ApiResponse(code = 500, message = "Server error")})
|
||||
@GenerateLink(rel = LINK_REL_GET_PROJECTS)
|
||||
public List<ProjectConfigDto> getProjects(@ApiParam("ID of workspace to get projects")
|
||||
@PathParam("ws-id") String workspace) throws IOException,
|
||||
ServerException,
|
||||
ConflictException,
|
||||
ForbiddenException {
|
||||
public List<ProjectConfigDto> getProjects() throws IOException,
|
||||
ServerException,
|
||||
ConflictException,
|
||||
ForbiddenException {
|
||||
return projectManager.getProjects()
|
||||
.stream()
|
||||
.map(p -> injectProjectLinks(asDto(p), workspace))
|
||||
.map(p -> injectProjectLinks(asDto(p)))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
|
|
@ -148,14 +150,12 @@ public class ProjectService extends Service {
|
|||
@ApiResponse(code = 404, message = "Project with specified path doesn't exist in workspace"),
|
||||
@ApiResponse(code = 403, message = "Access to requested project is forbidden"),
|
||||
@ApiResponse(code = 500, message = "Server error")})
|
||||
public ProjectConfigDto getProject(@ApiParam(value = "ID of workspace to get projects", required = true)
|
||||
@PathParam("ws-id") String workspace,
|
||||
@ApiParam(value = "Path to requested project", required = true)
|
||||
public ProjectConfigDto getProject(@ApiParam(value = "Path to requested project", required = true)
|
||||
@PathParam("path") String path) throws NotFoundException,
|
||||
ForbiddenException,
|
||||
ServerException,
|
||||
ConflictException {
|
||||
return injectProjectLinks(asDto(projectManager.getProject(path)), workspace);
|
||||
return injectProjectLinks(asDto(projectManager.getProject(path)));
|
||||
}
|
||||
|
||||
@POST
|
||||
|
|
@ -171,9 +171,7 @@ public class ProjectService extends Service {
|
|||
/**
|
||||
* NOTE: parentPath is added to make a module
|
||||
*/
|
||||
public ProjectConfigDto createProject(@ApiParam(value = "ID of workspace to create project", required = true)
|
||||
@PathParam("ws-id") String workspace,
|
||||
@ApiParam(value = "Add to this project as module", required = false)
|
||||
public ProjectConfigDto createProject(@ApiParam(value = "Add to this project as module", required = false)
|
||||
@Description("descriptor of project") ProjectConfigDto projectConfig) throws ConflictException,
|
||||
ForbiddenException,
|
||||
ServerException,
|
||||
|
|
@ -196,7 +194,7 @@ public class ProjectService extends Service {
|
|||
// TODO this throws NPE
|
||||
//logProjectCreatedEvent(configDto.getName(), configDto.getProjectType());
|
||||
|
||||
return injectProjectLinks(configDto, workspace);
|
||||
return injectProjectLinks(configDto);
|
||||
}
|
||||
|
||||
@PUT
|
||||
|
|
@ -210,9 +208,7 @@ public class ProjectService extends Service {
|
|||
@ApiResponse(code = 403, message = "Operation is forbidden"),
|
||||
@ApiResponse(code = 409, message = "Update operation causes conflicts"),
|
||||
@ApiResponse(code = 500, message = "Server error")})
|
||||
public ProjectConfigDto updateProject(@ApiParam(value = "ID of workspace", required = true)
|
||||
@PathParam("ws-id") String workspace,
|
||||
@ApiParam(value = "Path to updated project", required = true)
|
||||
public ProjectConfigDto updateProject(@ApiParam(value = "Path to updated project", required = true)
|
||||
@PathParam("path") String path,
|
||||
ProjectConfigDto projectConfigDto) throws NotFoundException,
|
||||
ConflictException,
|
||||
|
|
@ -235,9 +231,7 @@ public class ProjectService extends Service {
|
|||
@ApiResponse(code = 403, message = "User not authorized to call this operation"),
|
||||
@ApiResponse(code = 404, message = "Not found"),
|
||||
@ApiResponse(code = 500, message = "Internal Server Error")})
|
||||
public void delete(@ApiParam("Workspace ID")
|
||||
@PathParam("ws-id") String workspace,
|
||||
@ApiParam("Path to a resource to be deleted")
|
||||
public void delete(@ApiParam("Path to a resource to be deleted")
|
||||
@PathParam("path") String path) throws NotFoundException, ForbiddenException, ConflictException, ServerException {
|
||||
projectManager.delete(path);
|
||||
}
|
||||
|
|
@ -251,9 +245,7 @@ public class ProjectService extends Service {
|
|||
@ApiResponse(code = 404, message = "Project with specified path doesn't exist in workspace"),
|
||||
@ApiResponse(code = 403, message = "Access to requested project is forbidden"),
|
||||
@ApiResponse(code = 500, message = "Server error")})
|
||||
public SourceEstimation estimateProject(@ApiParam(value = "ID of workspace to estimate projects", required = true)
|
||||
@PathParam("ws-id") String workspace,
|
||||
@ApiParam(value = "Path to requested project", required = true)
|
||||
public SourceEstimation estimateProject(@ApiParam(value = "Path to requested project", required = true)
|
||||
@PathParam("path") String path,
|
||||
@ApiParam(value = "Project Type ID to estimate against", required = true)
|
||||
@QueryParam("type") String projectType) throws NotFoundException,
|
||||
|
|
@ -276,9 +268,7 @@ public class ProjectService extends Service {
|
|||
@GET
|
||||
@Path("/resolve/{path:.*}")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public List<SourceEstimation> resolveSources(@ApiParam(value = "ID of workspace to estimate projects", required = true)
|
||||
@PathParam("ws-id") String workspace,
|
||||
@ApiParam(value = "Path to requested project", required = true)
|
||||
public List<SourceEstimation> resolveSources(@ApiParam(value = "Path to requested project", required = true)
|
||||
@PathParam("path") String path) throws NotFoundException,
|
||||
ForbiddenException,
|
||||
ServerException,
|
||||
|
|
@ -312,9 +302,7 @@ public class ProjectService extends Service {
|
|||
@ApiResponse(code = 403, message = "Forbidden operation"),
|
||||
@ApiResponse(code = 409, message = "Resource already exists"),
|
||||
@ApiResponse(code = 500, message = "Unsupported source type")})
|
||||
public void importProject(@ApiParam(value = "Workspace ID", required = true)
|
||||
@PathParam("ws-id") String workspace,
|
||||
@ApiParam(value = "Path in the project", required = true)
|
||||
public void importProject(@ApiParam(value = "Path in the project", required = true)
|
||||
@PathParam("path") String path,
|
||||
@ApiParam(value = "Force rewrite existing project", allowableValues = "true,false")
|
||||
@QueryParam("force") boolean force,
|
||||
|
|
@ -339,9 +327,7 @@ public class ProjectService extends Service {
|
|||
@ApiResponse(code = 404, message = "Not found"),
|
||||
@ApiResponse(code = 409, message = "File already exists"),
|
||||
@ApiResponse(code = 500, message = "Internal Server Error")})
|
||||
public Response createFile(@ApiParam(value = "Workspace ID", required = true)
|
||||
@PathParam("ws-id") String workspace,
|
||||
@ApiParam(value = "Path to a target directory", required = true)
|
||||
public Response createFile(@ApiParam(value = "Path to a target directory", required = true)
|
||||
@PathParam("parent") String parentPath,
|
||||
@ApiParam(value = "New file name", required = true)
|
||||
@QueryParam("name") String fileName,
|
||||
|
|
@ -362,9 +348,9 @@ public class ProjectService extends Service {
|
|||
|
||||
final URI location = getServiceContext().getServiceUriBuilder().clone()
|
||||
.path(getClass(), "getFile")
|
||||
.build(workspace, newFile.getPath().toString().substring(1));
|
||||
.build(newFile.getPath().toString().substring(1));
|
||||
return Response.created(location)
|
||||
.entity(injectFileLinks(asDto(newFile), workspace))
|
||||
.entity(injectFileLinks(asDto(newFile)))
|
||||
.build();
|
||||
}
|
||||
|
||||
|
|
@ -378,9 +364,7 @@ public class ProjectService extends Service {
|
|||
@ApiResponse(code = 404, message = "Not found"),
|
||||
@ApiResponse(code = 409, message = "File already exists"),
|
||||
@ApiResponse(code = 500, message = "Internal Server Error")})
|
||||
public Response createFolder(@ApiParam(value = "Workspace ID", required = true)
|
||||
@PathParam("ws-id") String workspace,
|
||||
@ApiParam(value = "Path to a new folder destination", required = true)
|
||||
public Response createFolder(@ApiParam(value = "Path to a new folder destination", required = true)
|
||||
@PathParam("path") String path) throws ConflictException,
|
||||
ForbiddenException,
|
||||
ServerException,
|
||||
|
|
@ -388,7 +372,7 @@ public class ProjectService extends Service {
|
|||
final FolderEntry newFolder = projectManager.getProjectsRoot().createFolder(path);
|
||||
final URI location = getServiceContext().getServiceUriBuilder().clone()
|
||||
.path(getClass(), "getChildren")
|
||||
.build(workspace, newFolder.getPath().toString().substring(1));
|
||||
.build(newFolder.getPath().toString().substring(1));
|
||||
|
||||
eventService.publish(new ProjectItemModifiedEvent(ProjectItemModifiedEvent.EventType.CREATED,
|
||||
workspace,
|
||||
|
|
@ -397,7 +381,7 @@ public class ProjectService extends Service {
|
|||
true));
|
||||
|
||||
return Response.created(location)
|
||||
.entity(injectFolderLinks(asDto(newFolder), workspace))
|
||||
.entity(injectFolderLinks(asDto(newFolder)))
|
||||
.build();
|
||||
}
|
||||
|
||||
|
|
@ -412,9 +396,7 @@ public class ProjectService extends Service {
|
|||
@ApiResponse(code = 404, message = "Not found"),
|
||||
@ApiResponse(code = 409, message = "File already exists"),
|
||||
@ApiResponse(code = 500, message = "Internal Server Error")})
|
||||
public Response uploadFile(@ApiParam(value = "Workspace ID", required = true)
|
||||
@PathParam("ws-id") String workspace,
|
||||
@ApiParam(value = "Destination path", required = true)
|
||||
public Response uploadFile(@ApiParam(value = "Destination path", required = true)
|
||||
@PathParam("parent") String parentPath,
|
||||
Iterator<FileItem> formData) throws NotFoundException,
|
||||
ConflictException,
|
||||
|
|
@ -442,9 +424,7 @@ public class ProjectService extends Service {
|
|||
@ApiResponse(code = 404, message = "Not found"),
|
||||
@ApiResponse(code = 409, message = "Resource already exists"),
|
||||
@ApiResponse(code = 500, message = "Internal Server Error")})
|
||||
public Response uploadFolderFromZip(@ApiParam(value = "Workspace ID", required = true)
|
||||
@PathParam("ws-id") String workspace,
|
||||
@ApiParam(value = "Path in the project", required = true)
|
||||
public Response uploadFolderFromZip(@ApiParam(value = "Path in the project", required = true)
|
||||
@PathParam("path") String path,
|
||||
Iterator<FileItem> formData) throws ServerException,
|
||||
ConflictException,
|
||||
|
|
@ -467,11 +447,12 @@ public class ProjectService extends Service {
|
|||
@ApiResponse(code = 500, message = "Internal Server Error")})
|
||||
@GET
|
||||
@Path("/file/{path:.*}")
|
||||
public Response getFile(@ApiParam(value = "Workspace ID", required = true)
|
||||
@PathParam("ws-id") String workspace,
|
||||
@ApiParam(value = "Path to a file", required = true)
|
||||
public Response getFile(@ApiParam(value = "Path to a file", required = true)
|
||||
@PathParam("path") String path) throws IOException, NotFoundException, ForbiddenException, ServerException {
|
||||
final FileEntry file = projectManager.asFile(path);
|
||||
if (file == null) {
|
||||
throw new NotFoundException("File not found for " + path);
|
||||
}
|
||||
return Response.ok().entity(file.getInputStream()).type(TIKA.detect(file.getName())).build();
|
||||
}
|
||||
|
||||
|
|
@ -484,9 +465,7 @@ public class ProjectService extends Service {
|
|||
@ApiResponse(code = 403, message = "User not authorized to call this operation"),
|
||||
@ApiResponse(code = 404, message = "Not found"),
|
||||
@ApiResponse(code = 500, message = "Internal Server Error")})
|
||||
public Response updateFile(@ApiParam(value = "Workspace ID", required = true)
|
||||
@PathParam("ws-id") String workspace,
|
||||
@ApiParam(value = "Full path to a file", required = true)
|
||||
public Response updateFile(@ApiParam(value = "Full path to a file", required = true)
|
||||
@PathParam("path") String path,
|
||||
InputStream content) throws NotFoundException, ForbiddenException, ServerException {
|
||||
final FileEntry file = projectManager.asFile(path);
|
||||
|
|
@ -516,8 +495,7 @@ public class ProjectService extends Service {
|
|||
@ApiResponse(code = 404, message = "Not found"),
|
||||
@ApiResponse(code = 409, message = "Resource already exists"),
|
||||
@ApiResponse(code = 500, message = "Internal Server Error")})
|
||||
public Response copy(@ApiParam("Workspace ID") @PathParam("ws-id") String workspace,
|
||||
@ApiParam("Path to a resource") @PathParam("path") String path,
|
||||
public Response copy(@ApiParam("Path to a resource") @PathParam("path") String path,
|
||||
@ApiParam(value = "Path to a new location", required = true) @QueryParam("to") String newParent,
|
||||
CopyOptions copyOptions) throws NotFoundException,
|
||||
ForbiddenException,
|
||||
|
|
@ -542,7 +520,7 @@ public class ProjectService extends Service {
|
|||
|
||||
final URI location = getServiceContext().getServiceUriBuilder()
|
||||
.path(getClass(), copy.isFile() ? "getFile" : "getChildren")
|
||||
.build(workspace, copy.getPath().toString().substring(1));
|
||||
.build(copy.getPath().toString().substring(1));
|
||||
|
||||
if (copy.isFolder()) {
|
||||
try {
|
||||
|
|
@ -567,8 +545,7 @@ public class ProjectService extends Service {
|
|||
@ApiResponse(code = 404, message = "Not found"),
|
||||
@ApiResponse(code = 409, message = "Resource already exists"),
|
||||
@ApiResponse(code = 500, message = "Internal Server Error")})
|
||||
public Response move(@ApiParam("Workspace ID") @PathParam("ws-id") String workspace,
|
||||
@ApiParam("Path to a resource to be moved") @PathParam("path") String path,
|
||||
public Response move(@ApiParam("Path to a resource to be moved") @PathParam("path") String path,
|
||||
@ApiParam("Path to a new location") @QueryParam("to") String newParent,
|
||||
MoveOptions moveOptions) throws NotFoundException, ForbiddenException, ConflictException, ServerException {
|
||||
final VirtualFileEntry entry = projectManager.asVirtualFileEntry(path);
|
||||
|
|
@ -590,7 +567,7 @@ public class ProjectService extends Service {
|
|||
|
||||
final URI location = getServiceContext().getServiceUriBuilder()
|
||||
.path(getClass(), move.isFile() ? "getFile" : "getChildren")
|
||||
.build(workspace, move.getPath().toString().substring(1));
|
||||
.build(move.getPath().toString().substring(1));
|
||||
|
||||
eventService.publish(new ProjectItemModifiedEvent(ProjectItemModifiedEvent.EventType.MOVED,
|
||||
workspace,
|
||||
|
|
@ -614,9 +591,7 @@ public class ProjectService extends Service {
|
|||
@ApiResponse(code = 403, message = "Forbidden operation"),
|
||||
@ApiResponse(code = 409, message = "Resource already exists"),
|
||||
@ApiResponse(code = 500, message = "Unsupported source type")})
|
||||
public List<SourceEstimation> uploadProjectFromZip(@ApiParam(value = "Workspace ID", required = true)
|
||||
@PathParam("ws-id") String workspace,
|
||||
@ApiParam(value = "Path in the project", required = true)
|
||||
public List<SourceEstimation> uploadProjectFromZip(@ApiParam(value = "Path in the project", required = true)
|
||||
@PathParam("path") String path,
|
||||
@ApiParam(value = "Force rewrite existing project", allowableValues = "true,false")
|
||||
@QueryParam("force") boolean force,
|
||||
|
|
@ -665,7 +640,7 @@ public class ProjectService extends Service {
|
|||
baseProjectFolder.getVirtualFile().unzip(zip, true, stripNumber);
|
||||
}
|
||||
|
||||
return resolveSources(workspace, path);
|
||||
return resolveSources(path);
|
||||
}
|
||||
|
||||
@POST
|
||||
|
|
@ -678,9 +653,7 @@ public class ProjectService extends Service {
|
|||
@ApiResponse(code = 404, message = "Not found"),
|
||||
@ApiResponse(code = 409, message = "Resource already exists"),
|
||||
@ApiResponse(code = 500, message = "Internal Server Error")})
|
||||
public Response importZip(@ApiParam(value = "Workspace ID", required = true)
|
||||
@PathParam("ws-id") String workspace,
|
||||
@ApiParam(value = "Path to a location (where import to?)")
|
||||
public Response importZip(@ApiParam(value = "Path to a location (where import to?)")
|
||||
@PathParam("path") String path,
|
||||
InputStream zip,
|
||||
@DefaultValue("false") @QueryParam("skipFirstLevel") Boolean skipFirstLevel) throws NotFoundException,
|
||||
|
|
@ -705,7 +678,7 @@ public class ProjectService extends Service {
|
|||
|
||||
return Response.created(getServiceContext().getServiceUriBuilder()
|
||||
.path(getClass(), "getChildren")
|
||||
.build(workspace, parent.getPath().toString().substring(1))).build();
|
||||
.build(parent.getPath().toString().substring(1))).build();
|
||||
}
|
||||
|
||||
@GET
|
||||
|
|
@ -717,9 +690,7 @@ public class ProjectService extends Service {
|
|||
@ApiResponse(code = 403, message = "User not authorized to call this operation"),
|
||||
@ApiResponse(code = 404, message = "Not found"),
|
||||
@ApiResponse(code = 500, message = "Internal Server Error")})
|
||||
public InputStream exportZip(@ApiParam(value = "Workspace ID", required = true)
|
||||
@PathParam("ws-id") String workspace,
|
||||
@ApiParam(value = "Path to resource to be exported")
|
||||
public InputStream exportZip(@ApiParam(value = "Path to resource to be exported")
|
||||
@PathParam("path") String path) throws NotFoundException, ForbiddenException, ServerException {
|
||||
|
||||
final FolderEntry folder = projectManager.asFolder(path);
|
||||
|
|
@ -734,9 +705,7 @@ public class ProjectService extends Service {
|
|||
@GET
|
||||
@Path("/export/file/{path:.*}")
|
||||
@Produces(MediaType.APPLICATION_OCTET_STREAM)
|
||||
public Response exportFile(@ApiParam(value = "Workspace ID", required = true)
|
||||
@PathParam("ws-id") String workspace,
|
||||
@ApiParam(value = "Path to resource to be imported")
|
||||
public Response exportFile(@ApiParam(value = "Path to resource to be imported")
|
||||
@PathParam("path") String path) throws NotFoundException, ForbiddenException, ServerException {
|
||||
|
||||
final FileEntry file = projectManager.asFile(path);
|
||||
|
|
@ -765,9 +734,7 @@ public class ProjectService extends Service {
|
|||
@ApiResponse(code = 403, message = "User not authorized to call this operation"),
|
||||
@ApiResponse(code = 404, message = "Not found"),
|
||||
@ApiResponse(code = 500, message = "Internal Server Error")})
|
||||
public List<ItemReference> getChildren(@ApiParam(value = "Workspace ID", required = true)
|
||||
@PathParam("ws-id") String workspace,
|
||||
@ApiParam(value = "Path to a project", required = true)
|
||||
public List<ItemReference> getChildren(@ApiParam(value = "Path to a project", required = true)
|
||||
@PathParam("parent") String path) throws NotFoundException,
|
||||
ForbiddenException,
|
||||
ServerException {
|
||||
|
|
@ -781,9 +748,9 @@ public class ProjectService extends Service {
|
|||
final ArrayList<ItemReference> result = new ArrayList<>(children.size());
|
||||
for (VirtualFileEntry child : children) {
|
||||
if (child.isFile()) {
|
||||
result.add(injectFileLinks(asDto((FileEntry)child), workspace));
|
||||
result.add(injectFileLinks(asDto((FileEntry)child)));
|
||||
} else {
|
||||
result.add(injectFolderLinks(asDto((FolderEntry)child), workspace));
|
||||
result.add(injectFolderLinks(asDto((FolderEntry)child)));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -800,9 +767,7 @@ public class ProjectService extends Service {
|
|||
@ApiResponse(code = 403, message = "User not authorized to call this operation"),
|
||||
@ApiResponse(code = 404, message = "Not found"),
|
||||
@ApiResponse(code = 500, message = "Internal Server Error")})
|
||||
public TreeElement getTree(@ApiParam(value = "Workspace ID", required = true)
|
||||
@PathParam("ws-id") String workspace,
|
||||
@ApiParam(value = "Path to resource. Can be project or its folders", required = true)
|
||||
public TreeElement getTree(@ApiParam(value = "Path to resource. Can be project or its folders", required = true)
|
||||
@PathParam("parent") String path,
|
||||
@ApiParam(value = "Tree depth. This parameter can be dropped. If not specified ?depth=1 is used by default")
|
||||
@DefaultValue("1") @QueryParam("depth") int depth,
|
||||
|
|
@ -813,8 +778,8 @@ public class ProjectService extends Service {
|
|||
ServerException {
|
||||
final FolderEntry folder = projectManager.asFolder(path);
|
||||
|
||||
return newDto(TreeElement.class).withNode(injectFolderLinks(asDto(folder), workspace))
|
||||
.withChildren(getTree(folder, workspace, depth, includeFiles));
|
||||
return newDto(TreeElement.class).withNode(injectFolderLinks(asDto(folder)))
|
||||
.withChildren(getTree(folder, depth, includeFiles));
|
||||
}
|
||||
|
||||
@GET
|
||||
|
|
@ -826,9 +791,7 @@ public class ProjectService extends Service {
|
|||
@ApiResponse(code = 403, message = "User not authorized to call this operation"),
|
||||
@ApiResponse(code = 404, message = "Not found"),
|
||||
@ApiResponse(code = 500, message = "Internal Server Error")})
|
||||
public ItemReference getItem(@ApiParam(value = "Workspace ID", required = true)
|
||||
@PathParam("ws-id") String workspace,
|
||||
@ApiParam(value = "Path to resource. Can be project or its folders", required = true)
|
||||
public ItemReference getItem(@ApiParam(value = "Path to resource. Can be project or its folders", required = true)
|
||||
@PathParam("path") String path) throws NotFoundException,
|
||||
ForbiddenException,
|
||||
ServerException {
|
||||
|
|
@ -839,9 +802,9 @@ public class ProjectService extends Service {
|
|||
}
|
||||
|
||||
if (entry.isFile()) {
|
||||
return injectFileLinks(asDto((FileEntry)entry), workspace);
|
||||
return injectFileLinks(asDto((FileEntry)entry));
|
||||
} else {
|
||||
return injectFolderLinks(asDto((FolderEntry)entry), workspace);
|
||||
return injectFolderLinks(asDto((FolderEntry)entry));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -857,9 +820,7 @@ public class ProjectService extends Service {
|
|||
@ApiResponse(code = 404, message = "Not found"),
|
||||
@ApiResponse(code = 409, message = "Conflict error"),
|
||||
@ApiResponse(code = 500, message = "Internal Server Error")})
|
||||
public List<ItemReference> search(@ApiParam(value = "Workspace ID", required = true)
|
||||
@PathParam("ws-id") String workspace,
|
||||
@ApiParam(value = "Path to resource, i.e. where to search?", required = true)
|
||||
public List<ItemReference> search(@ApiParam(value = "Path to resource, i.e. where to search?", required = true)
|
||||
@PathParam("path") String path,
|
||||
@ApiParam(value = "Resource name")
|
||||
@QueryParam("name") String name,
|
||||
|
|
@ -900,7 +861,7 @@ public class ProjectService extends Service {
|
|||
final VirtualFileEntry child = root.getChild(searchResultEntry.getFilePath());
|
||||
|
||||
if (child != null && child.isFile()) {
|
||||
items.add(injectFileLinks(asDto((FileEntry)child), workspace));
|
||||
items.add(injectFileLinks(asDto((FileEntry)child)));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -936,7 +897,6 @@ public class ProjectService extends Service {
|
|||
}
|
||||
|
||||
private List<TreeElement> getTree(FolderEntry folder,
|
||||
String workspace,
|
||||
int depth,
|
||||
boolean includeFiles) throws ServerException, NotFoundException {
|
||||
if (depth == 0) {
|
||||
|
|
@ -955,10 +915,10 @@ public class ProjectService extends Service {
|
|||
for (VirtualFileEntry child : children) {
|
||||
if (child.isFolder()) {
|
||||
nodes.add(newDto(TreeElement.class)
|
||||
.withNode(injectFolderLinks(asDto((FolderEntry)child), workspace))
|
||||
.withChildren(getTree((FolderEntry)child, workspace, depth - 1, includeFiles)));
|
||||
.withNode(injectFolderLinks(asDto((FolderEntry)child)))
|
||||
.withChildren(getTree((FolderEntry)child, depth - 1, includeFiles)));
|
||||
} else {
|
||||
nodes.add(newDto(TreeElement.class).withNode(injectFileLinks(asDto((FileEntry)child), workspace)));
|
||||
nodes.add(newDto(TreeElement.class).withNode(injectFileLinks(asDto((FileEntry)child))));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1064,7 +1024,7 @@ public class ProjectService extends Service {
|
|||
parent.unzip(in, overwrite, stripNum);
|
||||
}
|
||||
|
||||
private ItemReference injectFileLinks(ItemReference itemReference, String workspace) {
|
||||
private ItemReference injectFileLinks(ItemReference itemReference) {
|
||||
final UriBuilder uriBuilder = getServiceContext().getServiceUriBuilder();
|
||||
final List<Link> links = new ArrayList<>();
|
||||
final String relPath = itemReference.getPath().substring(1);
|
||||
|
|
@ -1072,14 +1032,14 @@ public class ProjectService extends Service {
|
|||
links.add(createLink(GET,
|
||||
uriBuilder.clone()
|
||||
.path(ProjectService.class, "getFile")
|
||||
.build(workspace, relPath)
|
||||
.build(relPath)
|
||||
.toString(),
|
||||
APPLICATION_JSON,
|
||||
LINK_REL_GET_CONTENT));
|
||||
links.add(createLink(PUT,
|
||||
uriBuilder.clone()
|
||||
.path(ProjectService.class, "updateFile")
|
||||
.build(workspace, relPath)
|
||||
.build(relPath)
|
||||
.toString(),
|
||||
MediaType.WILDCARD,
|
||||
null,
|
||||
|
|
@ -1087,14 +1047,14 @@ public class ProjectService extends Service {
|
|||
links.add(createLink(DELETE,
|
||||
uriBuilder.clone()
|
||||
.path(ProjectService.class, "delete")
|
||||
.build(workspace, relPath)
|
||||
.build(relPath)
|
||||
.toString(),
|
||||
LINK_REL_DELETE));
|
||||
|
||||
return itemReference.withLinks(links);
|
||||
}
|
||||
|
||||
private ItemReference injectFolderLinks(ItemReference itemReference, String workspace) {
|
||||
private ItemReference injectFolderLinks(ItemReference itemReference) {
|
||||
final UriBuilder uriBuilder = getServiceContext().getServiceUriBuilder();
|
||||
final List<Link> links = new ArrayList<>();
|
||||
final String relPath = itemReference.getPath().substring(1);
|
||||
|
|
@ -1102,28 +1062,28 @@ public class ProjectService extends Service {
|
|||
links.add(createLink(GET,
|
||||
uriBuilder.clone()
|
||||
.path(ProjectService.class, "getChildren")
|
||||
.build(workspace, relPath)
|
||||
.build(relPath)
|
||||
.toString(),
|
||||
APPLICATION_JSON,
|
||||
LINK_REL_CHILDREN));
|
||||
links.add(createLink(GET,
|
||||
uriBuilder.clone()
|
||||
.path(ProjectService.class, "getTree")
|
||||
.build(workspace, relPath)
|
||||
.build(relPath)
|
||||
.toString(),
|
||||
APPLICATION_JSON,
|
||||
LINK_REL_TREE));
|
||||
links.add(createLink(DELETE,
|
||||
uriBuilder.clone()
|
||||
.path(ProjectService.class, "delete")
|
||||
.build(workspace, relPath)
|
||||
.build(relPath)
|
||||
.toString(),
|
||||
LINK_REL_DELETE));
|
||||
|
||||
return itemReference.withLinks(links);
|
||||
}
|
||||
|
||||
private ProjectConfigDto injectProjectLinks(ProjectConfigDto projectConfig, String workspace) {
|
||||
private ProjectConfigDto injectProjectLinks(ProjectConfigDto projectConfig) {
|
||||
final UriBuilder uriBuilder = getServiceContext().getServiceUriBuilder();
|
||||
final List<Link> links = new ArrayList<>();
|
||||
final String relPath = projectConfig.getPath().substring(1);
|
||||
|
|
@ -1131,7 +1091,7 @@ public class ProjectService extends Service {
|
|||
links.add(createLink(PUT,
|
||||
uriBuilder.clone()
|
||||
.path(ProjectService.class, "updateProject")
|
||||
.build(workspace, relPath)
|
||||
.build(relPath)
|
||||
.toString(),
|
||||
APPLICATION_JSON,
|
||||
APPLICATION_JSON,
|
||||
|
|
@ -1139,21 +1099,21 @@ public class ProjectService extends Service {
|
|||
links.add(createLink(GET,
|
||||
uriBuilder.clone()
|
||||
.path(ProjectService.class, "getChildren")
|
||||
.build(workspace, relPath)
|
||||
.build(relPath)
|
||||
.toString(),
|
||||
APPLICATION_JSON,
|
||||
LINK_REL_CHILDREN));
|
||||
links.add(createLink(GET,
|
||||
uriBuilder.clone()
|
||||
.path(ProjectService.class, "getTree")
|
||||
.build(workspace, relPath)
|
||||
.build(relPath)
|
||||
.toString(),
|
||||
APPLICATION_JSON,
|
||||
LINK_REL_TREE));
|
||||
links.add(createLink(DELETE,
|
||||
uriBuilder.clone()
|
||||
.path(ProjectService.class, "delete")
|
||||
.build(workspace, relPath)
|
||||
.build(relPath)
|
||||
.toString(),
|
||||
LINK_REL_DELETE));
|
||||
|
||||
|
|
|
|||
|
|
@ -42,15 +42,11 @@ import static org.eclipse.che.api.project.shared.Constants.LINK_REL_PROJECT_TYPE
|
|||
* @author gazarenkov
|
||||
*/
|
||||
@Api(value = "/project-type", description = "Project type REST API")
|
||||
@Path("project-type/{ws-id}")
|
||||
@Path("project-type")
|
||||
public class ProjectTypeService extends Service {
|
||||
|
||||
private final ProjectTypeRegistry registry;
|
||||
|
||||
@PathParam("ws-id")
|
||||
@ApiParam("The id of the workspace")
|
||||
private String wsId;
|
||||
|
||||
@Inject
|
||||
public ProjectTypeService(ProjectTypeRegistry registry) {
|
||||
this.registry = registry;
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ import static org.eclipse.che.dto.server.DtoFactory.newDto;
|
|||
*
|
||||
* @author Vitaly Parfonov
|
||||
*/
|
||||
@Path("project-importers/{wsId}")
|
||||
@Path("project-importers")
|
||||
public class ProjectImportersService extends Service {
|
||||
|
||||
private final Map<String, String> configuration;
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -8,21 +8,22 @@
|
|||
* Contributors:
|
||||
* Codenvy, S.A. - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.che.plugin.maven.client.module;
|
||||
package org.eclipse.che;
|
||||
|
||||
import com.google.gwt.resources.client.ClientBundle;
|
||||
|
||||
import org.eclipse.che.ide.ui.Styles;
|
||||
|
||||
/**
|
||||
* @author Evgen Vidolob
|
||||
* Class provide workspace ID which linked to current developer machine it will take from environment variable "CHE_WORKSPACE_ID"
|
||||
* if this variable not set return empty String but in real life should never be
|
||||
*
|
||||
*
|
||||
* @author Vitalii Parfonov
|
||||
*/
|
||||
public interface CreateMavenModuleResources extends ClientBundle {
|
||||
|
||||
@Source({"org/eclipse/che/ide/api/ui/style.css","org/eclipse/che/ide/ui/Styles.css"})
|
||||
Css css();
|
||||
public class WorkspaceIdProvider {
|
||||
|
||||
public interface Css extends Styles{
|
||||
public static final String CHE_WORKSPACE_ID = "CHE_WORKSPACE_ID";
|
||||
|
||||
public static String getWorkspaceId() {
|
||||
return System.getenv(CHE_WORKSPACE_ID) == null ? "" : System.getenv(CHE_WORKSPACE_ID);
|
||||
}
|
||||
}
|
||||
|
|
@ -855,6 +855,7 @@ public class WorkspaceService extends Service {
|
|||
.getLinks()
|
||||
.add(createLink("GET",
|
||||
UriBuilder.fromUri(wsAgent.getUrl())
|
||||
.path("ws")
|
||||
.scheme("https".equals(ideUri.getScheme()) ? "wss" : "ws")
|
||||
.build()
|
||||
.toString(),
|
||||
|
|
|
|||
Loading…
Reference in New Issue