Search in sources :

Example 11 with PartInitException

use of org.eclipse.ui.PartInitException in project tdi-studio-se by Talend.

the class AbstractMultiPageTalendEditor method createPage0.

protected void createPage0() {
    try {
        int index = addPage(designerEditor, getEditorInput());
        //$NON-NLS-1$
        setPageText(index, "Designer");
        designerEditor.setParent(this);
    } catch (PartInitException e) {
        // e.printStackTrace();
        ExceptionHandler.process(e);
    }
    setCSSStylingClass();
}
Also used : PartInitException(org.eclipse.ui.PartInitException) IExtensionPoint(org.eclipse.core.runtime.IExtensionPoint)

Example 12 with PartInitException

use of org.eclipse.ui.PartInitException in project tdi-studio-se by Talend.

the class EditPropertiesAction method getCorrespondingEditor.

/**
     * Find the editor that is related to the node.
     * 
     * @param node
     * @return
     */
protected IEditorPart getCorrespondingEditor(final IRepositoryNode node) {
    IEditorReference[] eidtors = getActivePage().getEditorReferences();
    for (IEditorReference eidtor : eidtors) {
        try {
            IEditorInput input = eidtor.getEditorInput();
            if (!(input instanceof RepositoryEditorInput)) {
                continue;
            }
            RepositoryEditorInput repositoryInput = (RepositoryEditorInput) input;
            if (node.getId() != null && node.getId().equals(repositoryInput.getId())) {
                IPath path = repositoryInput.getFile().getLocation();
                return eidtor.getEditor(false);
            }
        } catch (PartInitException e) {
            continue;
        }
    }
    return null;
}
Also used : IEditorReference(org.eclipse.ui.IEditorReference) RepositoryEditorInput(org.talend.core.repository.ui.editor.RepositoryEditorInput) IPath(org.eclipse.core.runtime.IPath) PartInitException(org.eclipse.ui.PartInitException) IEditorInput(org.eclipse.ui.IEditorInput)

Example 13 with PartInitException

use of org.eclipse.ui.PartInitException in project tdi-studio-se by Talend.

the class ShowJobSettingsViewAction method run.

/*
     * (non-Javadoc)
     * 
     * @see org.eclipse.jface.action.Action#run()
     */
public void run() {
    IWorkbench workbench = PlatformUI.getWorkbench();
    IWorkbenchPage page = workbench.getActiveWorkbenchWindow().getActivePage();
    try {
        page.showView(getViewId());
        JobSettingsView view = (JobSettingsView) page.findView(getViewId());
        IDiagramModelService service = CorePlugin.getDefault().getDiagramModelService();
        ISelection selection = service.getBusinessEditorSelection(page.getActiveEditor());
        if (selection instanceof IStructuredSelection) {
            Object firstElement = ((IStructuredSelection) selection).getFirstElement();
            if (firstElement != null) {
                BusinessType type = service.getBusinessModelType(firstElement);
                if (type == BusinessType.CONNECTION || type == BusinessType.NOTE || type == BusinessType.SHAP) {
                    view.refresh(false, firstElement);
                } else if (type == BusinessType.PROCESS || service.isInstanceOfCompartmentEditPart(firstElement)) {
                    view.refresh(false, PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor());
                }
            }
        }
    } catch (PartInitException e) {
        // e.printStackTrace();
        ExceptionHandler.process(e);
    }
}
Also used : IWorkbench(org.eclipse.ui.IWorkbench) JobSettingsView(org.talend.designer.core.ui.views.jobsettings.JobSettingsView) IDiagramModelService(org.talend.designer.business.diagram.custom.IDiagramModelService) ISelection(org.eclipse.jface.viewers.ISelection) BusinessType(org.talend.core.model.business.BusinessType) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) PartInitException(org.eclipse.ui.PartInitException)

Example 14 with PartInitException

use of org.eclipse.ui.PartInitException in project tdi-studio-se by Talend.

the class CreateSqlpatternAction method doRun.

/*
     * (non-Javadoc)
     * 
     * @see org.eclipse.jface.action.Action#run()
     */
