Search in sources :

Example 86 with IWorkbench

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

the class ExportServiceAction method doRun.

@Override
protected void doRun() {
    try {
        if (!isAllOperationsAssignedJob(serviceItem)) {
            boolean isContinue = MessageDialog.openQuestion(shell, Messages.ExportServiceAction_noJobDialogTitle, Messages.ExportServiceAction_noJobDialogMsg);
            if (!isContinue) {
                return;
            }
        }
    } catch (PersistenceException e) {
        ExceptionHandler.process(e);
    }
    ServiceExportWizard processWizard = new ServiceExportWizard(serviceItem);
    IWorkbench workbench = getWorkbench();
    processWizard.setWindowTitle(EXPORT_SERVICE_LABEL);
    WizardDialog dialog = new WizardDialog(shell, processWizard);
    workbench.saveAllEditors(true);
    dialog.open();
}
Also used : ServiceExportWizard(org.talend.repository.services.ui.ServiceExportWizard) IWorkbench(org.eclipse.ui.IWorkbench) PersistenceException(org.talend.commons.exception.PersistenceException) WizardDialog(org.eclipse.jface.wizard.WizardDialog)

Example 87 with IWorkbench

use of org.eclipse.ui.IWorkbench 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 88 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)

Example 89 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 90 with IWorkbench

use of org.eclipse.ui.IWorkbench in project Palladio-Editors-Sirius by PalladioSimulator.

the class NewPalladioProjectWizard method getCurrentPerspectiveId.

private String getCurrentPerspectiveId() {
    IWorkbench workbench = PlatformUI.getWorkbench();
    IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
    IWorkbenchPage page = window.getActivePage();
    IPerspectiveDescriptor perspective = page.getPerspective();
    return perspective.getId();
}
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