Search in sources :

Example 76 with IWorkbench

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

the class ShowComponentSettingViewerAction 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());
    } catch (PartInitException e) {
        // TODO Auto-generated catch block
        // e.printStackTrace();
        ExceptionHandler.process(e);
    }
}
Also used : IWorkbench(org.eclipse.ui.IWorkbench) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) PartInitException(org.eclipse.ui.PartInitException)

Example 77 with IWorkbench

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

the class ShowJobSettingsViewAction method isEnabled.

@Override
public boolean isEnabled() {
    IWorkbench workbench = PlatformUI.getWorkbench();
    IWorkbenchPage page = workbench.getActiveWorkbenchWindow().getActivePage();
    ISelection selection = CorePlugin.getDefault().getDiagramModelService().getBusinessEditorSelection(page.getActiveEditor());
    if (selection instanceof IStructuredSelection) {
        Object obj = ((IStructuredSelection) selection).getFirstElement();
        if (obj != null) {
            return true;
        }
    }
    return false;
}
Also used : IWorkbench(org.eclipse.ui.IWorkbench) ISelection(org.eclipse.jface.viewers.ISelection) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection)

Example 78 with IWorkbench

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

the class GenericRepositoryContentHandler method newSchemaWizard.

@Override
public IWizard newSchemaWizard(IWorkbench workbench, boolean creation, IRepositoryViewObject object, MetadataTable metadataTable, String[] existingNames, boolean forceReadOnly) {
    if (object == null) {
        return null;
    }
    IWorkbench wb = workbench;
    if (wb == null) {
        wb = PlatformUI.getWorkbench();
    }
    MetadataTable table = metadataTable;
    if (table == null && object instanceof MetadataTableRepositoryObject) {
        MetadataTableRepositoryObject metaTableRepObj = (MetadataTableRepositoryObject) object;
        table = metaTableRepObj.getTable();
    }
    if (table == null) {
        return null;
    }
    ConnectionItem connectionItem = (ConnectionItem) object.getProperty().getItem();
    table = SchemaUtils.getMetadataTable(connectionItem.getConnection(), table.getLabel(), table.eContainer().getClass());
    return new GenericSchemaWizard(wb, creation, object, connectionItem, table, forceReadOnly);
}
Also used : IWorkbench(org.eclipse.ui.IWorkbench) GenericConnectionItem(org.talend.repository.generic.model.genericMetadata.GenericConnectionItem) ConnectionItem(org.talend.core.model.properties.ConnectionItem) GenericSchemaWizard(org.talend.repository.generic.ui.GenericSchemaWizard) MetadataTable(org.talend.core.model.metadata.builder.connection.MetadataTable) MetadataTableRepositoryObject(org.talend.core.repository.model.repositoryObject.MetadataTableRepositoryObject)

Example 79 with IWorkbench

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

the class BindingActions method registerActions.

/**
     * DOC smallet Comment method "registerActions".
     */
private void registerActions() {
    IContextService contextService = (IContextService) PlatformUI.getWorkbench().getAdapter(IContextService.class);
    //$NON-NLS-1$
    contextService.activateContext("talend.global");
    IWorkbench workbench = PlatformUI.getWorkbench();
    IHandlerService handlerService = (IHandlerService) workbench.getService(IHandlerService.class);
    IHandler handler;
    for (IAction action : actions) {
        handler = new ActionHandler(action);
        handlerService.activateHandler(action.getActionDefinitionId(), handler);
    }
}
Also used : IWorkbench(org.eclipse.ui.IWorkbench) IHandlerService(org.eclipse.ui.handlers.IHandlerService) IAction(org.eclipse.jface.action.IAction) IHandler(org.eclipse.core.commands.IHandler) IContextService(org.eclipse.ui.contexts.IContextService) ActionHandler(org.eclipse.jface.commands.ActionHandler)

Example 80 with IWorkbench

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

the class BootTalendAction method run.

public void run(IAction action) {
    IWorkbench workbench = PlatformUI.getWorkbench();
    if (store.getInt(LOGIN_COUNTER) > 1) {
        boolean openConfirm = MessageDialog.openConfirm(Display.getDefault().getActiveShell(), "Confirm", "Are you want to switch to another project");
        if (!openConfirm) {
            return;
        }
    // workbench.restart();
    }
    int counter = store.getInt(LOGIN_COUNTER);
    store.setValue(LOGIN_COUNTER, ++counter);
    IWorkbenchWindow activeWorkbenchWindow = workbench.getActiveWorkbenchWindow();
    if (activeWorkbenchWindow == null) {
        return;
    }
    IWorkbenchPage activePage = activeWorkbenchWindow.getActivePage();
    if (activePage == null) {
        return;
    }
    IPerspectiveDescriptor pDescriptor = activePage.getPerspective();
    if (!pDescriptor.getId().equals(TALEND_PERSPECTIVE_ID)) {
        pDescriptor = getPerspective(TALEND_PERSPECTIVE_ID);
        activePage.setPerspective(pDescriptor);
    }
    SwitchProjectAction switchAction = new SwitchProjectAction();
    switchAction.run();
    return;
}
Also used : IWorkbench(org.eclipse.ui.IWorkbench) IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) IPerspectiveDescriptor(org.eclipse.ui.IPerspectiveDescriptor)

Aggregations

IWorkbench (org.eclipse.ui.IWorkbench)105 IWorkbenchPage (org.eclipse.ui.IWorkbenchPage)32 IWorkbenchWindow (org.eclipse.ui.IWorkbenchWindow)31 IEditorPart (org.eclipse.ui.IEditorPart)21 PartInitException (org.eclipse.ui.PartInitException)20 WizardDialog (org.eclipse.jface.wizard.WizardDialog)15 CoreException (org.eclipse.core.runtime.CoreException)12 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)12 Shell (org.eclipse.swt.widgets.Shell)11 IResource (org.eclipse.core.resources.IResource)9 ISelection (org.eclipse.jface.viewers.ISelection)9 Display (org.eclipse.swt.widgets.Display)8 ArrayList (java.util.ArrayList)7 IFile (org.eclipse.core.resources.IFile)7 IEditorDescriptor (org.eclipse.ui.IEditorDescriptor)7 IProject (org.eclipse.core.resources.IProject)6 TreeViewer (org.eclipse.jface.viewers.TreeViewer)6 TableEditorInput (com.cubrid.common.ui.cubrid.table.editor.TableEditorInput)5 ICubridNode (com.cubrid.common.ui.spi.model.ICubridNode)5 ExecTaskWithProgress (com.cubrid.common.ui.spi.progress.ExecTaskWithProgress)5