Search in sources :

Example 96 with IViewPart

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

the class EditPropertiesAction method doRun.

@Override
protected void doRun() {
    ISelection selection = getSelection();
    Object obj = ((IStructuredSelection) selection).getFirstElement();
    IRepositoryNode node = (IRepositoryNode) obj;
    // try {
    // ProxyRepositoryFactory.getInstance().initialize();
    // } catch (PersistenceException e1) {
    // ExceptionHandler.process(e1);
    // }
    IRepositoryViewObject object = node.getObject();
    IPath path = RepositoryNodeUtilities.getPath(node);
    String originalName = object.getLabel();
    final PropertiesWizard wizard;
    if (ERepositoryObjectType.ROUTINES == object.getRepositoryObjectType() || isInstanceofCamelBeans(object.getRepositoryObjectType())) {
        wizard = new EditRoutinePropertiesWizard(object, path, true);
    } else if (ERepositoryObjectType.PROCESS == object.getRepositoryObjectType()) {
        wizard = new EditProcessPropertiesWizard(object, path, true);
    } else {
        wizard = getPropertiesWizard(object, path);
    }
    WizardDialog dlg = new WizardDialog(Display.getCurrent().getActiveShell(), wizard);
    if (dlg.open() == Window.OK) {
        refresh(node);
        // refresh the corresponding editor's name
        IEditorPart part = getCorrespondingEditor(node);
        if (part != null && part instanceof IUIRefresher) {
            ((IUIRefresher) part).refreshName();
        } else {
            processRoutineRenameOperation(originalName, node, path);
        }
        // rename the job launch, for bug 8878
        IDesignerCoreService designerCoreService = RepositoryPlugin.getDefault().getDesignerCoreService();
        if (designerCoreService != null) {
            designerCoreService.renameJobLaunch(node.getObject(), originalName);
            // TDI-24863:reset the job problem list if rename the job item
            designerCoreService.resetJobProblemList(node.getObject(), originalName);
        }
        // refresh ...
        IViewPart jobSettingView = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().findView(IJobSettingsView.ID);
        if (jobSettingView != null && jobSettingView instanceof IJobSettingsView) {
            ((IJobSettingsView) jobSettingView).refreshCurrentViewTab();
        }
        if (node.getObjectType() == ERepositoryObjectType.ROUTINES) {
            RepositoryManager.syncRoutineAndJoblet(ERepositoryObjectType.ROUTINES);
            if (GlobalServiceRegister.getDefault().isServiceRegistered(IRunProcessService.class)) {
                IRunProcessService service = (IRunProcessService) GlobalServiceRegister.getDefault().getService(IRunProcessService.class);
                ITalendProcessJavaProject talendProcessJavaProject = service.getTalendProcessJavaProject();
                if (talendProcessJavaProject != null) {
                    talendProcessJavaProject.updateRoutinesPom(true, true);
                }
            }
        }
        if (node.getObjectType().getType().equals("SERVICES")) {
            //$NON-NLS-1$
            ConnectionItem connectionItem = (ConnectionItem) node.getObject().getProperty().getItem();
            RepositoryUpdateManager.updateServices(connectionItem);
            if (GlobalServiceRegister.getDefault().isServiceRegistered(IESBService.class)) {
                IESBService service = (IESBService) GlobalServiceRegister.getDefault().getService(IESBService.class);
                if (service != null) {
                    service.refreshComponentView(connectionItem);
                }
            }
        }
    }
}
Also used : IJobSettingsView(org.talend.repository.ui.views.IJobSettingsView) IViewPart(org.eclipse.ui.IViewPart) IRepositoryNode(org.talend.repository.model.IRepositoryNode) IPath(org.eclipse.core.runtime.IPath) EditRoutinePropertiesWizard(org.talend.repository.ui.wizards.routines.EditRoutinePropertiesWizard) ConnectionItem(org.talend.core.model.properties.ConnectionItem) IRunProcessService(org.talend.designer.runprocess.IRunProcessService) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) IEditorPart(org.eclipse.ui.IEditorPart) EditProcessPropertiesWizard(org.talend.metadata.managment.ui.wizard.process.EditProcessPropertiesWizard) ITalendProcessJavaProject(org.talend.core.runtime.process.ITalendProcessJavaProject) EditProcessPropertiesWizard(org.talend.metadata.managment.ui.wizard.process.EditProcessPropertiesWizard) EditRoutinePropertiesWizard(org.talend.repository.ui.wizards.routines.EditRoutinePropertiesWizard) PropertiesWizard(org.talend.metadata.managment.ui.wizard.PropertiesWizard) IESBService(org.talend.core.IESBService) ISelection(org.eclipse.jface.viewers.ISelection) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) IDesignerCoreService(org.talend.designer.core.IDesignerCoreService) WizardDialog(org.eclipse.jface.wizard.WizardDialog) IUIRefresher(org.talend.core.services.IUIRefresher)