@Override
protected void doRun() {
    RepositoryNode sqlPatternNode = null;
    if (!isFromSqlPatternComposite) {
        sqlPatternNode = getCurrentRepositoryNode();
    }
    if (isToolbar()) {
        if (sqlPatternNode != null && sqlPatternNode.getContentType() != ERepositoryObjectType.SQLPATTERNS) {
            sqlPatternNode = null;
        }
        if (sqlPatternNode == null) {
            sqlPatternNode = getRepositoryNodeForDefault(ERepositoryObjectType.SQLPATTERNS);
        }
    }
    RepositoryNode node = null;
    IPath path;
    if (this.sqlPatternPath != null) {
        path = new Path(this.sqlPatternPath);
    } else if (isToolbar()) {
        path = RepositoryNodeUtilities.getPath(sqlPatternNode);
    } else {
        ISelection selection = getSelection();
        Object obj = ((IStructuredSelection) selection).getFirstElement();
        node = (RepositoryNode) obj;
        path = RepositoryNodeUtilities.getPath(node);
    }
    NewSqlpatternWizard routineWizard = new NewSqlpatternWizard(path);
    WizardDialog dlg = new WizardDialog(Display.getCurrent().getActiveShell(), routineWizard);
    if (dlg.open() == Window.OK) {
        try {
            openSQLPatternEditor(routineWizard.getSQLPattern(), false);
        } catch (PartInitException e) {
            MessageBoxExceptionHandler.process(e);
        } catch (SystemException e) {
            MessageBoxExceptionHandler.process(e);
        }
    }
}
Also used : IPath(org.eclipse.core.runtime.IPath) Path(org.eclipse.core.runtime.Path) IPath(org.eclipse.core.runtime.IPath) SystemException(org.talend.commons.exception.SystemException) NewSqlpatternWizard(org.talend.repository.ui.wizards.sqlpattern.NewSqlpatternWizard) ISelection(org.eclipse.jface.viewers.ISelection) PartInitException(org.eclipse.ui.PartInitException) RepositoryNode(org.talend.repository.model.RepositoryNode) WizardDialog(org.eclipse.jface.wizard.WizardDialog)

Example 15 with PartInitException

use of org.eclipse.ui.PartInitException in project tdi-studio-se by Talend.

the class EditSqlpatternAction method doRun.

/*
     * (non-Javadoc)
     * 
     * @see org.eclipse.jface.action.Action#run()
     */
@Override
protected void doRun() {
    RepositoryNode node = (RepositoryNode) ((IStructuredSelection) getSelection()).getFirstElement();
    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
    // node.getObject().setProperty(updatedProperty);
    SQLPatternItem sqlPatternItem = (SQLPatternItem) node.getObject().getProperty().getItem();
    IProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
    boolean readonly = factory.getStatus(sqlPatternItem) == ERepositoryStatus.LOCK_BY_OTHER;
    try {
        openSQLPatternEditor(sqlPatternItem, readonly);
    // TDI-21143 : Studio repository view : remove all refresh call to repo view
    // IRepositoryView view = getViewPart();
    // if (view != null) {
    // view.refresh(node);
    // }
    } catch (PartInitException e) {
        MessageBoxExceptionHandler.process(e);
    } catch (SystemException e) {
        MessageBoxExceptionHandler.process(e);
    }
}
Also used : Project(org.talend.core.model.general.Project) SystemException(org.talend.commons.exception.SystemException) PersistenceException(org.talend.commons.exception.PersistenceException) SQLPatternItem(org.talend.core.model.properties.SQLPatternItem) PartInitException(org.eclipse.ui.PartInitException) RepositoryNode(org.talend.repository.model.RepositoryNode) Property(org.talend.core.model.properties.Property) IProxyRepositoryFactory(org.talend.repository.model.IProxyRepositoryFactory)

Aggregations

PartInitException (org.eclipse.ui.PartInitException)720 IWorkbenchPage (org.eclipse.ui.IWorkbenchPage)300 IWorkbenchWindow (org.eclipse.ui.IWorkbenchWindow)177 IFile (org.eclipse.core.resources.IFile)146 IEditorPart (org.eclipse.ui.IEditorPart)141 CoreException (org.eclipse.core.runtime.CoreException)94 FileEditorInput (org.eclipse.ui.part.FileEditorInput)88 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)82 IEditorInput (org.eclipse.ui.IEditorInput)74 ISelection (org.eclipse.jface.viewers.ISelection)62 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)60 IResource (org.eclipse.core.resources.IResource)59 IEditorReference (org.eclipse.ui.IEditorReference)53 IViewPart (org.eclipse.ui.IViewPart)53 IOException (java.io.IOException)42 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)41 Point (org.eclipse.swt.graphics.Point)40 IWorkbench (org.eclipse.ui.IWorkbench)40 Path (org.eclipse.core.runtime.Path)39 IWorkbenchPart (org.eclipse.ui.IWorkbenchPart)39