Search in sources :

Example 16 with SystemException

use of org.talend.commons.exception.SystemException in project tdi-studio-se by Talend.

the class ProblemsView method restoreProblem.

/**
     * 
     * ggu Comment method "restoreProblem".
     * 
     * when restore the item, check the problem.
     */
private void restoreProblem(RoutineItem item) {
    ICodeGeneratorService service = (ICodeGeneratorService) GlobalServiceRegister.getDefault().getService(ICodeGeneratorService.class);
    ITalendSynchronizer routineSynchronizer = null;
    switch(LanguageManager.getCurrentLanguage()) {
        case JAVA:
            routineSynchronizer = service.createJavaRoutineSynchronizer();
            break;
        case PERL:
            routineSynchronizer = service.createPerlRoutineSynchronizer();
            break;
        default:
    }
    if (routineSynchronizer != null) {
        try {
            routineSynchronizer.syncRoutine(item, true);
            IFile file = routineSynchronizer.getFile(item);
            if (file == null) {
                return;
            }
            file.refreshLocal(IResource.DEPTH_ONE, null);
            Problems.addRoutineFile(file, item.getProperty());
        } catch (SystemException e) {
            ExceptionHandler.process(e);
        } catch (CoreException e) {
            ExceptionHandler.process(e);
        }
        Display.getDefault().asyncExec(new Runnable() {

            @Override
            public void run() {
                Problems.refreshProblemTreeView();
            }
        });
    }
}
Also used : ITalendSynchronizer(org.talend.designer.codegen.ITalendSynchronizer) IFile(org.eclipse.core.resources.IFile) SystemException(org.talend.commons.exception.SystemException) CoreException(org.eclipse.core.runtime.CoreException) ICodeGeneratorService(org.talend.designer.codegen.ICodeGeneratorService)

Example 17 with SystemException

use of org.talend.commons.exception.SystemException in project tdi-studio-se by Talend.

the class Processor method updateContextCode.

protected void updateContextCode(ICodeGenerator codeGen) throws ProcessorException {
    if (codeGen == null) {
        return;
    }
    try {
        //$NON-NLS-1$
        String processContext = "false";
        try {
            processContext = codeGen.generateContextCode(context);
        } catch (SystemException e) {
            //$NON-NLS-1$
            throw new ProcessorException(Messages.getString("Processor.generationFailed"), e);
        }
        IFile contextFile = this.getCodeProject().getFile(contextPath);
        InputStream contextStream = new ByteArrayInputStream(processContext.getBytes());
        if (!contextFile.exists()) {
            // see bug 0003592, detele file with different case in windows
            deleteFileIfExisted(contextFile);
            contextFile.create(contextStream, true, null);
        } else {
            contextFile.setContents(contextStream, true, false, null);
        }
    } catch (CoreException e1) {
        //$NON-NLS-1$
        throw new ProcessorException(Messages.getString("Processor.tempFailed"), e1);
    }
}
Also used : ProcessorException(org.talend.designer.runprocess.ProcessorException) IFile(org.eclipse.core.resources.IFile) SystemException(org.talend.commons.exception.SystemException) CoreException(org.eclipse.core.runtime.CoreException) ByteArrayInputStream(java.io.ByteArrayInputStream) BufferedInputStream(java.io.BufferedInputStream) ByteArrayInputStream(java.io.ByteArrayInputStream) InputStream(java.io.InputStream)

Example 18 with SystemException

use of org.talend.commons.exception.SystemException in project tdi-studio-se by Talend.

the class JavaCompilationParticipant method updateProblems.

/**
     * yzhang Comment method "updateProblems".
     */
private void updateProblems(List<IRepositoryViewObject> routineObjectList, String filePath) {
    IRunProcessService runProcessService = CorePlugin.getDefault().getRunProcessService();
    try {
        ITalendProcessJavaProject talendProcessJavaProject = runProcessService.getTalendProcessJavaProject();
        if (talendProcessJavaProject == null) {
            return;
        }
        final ITalendSynchronizer synchronizer = CorePlugin.getDefault().getCodeGeneratorService().createRoutineSynchronizer();
        IProject javaProject = talendProcessJavaProject.getProject();
        IFile file = javaProject.getFile(filePath);
        String fileName = file.getName();
        for (IRepositoryViewObject repositoryObject : routineObjectList) {
            Property property = repositoryObject.getProperty();
            Item item = property.getItem();
            IFile currentFile = synchronizer.getFile(item);
            if (currentFile != null && fileName.equals(currentFile.getName()) && currentFile.exists()) {
                Problems.addRoutineFile(currentFile, property);
                break;
            }
        }
    } catch (SystemException e) {
        ExceptionHandler.process(e);
    }
}
Also used : ITalendSynchronizer(org.talend.designer.codegen.ITalendSynchronizer) Item(org.talend.core.model.properties.Item) IFile(org.eclipse.core.resources.IFile) SystemException(org.talend.commons.exception.SystemException) IRunProcessService(org.talend.designer.runprocess.IRunProcessService) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) Property(org.talend.core.model.properties.Property) ITalendProcessJavaProject(org.talend.core.runtime.process.ITalendProcessJavaProject) IProject(org.eclipse.core.resources.IProject)

