Search in sources :

Example 21 with IWorkbenchPage

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

the class DesignerCoreService method refreshComponentView.

@Override
public void refreshComponentView() {
    IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
    IViewPart view = page.findView(ComponentSettingsView.ID);
    if (view == null) {
        // don't do anything. before it made the view appear for nothing even in other product like DQ.
        return;
    }
    if (view != null && view instanceof ComponentSettingsView) {
        ComponentSettingsView settingView = (ComponentSettingsView) view;
        Element element = settingView.getElement();
        if (element != null) {
            settingView.cleanDisplay();
            settingView.setElement(element);
        }
    }
    List<ComponentSettingsView> otherViews = JobTemplateViewsAndProcessUtil.getInstance().getAllViews();
    if (otherViews == null || otherViews.isEmpty()) {
        return;
    }
    for (ComponentSettingsView v : otherViews) {
        if (v.getParent() != null && !v.getParent().isDisposed()) {
            Element elem = v.getElement();
            if (elem != null) {
                v.cleanDisplay();
                v.setElement(elem);
            }
        }
    }
}
Also used : IViewPart(org.eclipse.ui.IViewPart) Element(org.talend.core.model.process.Element) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) ComponentSettingsView(org.talend.designer.core.ui.views.properties.ComponentSettingsView)

Example 22 with IWorkbenchPage

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

the class ShowDesignerPageAction method run.

@Override
public void run() {
    IWorkbench workbench = PlatformUI.getWorkbench();
    IWorkbenchPage page = workbench.getActiveWorkbenchWindow().getActivePage();
    IEditorPart editorPart = page.getActiveEditor();
    if (editorPart instanceof MultiPageTalendEditor) {
        ((MultiPageTalendEditor) editorPart).showDesignerPage();
    }
}
Also used : IWorkbench(org.eclipse.ui.IWorkbench) MultiPageTalendEditor(org.talend.designer.core.ui.MultiPageTalendEditor) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) IEditorPart(org.eclipse.ui.IEditorPart)

Example 23 with IWorkbenchPage

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

the class ShowEditorPageAction method run.

@Override
public void run() {
    IWorkbench workbench = PlatformUI.getWorkbench();
    IWorkbenchPage page = workbench.getActiveWorkbenchWindow().getActivePage();
    IEditorPart editorPart = page.getActiveEditor();
    if (editorPart instanceof MultiPageTalendEditor) {
        ((MultiPageTalendEditor) editorPart).showCodePage();
    }
}
Also used : IWorkbench(org.eclipse.ui.IWorkbench) MultiPageTalendEditor(org.talend.designer.core.ui.MultiPageTalendEditor) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) IEditorPart(org.eclipse.ui.IEditorPart)

Example 24 with IWorkbenchPage

use of org.eclipse.ui.IWorkbenchPage 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 25 with IWorkbenchPage

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

the class JobletUtil method needReadOnlyJoblet.

public boolean needReadOnlyJoblet(JobletProcessItem jobletItem) {
    IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
    IEditorPart[] editors = page.getEditors();
    for (IEditorPart editor : editors) {
        if (editor instanceof AbstractMultiPageTalendEditor) {
            List<? extends INode> nodeList = ((AbstractMultiPageTalendEditor) editor).getProcess().getGraphicalNodes();
            for (INode node : nodeList) {
                if (((Node) node).isJoblet() && jobletItem.getProperty() != null) {
                    if (jobletItem.getProperty().getId().equals(node.getComponent().getProcess().getId())) {
                        boolean haveLock = jobletItem.getState().isLocked();
                        boolean isSvn = false;
                        ISVNProviderService service = null;
                        if (PluginChecker.isSVNProviderPluginLoaded()) {
                            service = (ISVNProviderService) GlobalServiceRegister.getDefault().getService(ISVNProviderService.class);
                        }
                        if (service != null && service.isProjectInSvnMode()) {
                            isSvn = service.isProjectInSvnMode();
                        }
                        if (isSvn) {
                            IProxyRepositoryService proxyService = (IProxyRepositoryService) GlobalServiceRegister.getDefault().getService(IProxyRepositoryService.class);
                            IProxyRepositoryFactory factory = proxyService.getProxyRepositoryFactory();
                            ERepositoryStatus repositoryStatus = factory.getStatus(jobletItem);
                            if (repositoryStatus == ERepositoryStatus.LOCK_BY_USER) {
                                haveLock = true;
                            }
                        }
                        if (haveLock) {
                            return true;
                        }
                    }
                }
            }
        }
    }
    return false;
}
Also used : INode(org.talend.core.model.process.INode) ERepositoryStatus(org.talend.commons.runtime.model.repository.ERepositoryStatus) AbstractMultiPageTalendEditor(org.talend.designer.core.ui.AbstractMultiPageTalendEditor) IProxyRepositoryService(org.talend.repository.model.IProxyRepositoryService) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) ISVNProviderService(org.talend.core.services.ISVNProviderService) IEditorPart(org.eclipse.ui.IEditorPart) IProxyRepositoryFactory(org.talend.repository.model.IProxyRepositoryFactory)

Aggregations

IWorkbenchPage (org.eclipse.ui.IWorkbenchPage)827 PartInitException (org.eclipse.ui.PartInitException)309 IWorkbenchWindow (org.eclipse.ui.IWorkbenchWindow)296 IEditorPart (org.eclipse.ui.IEditorPart)268 IFile (org.eclipse.core.resources.IFile)221 FileEditorInput (org.eclipse.ui.part.FileEditorInput)99 IViewPart (org.eclipse.ui.IViewPart)98 IWorkbench (org.eclipse.ui.IWorkbench)89 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)88 IEditorInput (org.eclipse.ui.IEditorInput)84 IEditorReference (org.eclipse.ui.IEditorReference)83 IResource (org.eclipse.core.resources.IResource)76 IWorkbenchPart (org.eclipse.ui.IWorkbenchPart)69 CoreException (org.eclipse.core.runtime.CoreException)66 ISelection (org.eclipse.jface.viewers.ISelection)64 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)60 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)59 IOException (java.io.IOException)57 ArrayList (java.util.ArrayList)56 IProject (org.eclipse.core.resources.IProject)51