Example 97 with IViewPart

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

the class ExternalNodeChangeCommand method refreshCodeView.

private void refreshCodeView() {
    IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
    IViewPart view = page.findView(CodeView.ID);
    if (view != null) {
        CodeView codeView = (CodeView) view;
        codeView.refresh();
    }
}
Also used : IViewPart(org.eclipse.ui.IViewPart) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) CodeView(org.talend.designer.core.ui.views.CodeView)

Example 98 with IViewPart

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

the class ContextModifyCommand method refreshContextView.

/**
     * qzhang Comment method "refreshContextView".
     */
private void refreshContextView() {
    IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
    IViewPart view2 = page.findView(ContextsView.CTX_ID_DESIGNER);
    if (view2 instanceof ContextsView) {
        ((ContextsView) view2).updateContextView(true, false);
    }
}
Also used : IViewPart(org.eclipse.ui.IViewPart) ContextsView(org.talend.designer.core.ui.views.contexts.ContextsView) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage)

Example 99 with IViewPart

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

the class JobSettings method getView.

/**
     * ggu Comment method "refreshView".
     */
private static JobSettingsView getView() {
    IWorkbench workbench = PlatformUI.getWorkbench();
    if (workbench == null) {
        return null;
    }
    IWorkbenchWindow benchWindow = workbench.getActiveWorkbenchWindow();
    if (benchWindow == null) {
        return null;
    }
    IWorkbenchPage page = benchWindow.getActivePage();
    if (page == null) {
        return null;
    }
    IViewPart view = page.findView(JobSettingsView.ID);
    if (view == null) {
        try {
        // view = page.showView(JobSettingsView.ID);
        } catch (Exception e) {
            ExceptionHandler.process(e);
        }
    }
    if (view != null && view instanceof JobSettingsView) {
        return (JobSettingsView) view;
    }
    return null;
}
Also used : IWorkbench(org.eclipse.ui.IWorkbench) IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) IViewPart(org.eclipse.ui.IViewPart) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage)

Example 100 with IViewPart

use of org.eclipse.ui.IViewPart in project linuxtools by eclipse.

the class ViewFactory method createView.

/**
 * Create a view of type designated by the viewID argument
 * @param viewID : A string corresponding to a type of View
 * @return : The view object that corresponds to the viewID
 */
public static SystemTapView createView(final String viewID) {
    Display.getDefault().syncExec(() -> {
        try {
            IViewPart view = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView(viewID);
            if (!(view instanceof SystemTapView)) {
                return;
            }
            newView = ((SystemTapView) view);
            newView.setViewID();
        } catch (PartInitException e) {
            e.printStackTrace();
        }
    });
    addView(newView);
    return newView;
}
Also used : IViewPart(org.eclipse.ui.IViewPart) PartInitException(org.eclipse.ui.PartInitException)

Aggregations

IViewPart (org.eclipse.ui.IViewPart)104 IWorkbenchPage (org.eclipse.ui.IWorkbenchPage)58 IWorkbenchWindow (org.eclipse.ui.IWorkbenchWindow)39 IEditorPart (org.eclipse.ui.IEditorPart)34 PartInitException (org.eclipse.ui.PartInitException)28 IViewReference (org.eclipse.ui.IViewReference)26 ArrayList (java.util.ArrayList)16 IFile (org.eclipse.core.resources.IFile)15 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)15 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)15 IEditorInput (org.eclipse.ui.IEditorInput)13 IWorkbenchPart (org.eclipse.ui.IWorkbenchPart)13 ICubridNode (com.cubrid.common.ui.spi.model.ICubridNode)10 IXliffEditor (net.heartsome.cat.ts.ui.editors.IXliffEditor)10 ITermViewPart (net.heartsome.cat.ts.ui.view.ITermViewPart)10 Shell (org.eclipse.swt.widgets.Shell)9 IEditorReference (org.eclipse.ui.IEditorReference)9 XLFHandler (net.heartsome.cat.ts.core.file.XLFHandler)8 XLIFFEditorImplWithNatTable (net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable)8 IProject (org.eclipse.core.resources.IProject)8