Example 19 with SystemException

use of org.talend.commons.exception.SystemException in project tdi-studio-se by Talend.

the class LoginProjectPage method validateUpdate.

protected void validateUpdate() throws JSONException {
    final ConnectionBean currentBean = getConnection();
    String repositoryId = null;
    // at 1st time open the studio there are no bean at all,so need avoid NPE
    if (currentBean != null) {
        repositoryId = currentBean.getRepositoryId();
    }
    try {
        if (currentBean != null && isSVNProviderPluginLoadedRemote() && isWorkSpaceSame()) {
            if (afterUpdate) {
                refreshProjectOperationAreaEnable(false);
                //$NON-NLS-1$
                errorManager.setErrMessage(Messages.getString("LoginProjectPage.archivaFinish"));
                changeFinishButtonAction(FINISH_ACTION_RESTART);
            } else {
                OverTimePopupDialogTask<Boolean> overTimePopupDialogTask = new OverTimePopupDialogTask<Boolean>() {

                    @Override
                    public Boolean run() throws Throwable {
                        return LoginHelper.isStudioNeedUpdate(currentBean);
                    }
                };
                overTimePopupDialogTask.setNeedWaitingProgressJob(false);
                boolean needUpdate = overTimePopupDialogTask.runTask();
                if (needUpdate && isWorkSpaceSame()) {
                    refreshProjectOperationAreaEnable(false);
                    //$NON-NLS-1$
                    errorManager.setErrMessage(Messages.getString("LoginProjectPage.updateArchiva"));
                    changeFinishButtonAction(FINISH_ACTION_UPDATE);
                }
            }
        }
    } catch (PersistenceException e) {
        CommonExceptionHandler.process(e);
    } catch (SystemException e) {
        updateArchivaErrorButton();
    } catch (Throwable e) {
        CommonExceptionHandler.process(e);
    }
}
Also used : OverTimePopupDialogTask(org.talend.repository.ui.dialog.OverTimePopupDialogTask) SystemException(org.talend.commons.exception.SystemException) PersistenceException(org.talend.commons.exception.PersistenceException) ConnectionBean(org.talend.core.model.general.ConnectionBean) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean)

Example 20 with SystemException

use of org.talend.commons.exception.SystemException in project tdi-studio-se by Talend.

the class RepositoryService method getRulesProviderPath.

@Override
public String getRulesProviderPath(RulesItem currentRepositoryItem) {
    IRulesProviderService rulesService = null;
    if (PluginChecker.isRulesPluginLoaded()) {
        rulesService = (IRulesProviderService) GlobalServiceRegister.getDefault().getService(IRulesProviderService.class);
        try {
            rulesService.syncRule(currentRepositoryItem);
            IFile ruleFile = rulesService.getRuleFile(currentRepositoryItem, FileConstants.XLS_FILE_SUFFIX);
            if (ruleFile == null) {
                return null;
            }
            String path = ruleFile.getLocation().toOSString();
            return path;
        } catch (SystemException e) {
            // added by SeB, log it at least butthe devlopper should have a look at this
            //$NON-NLS-1$
            log.error("failed to get the Rules provider path", e);
        }
    }
    //$NON-NLS-1$
    return "";
}
Also used : IFile(org.eclipse.core.resources.IFile) SystemException(org.talend.commons.exception.SystemException) IRulesProviderService(org.talend.core.ui.services.IRulesProviderService)

Aggregations

SystemException (org.talend.commons.exception.SystemException)24 IFile (org.eclipse.core.resources.IFile)10 PartInitException (org.eclipse.ui.PartInitException)9 CoreException (org.eclipse.core.runtime.CoreException)6 PersistenceException (org.talend.commons.exception.PersistenceException)6 IOException (java.io.IOException)5 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)5 Property (org.talend.core.model.properties.Property)5 ICodeGeneratorService (org.talend.designer.codegen.ICodeGeneratorService)5 RepositoryNode (org.talend.repository.model.RepositoryNode)5 File (java.io.File)4 RoutineItem (org.talend.core.model.properties.RoutineItem)4 FileOutputStream (java.io.FileOutputStream)3 IPath (org.eclipse.core.runtime.IPath)3 ISelection (org.eclipse.jface.viewers.ISelection)3 WizardDialog (org.eclipse.jface.wizard.WizardDialog)3 Project (org.talend.core.model.general.Project)3 Item (org.talend.core.model.properties.Item)3 SQLPatternItem (org.talend.core.model.properties.SQLPatternItem)3 BufferedInputStream (java.io.BufferedInputStream)2