Search in sources :

Example 56 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 57 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 58 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)

Example 59 with IWorkbench

use of org.eclipse.ui.IWorkbench in project bndtools by bndtools.

the class MissingWorkspaceMarkerResolutionGenerator method getResolutions.

@Override
public IMarkerResolution[] getResolutions(IMarker marker) {
    return new IMarkerResolution[] { new IMarkerResolution() {

        @Override
        public void run(IMarker marker) {
            IWorkbench workbench = PlatformUI.getWorkbench();
            IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
            WorkspaceSetupWizard wizard = new WorkspaceSetupWizard();
            wizard.init(workbench, StructuredSelection.EMPTY);
            WizardDialog dialog = new WizardDialog(window.getShell(), wizard);
            dialog.open();
        }

        @Override
        public String getLabel() {
            return "Open 'New Bnd OSGi Workspace' Wizard";
        }
    } };
}
Also used : IWorkbench(org.eclipse.ui.IWorkbench) IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) IMarkerResolution(org.eclipse.ui.IMarkerResolution) IMarker(org.eclipse.core.resources.IMarker) WizardDialog(org.eclipse.jface.wizard.WizardDialog)

Example 60 with IWorkbench

use of org.eclipse.ui.IWorkbench in project bndtools by bndtools.

the class WorkingSetTracker method doWorkingSets.

static void doWorkingSets(final Project model, final IProject targetProject) {
    IWorkbench workbench = PlatformUI.getWorkbench();
    final IWorkingSetManager workingSetManager = workbench.getWorkingSetManager();
    String mergeProperties = model.mergeProperties("-workingset");
    if (mergeProperties == null)
        return;
    Parameters memberShips = new Parameters(mergeProperties);
    IWorkingSet[] allWorkingSets = workingSetManager.getAllWorkingSets();
    for (IWorkingSet currentWorkingSet : allWorkingSets) {
        Attrs attrs = memberShips.remove(currentWorkingSet.getName());
        boolean shouldBeMember = attrs != null && Processor.isTrue(attrs.get("member", "true"));
        IAdaptable[] elements = currentWorkingSet.getElements();
        List<IAdaptable> members = new ExtList<>(elements);
        boolean foundProjectInCurrentWorkingSet = false;
        for (Iterator<IAdaptable> it = members.iterator(); it.hasNext(); ) {
            IAdaptable member = it.next();
            if (member.getAdapter(IProject.class) == targetProject) {
                foundProjectInCurrentWorkingSet = true;
                if (!shouldBeMember) {
                    it.remove();
                }
            }
        }
        if (!foundProjectInCurrentWorkingSet && shouldBeMember) {
            members.add(targetProject);
        }
        if (elements.length != members.size()) {
            updateWorkingSet(currentWorkingSet, members);
        }
    }
    for (final Entry<String, Attrs> e : memberShips.entrySet()) {
        String name = e.getKey();
        boolean isMember = Processor.isTrue(e.getValue().get("member", "true"));
        if (!isMember)
            continue;
        if (!JAVAID_P.matcher(name).matches()) {
            SetLocation error = model.warning("Invalid working set name '%s'. Must use pattern of Java identifier", name);
            error.file(model.getPropertiesFile().getAbsolutePath());
            error.header("-workingset");
            continue;
        }
        IAdaptable[] members = new IAdaptable[1];
        members[0] = targetProject;
        IWorkingSet newWorkingSet = workingSetManager.createWorkingSet(name, members);
        newWorkingSet.setId("org.eclipse.jdt.ui.JavaWorkingSetPage");
        newWorkingSet.setLabel(null);
        workingSetManager.addWorkingSet(newWorkingSet);
    }
}
Also used : IAdaptable(org.eclipse.core.runtime.IAdaptable) Parameters(aQute.bnd.header.Parameters) ExtList(aQute.lib.collections.ExtList) Attrs(aQute.bnd.header.Attrs) IProject(org.eclipse.core.resources.IProject) IWorkbench(org.eclipse.ui.IWorkbench) IWorkingSetManager(org.eclipse.ui.IWorkingSetManager) SetLocation(aQute.service.reporter.Reporter.SetLocation) IWorkingSet(org.eclipse.ui.IWorkingSet)

Aggregations

IWorkbench (org.eclipse.ui.IWorkbench)60 IWorkbenchWindow (org.eclipse.ui.IWorkbenchWindow)21 IWorkbenchPage (org.eclipse.ui.IWorkbenchPage)17 IEditorPart (org.eclipse.ui.IEditorPart)13 WizardDialog (org.eclipse.jface.wizard.WizardDialog)10 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)9 ISelection (org.eclipse.jface.viewers.ISelection)8 PartInitException (org.eclipse.ui.PartInitException)8 Display (org.eclipse.swt.widgets.Display)7 IProject (org.eclipse.core.resources.IProject)6 IResource (org.eclipse.core.resources.IResource)6 TreeViewer (org.eclipse.jface.viewers.TreeViewer)6 Shell (org.eclipse.swt.widgets.Shell)6 IEditorDescriptor (org.eclipse.ui.IEditorDescriptor)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 TaskExecutor (com.cubrid.common.ui.spi.progress.TaskExecutor)5 DatabaseInfo (com.cubrid.cubridmanager.core.cubrid.database.model.DatabaseInfo)5 IJavaProject (org.eclipse.jdt.core.IJavaProject)5