use of org.eclipse.wst.server.core.IServer in project liferay-ide by liferay.
the class WorkflowDefinitionsCustomContentProvider method getPipelinedChildren.
@SuppressWarnings({ "rawtypes", "unchecked" })
public void getPipelinedChildren(Object parent, Set currentChildren) {
if (parent instanceof IServer) {
IServer server = (IServer) parent;
/*
* IServerListener listener = new IServerListener() {
*
*
* @Override public void serverChanged( ServerEvent event ) { try {
* WorkflowDefinitionsCustomContentProvider.checkApiStatuses.
* remove( server.getId() ); refreshUI( (NavigatorContentService)
* getConfig().getService(), server ); } catch( Exception e) {} } };
* server.addServerListener( listener );
*/
if (server.getServerState() == IServer.STATE_STARTED) {
WorkflowDefinitionsFolder definitionsNode = _workflowDefinitionFolders.get(server.getId());
if (definitionsNode == null) {
IStatus checkApiStatus = _checkApiStatuses.get(server.getId());
if (checkApiStatus == null) {
Job checkJob = new Job("Checking for Kaleo Designer API...") {
@Override
protected IStatus run(IProgressMonitor monitor) {
try {
IKaleoConnection kaleoConnection = KaleoCore.getKaleoConnection(server);
KaleoCore.updateKaleoConnectionSettings(KaleoUtil.getLiferayServer(server, monitor), kaleoConnection);
kaleoConnection.getKaleoDefinitions();
kaleoConnection.getKaleoDraftWorkflowDefinitions();
WorkflowDefinitionsCustomContentProvider.this._checkApiStatuses.put(server.getId(), Status.OK_STATUS);
refreshUI((NavigatorContentService) getConfig().getService(), server);
} catch (Exception e) {
WorkflowDefinitionsCustomContentProvider.this._checkApiStatuses.put(server.getId(), KaleoUI.createErrorStatus(e));
}
return Status.OK_STATUS;
}
};
checkJob.schedule();
} else {
if (checkApiStatus.isOK()) {
_insertDefinitionsNode(server, currentChildren);
WorkflowDefinitionsCustomContentProvider.this._checkApiStatuses.put(server.getId(), null);
} else {
KaleoUI.logInfo("Kaleo Workflow API unavailable.", checkApiStatus);
}
}
} else {
if (!currentChildren.contains(definitionsNode)) {
currentChildren.add(definitionsNode);
// make sure children are cached.
definitionsNode.getChildren();
}
}
} else {
_workflowDefinitionFolders.put(server.getId(), null);
_checkApiStatuses.put(server.getId(), null);
}
}
}
use of org.eclipse.wst.server.core.IServer in project liferay-ide by liferay.
the class WorkflowDefinitionsCustomContentProvider method hasChildren.
public boolean hasChildren(Object element, boolean currentHasChildren) {
if (element instanceof IServer) {
/*
* higher priority extension should consider Properties File
* extension's result
*/
if (currentHasChildren) {
return true;
}
IServer server = (IServer) element;
WorkflowDefinitionsFolder definitionsNode = _workflowDefinitionFolders.get(server.getId());
if (definitionsNode != null) {
return true;
}
if (ServerUtil.isLiferayRuntime(server)) {
if (server.getServerState() == IServer.STATE_STARTED) {
return true;
}
}
}
return currentHasChildren;
}
use of org.eclipse.wst.server.core.IServer in project liferay-ide by liferay.
the class WorkflowProjectAdapterService method convert.
@Override
public <A> A convert(Object object, Class<A> adapterType) {
A retval = null;
if (IProject.class.equals(adapterType)) {
ISapphirePart sapphirePart = context().find(ISapphirePart.class);
WorkflowDefinition workflowDefinition = sapphirePart.getLocalModelElement().nearest(WorkflowDefinition.class);
IFile file = workflowDefinition.adapt(IFile.class);
if (file != null) {
retval = adapterType.cast(file.getProject());
} else {
// create support project
WorkflowSupportManager workflowSupportManager = KaleoCore.getDefault().getWorkflowSupportManager();
IEditorInput editorInput = workflowDefinition.adapt(IEditorInput.class);
if (editorInput instanceof WorkflowDefinitionEditorInput) {
WorkflowDefinitionEditorInput workflowInput = (WorkflowDefinitionEditorInput) editorInput;
WorkflowDefinitionEntry workflowEntry = workflowInput.getWorkflowDefinitionEntry();
IServer server = workflowEntry.getParent().getParent();
workflowSupportManager.setCurrentServer(server);
}
IJavaProject supportProject = workflowSupportManager.getSupportProject();
retval = adapterType.cast(supportProject.getProject());
}
}
return retval;
}
use of org.eclipse.wst.server.core.IServer in project liferay-ide by liferay.
the class DebugPortalLaunchParticipant method provideVMArgs.
public String provideVMArgs(ILaunchConfiguration configuration) {
String retval = null;
try {
String stopServer = configuration.getAttribute(STOP_SERVER, "false");
if (ILaunchManager.DEBUG_MODE.equals(saveLaunchMode) && "false".equals(stopServer)) {
final IServer server = org.eclipse.wst.server.core.ServerUtil.getServer(configuration);
final ILiferayRuntime liferayRuntime = (ILiferayRuntime) server.getRuntime().loadAdapter(ILiferayRuntime.class, null);
final Version version = new Version(liferayRuntime.getPortalVersion());
if (CoreUtil.compareVersions(version, ILiferayConstants.V620) >= 0) {
if (this.fmDebugPort != null) {
retval = NLS.bind(FM_PARAMS, PortalCore.getPreference(PortalCore.PREF_FM_DEBUG_PASSWORD), this.fmDebugPort);
} else {
// $NON-NLS-1$
PortalCore.logError("The freemarker debug port is invalid.");
}
}
}
} catch (CoreException e) {
}
return retval;
}
use of org.eclipse.wst.server.core.IServer in project liferay-ide by liferay.
the class DebugPortalLaunchParticipant method portalPostLaunch.
public void portalPostLaunch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException {
final IServer server = org.eclipse.wst.server.core.ServerUtil.getServer(configuration);
final IServerManagerConnection connection = ServerUtil.getServerManagerConnection(server, monitor);
if (connection != null) {
try {
final String fmDebugPassword = connection.getFMDebugPassword();
final int fmDebugPort = connection.getFMDebugPort();
if (fmDebugPassword != null && fmDebugPort != -1) {
launch.setAttribute(PortalCore.PREF_FM_DEBUG_PASSWORD, fmDebugPassword);
launch.setAttribute(PortalCore.PREF_FM_DEBUG_PORT, Integer.toString(fmDebugPort));
final IDebugTarget target = new FMDebugTarget(server.getHost(), launch, launch.getProcesses()[0]);
launch.addDebugTarget(target);
}
} catch (APIException e) {
LiferayServerCore.logError("Unable to determine remote freemarker debugger connection info.", e);
}
}
this.saveLaunchMode = null;
final String stopServer = configuration.getAttribute(STOP_SERVER, "false");
if (ILaunchManager.DEBUG_MODE.equals(mode) && "false".equals(stopServer)) {
if (this.fmDebugPort != null) {
launch.setAttribute(PortalCore.PREF_FM_DEBUG_PORT, this.fmDebugPort);
this.fmDebugPort = null;
final IDebugTarget target = new FMDebugTarget(server.getHost(), launch, launch.getProcesses()[0]);
launch.addDebugTarget(target);
} else {
// $NON-NLS-1$
PortalCore.logError("Launch freemarker port is invalid.");
}
}
}
Aggregations