use of org.talend.core.model.general.Project in project tdi-studio-se by Talend.
the class OpenRepositoryJobHierarchyAction method doRun.
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.action.Action#run()
*/
protected void doRun() {
ISelection selection = getSelection();
Object obj = ((IStructuredSelection) selection).getFirstElement();
RepositoryNode node = (RepositoryNode) obj;
Property property = (Property) node.getObject().getProperty();
Property updatedProperty = null;
try {
updatedProperty = ProxyRepositoryFactory.getInstance().getLastVersion(new Project(ProjectManager.getInstance().getProject(property.getItem())), property.getId()).getProperty();
} catch (PersistenceException e) {
ExceptionHandler.process(e);
}
// update the property of the node repository object
if (node.getObject() instanceof IRepositoryObject) {
IRepositoryObject iobject = (IRepositoryObject) node.getObject();
iobject.setProperty(updatedProperty);
}
Assert.isTrue(property.getItem() instanceof ProcessItem);
// TODO should use a fake Process here to replace the real Process.
// Process loadedProcess = new Process(property);
// loadedProcess.loadXmlFile();
IDesignerCoreService designerCoreService = CorePlugin.getDefault().getDesignerCoreService();
Process loadedProcess = (Process) designerCoreService.getProcessFromProcessItem((ProcessItem) updatedProperty.getItem());
OpenJobHierarchyAction openAction = new OpenJobHierarchyAction(this.getViewPart());
openAction.run(loadedProcess);
}
use of org.talend.core.model.general.Project in project tdi-studio-se by Talend.
the class JSONShadowProcess method getTmpFolderPath.
private IPath getTmpFolderPath() {
Project project = ProjectManager.getInstance().getCurrentProject();
IProject physProject;
//$NON-NLS-1$
String tmpFolder = System.getProperty("user.dir");
try {
physProject = ResourceModelUtils.getProject(project);
//$NON-NLS-1$
tmpFolder = physProject.getFolder("temp").getLocation().toPortableString();
} catch (Exception e) {
ExceptionHandler.process(e);
}
//$NON-NLS-1$
tmpFolder = tmpFolder + "/preview";
return new Path(tmpFolder);
}
use of org.talend.core.model.general.Project in project tdi-studio-se by Talend.
the class JSONFileStep1Form method initFileContent.
private void initFileContent() {
byte[] bytes = getConnection().getFileContent();
Project project = ProjectManager.getInstance().getCurrentProject();
IProject fsProject = null;
try {
fsProject = ResourceUtils.getProject(project);
} catch (PersistenceException e2) {
ExceptionHandler.process(e2);
}
if (fsProject == null) {
return;
}
//$NON-NLS-1$
String temPath = fsProject.getLocationURI().getPath() + File.separator + "temp";
//$NON-NLS-1$
String fileName = "";
if (getConnection().getJSONFilePath() != null) {
fileName = "tempJSONFile" + '.' + "json";
}
File temfile = new File(temPath + File.separator + fileName);
if (!temfile.exists()) {
try {
temfile.createNewFile();
} catch (IOException e) {
ExceptionHandler.process(e);
}
}
FileOutputStream outStream;
try {
outStream = new FileOutputStream(temfile);
outStream.write(bytes);
outStream.close();
} catch (FileNotFoundException e1) {
ExceptionHandler.process(e1);
} catch (IOException e) {
ExceptionHandler.process(e);
}
tempJSONXsdPath = temfile.getPath();
if (isContextMode()) {
ContextType contextType = ConnectionContextHelper.getContextTypeForContextMode(connectionItem.getConnection());
tempJSONXsdPath = TalendQuoteUtils.removeQuotes(ConnectionContextHelper.getOriginalValue(contextType, tempJSONXsdPath));
}
// valid = this.treePopulator.populateTree(tempJSONXsdPath, treeNode);
// temfile.delete();
}
use of org.talend.core.model.general.Project in project tdi-studio-se by Talend.
the class AbstractJSONFileStepForm method getXSDJSONFilePath.
protected String getXSDJSONFilePath() {
if (getConnection().getFileContent() == null || getConnection().getFileContent().length == 0) {
return null;
}
byte[] bytes = getConnection().getFileContent();
Project project = ProjectManager.getInstance().getCurrentProject();
IProject fsProject = null;
try {
fsProject = ResourceUtils.getProject(project);
} catch (PersistenceException e2) {
ExceptionHandler.process(e2);
}
if (fsProject == null) {
return null;
}
//$NON-NLS-1$
String temPath = fsProject.getLocationURI().getPath() + File.separator + "temp";
//$NON-NLS-1$
String fileName = "";
if (getConnection().getJSONFilePath() != null) {
fileName = "tempJSONFile" + '.' + "json";
}
File temfile = new File(temPath + File.separator + fileName);
if (!temfile.exists()) {
try {
temfile.createNewFile();
} catch (IOException e) {
ExceptionHandler.process(e);
}
}
FileOutputStream outStream;
try {
outStream = new FileOutputStream(temfile);
outStream.write(bytes);
outStream.close();
} catch (FileNotFoundException e1) {
ExceptionHandler.process(e1);
} catch (IOException e) {
ExceptionHandler.process(e);
}
String tempJSONXsdPath = temfile.getPath();
if (isContextMode()) {
ContextType contextType = ConnectionContextHelper.getContextTypeForContextMode(connectionItem.getConnection());
tempJSONXsdPath = TalendQuoteUtils.removeQuotes(ConnectionContextHelper.getOriginalValue(contextType, tempJSONXsdPath));
}
return tempJSONXsdPath;
}
use of org.talend.core.model.general.Project in project tdi-studio-se by Talend.
the class ExchangeLoginTask method run.
/* (non-Javadoc)
* @see org.eclipse.jface.operation.IRunnableWithProgress#run(org.eclipse.core.runtime.IProgressMonitor)
*/
@Override
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
if (!PluginChecker.isExchangeSystemLoaded() || TalendPropertiesUtil.isHideExchange()) {
return;
}
Job job = new //$NON-NLS-1$
Job(//$NON-NLS-1$
"Check Exchange") {
@Override
protected IStatus run(IProgressMonitor monitor) {
// check for Talendforge
IPreferenceStore prefStore = PlatformUI.getPreferenceStore();
boolean checkTisVersion = prefStore.getBoolean(ITalendCorePrefConstants.EXCHANGE_CHECK_TIS_VERSION);
IBrandingService brandingService = (IBrandingService) GlobalServiceRegister.getDefault().getService(IBrandingService.class);
if (!checkTisVersion && brandingService.isPoweredbyTalend()) {
int count = prefStore.getInt(TalendForgeDialog.LOGINCOUNT);
if (count < 0) {
count = 1;
}
ExchangeUser exchangeUser = ProjectManager.getInstance().getCurrentProject().getExchangeUser();
//$NON-NLS-1$
boolean isExchangeLogon = exchangeUser.getLogin() != null && !exchangeUser.getLogin().equals("");
boolean isUserPassRight = true;
if (isExchangeLogon) {
IExchangeService service = (IExchangeService) GlobalServiceRegister.getDefault().getService(IExchangeService.class);
if (service.checkUserAndPass(exchangeUser.getUsername(), exchangeUser.getPassword()) != null) {
isUserPassRight = false;
}
}
if (!isExchangeLogon || !isUserPassRight) {
if ((count + 1) % 4 == 0) {
// if (Platform.getOS().equals(Platform.OS_LINUX)) {
// TalendForgeDialog tfDialog = new TalendForgeDialog(this.getShell(), project);
// tfDialog.open();
// } else {
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
Project project = ProjectManager.getInstance().getCurrentProject();
String userEmail = null;
if (project.getAuthor() != null) {
userEmail = project.getAuthor().getLogin();
}
TalendForgeDialog tfDialog = new TalendForgeDialog(DisplayUtils.getDefaultShell(), userEmail);
tfDialog.setBlockOnOpen(true);
tfDialog.open();
}
});
}
prefStore.setValue(TalendForgeDialog.LOGINCOUNT, count + 1);
}
}
return org.eclipse.core.runtime.Status.OK_STATUS;
}
};
job.setSystem(true);
job.setUser(false);
job.setPriority(Job.INTERACTIVE);
// start as soon as possible
job.schedule();
}
Aggregations