Search in sources :

Example 26 with IEditorSite

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

the class BndEditor method init.

@Override
public void init(IEditorSite site, IEditorInput input) throws PartInitException {
    super.init(site, input);
    try {
        // Work out our input file and subscribe to resource changes
        this.inputResource = ResourceUtil.getResource(input);
        inputResource.getWorkspace().addResourceChangeListener(this);
        inputFile = inputResource.getLocation().toFile();
        model.setBndResourceName(inputResource.getName());
        // Initialize pages and title
        initPages(site, input);
        setSourcePage(sourcePage);
        setPartNameForInput(input);
        IDocumentProvider docProvider = sourcePage.getDocumentProvider();
        // #1625: Ensure the IDocumentProvider is not null.
        if (docProvider != null) {
            docProvider.addElementStateListener(new ElementStateListener());
            if (!Central.hasWorkspaceDirectory()) {
                // default ws will be created we can load immediately
                modelReady = loadEditModel();
            } else {
                // a real ws will be resolved so we need to load async
                modelReady = Central.onWorkspace(workspace -> loadEditModel());
            }
        } else {
            modelReady = Central.promiseFactory().failed(new Exception("Model unavailable"));
        }
        setupActions();
    } catch (Exception e1) {
        throw Exceptions.duck(e1);
    }
}
Also used : TestSuitesPage(bndtools.editor.pages.TestSuitesPage) ErrorDialog(org.eclipse.jface.dialogs.ErrorDialog) ResourceUtil(org.eclipse.ui.ide.ResourceUtil) Deferred(org.osgi.util.promise.Deferred) IFormPage(org.eclipse.ui.forms.editor.IFormPage) IStatus(org.eclipse.core.runtime.IStatus) ExtendedFormEditor(org.bndtools.core.ui.ExtendedFormEditor) IPath(org.eclipse.core.runtime.IPath) PartInitException(org.eclipse.ui.PartInitException) BadLocationException(aQute.bnd.properties.BadLocationException) Map(java.util.Map) BundleContentPage(bndtools.editor.pages.BundleContentPage) MessageDialog(org.eclipse.jface.dialogs.MessageDialog) BndEditModel(aQute.bnd.build.model.BndEditModel) IEditorInput(org.eclipse.ui.IEditorInput) PlatformUI(org.eclipse.ui.PlatformUI) Central(bndtools.central.Central) ResolutionResult(org.bndtools.core.resolve.ResolutionResult) Status(org.eclipse.core.runtime.Status) SWTConcurrencyUtil(org.bndtools.utils.swt.SWTConcurrencyUtil) Display(org.eclipse.swt.widgets.Display) IManagedForm(org.eclipse.ui.forms.IManagedForm) IContentOutlinePage(org.eclipse.ui.views.contentoutline.IContentOutlinePage) IResourceChangeEvent(org.eclipse.core.resources.IResourceChangeEvent) IJobChangeEvent(org.eclipse.core.runtime.jobs.IJobChangeEvent) Promise(org.osgi.util.promise.Promise) ProjectRunPage(bndtools.editor.pages.ProjectRunPage) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) IHandlerService(org.eclipse.ui.handlers.IHandlerService) List(java.util.List) Window(org.eclipse.jface.window.Window) WizardDialog(org.eclipse.jface.wizard.WizardDialog) LaunchConstants(bndtools.launch.LaunchConstants) Entry(java.util.Map.Entry) IResourceChangeListener(org.eclipse.core.resources.IResourceChangeListener) IHandlerActivation(org.eclipse.ui.handlers.IHandlerActivation) IElementStateListener(org.eclipse.ui.texteditor.IElementStateListener) AbstractHandler(org.eclipse.core.commands.AbstractHandler) ExecutionEvent(org.eclipse.core.commands.ExecutionEvent) ResourcesPlugin(org.eclipse.core.resources.ResourcesPlugin) Exceptions(aQute.lib.exceptions.Exceptions) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) Image(org.eclipse.swt.graphics.Image) BndPreferences(bndtools.preferences.BndPreferences) HashMap(java.util.HashMap) Mode(bndtools.launch.util.LaunchUtils.Mode) IEditorSite(org.eclipse.ui.IEditorSite) JobUtil(org.bndtools.core.jobs.JobUtil) ArrayList(java.util.ArrayList) IFileEditorInput(org.eclipse.ui.IFileEditorInput) LinkedHashMap(java.util.LinkedHashMap) IMessageProvider(org.eclipse.jface.dialogs.IMessageProvider) ResolveMode(org.bndtools.api.ResolveMode) IDocument(org.eclipse.jface.text.IDocument) ResolutionWizard(org.bndtools.core.resolve.ui.ResolutionWizard) Workspace(aQute.bnd.build.Workspace) Plugin(bndtools.Plugin) IResourceDelta(org.eclipse.core.resources.IResourceDelta) IConfigurationElement(org.eclipse.core.runtime.IConfigurationElement) LaunchUtils(bndtools.launch.util.LaunchUtils) AbstractUIPlugin(org.eclipse.ui.plugin.AbstractUIPlugin) IFile(org.eclipse.core.resources.IFile) LinkedList(java.util.LinkedList) JobChangeAdapter(org.eclipse.core.runtime.jobs.JobChangeAdapter) ILogger(org.bndtools.api.ILogger) IFormPageFactory(org.bndtools.core.ui.IFormPageFactory) FileEditorInput(org.eclipse.ui.part.FileEditorInput) IDocumentProvider(org.eclipse.ui.texteditor.IDocumentProvider) Shell(org.eclipse.swt.widgets.Shell) Project(aQute.bnd.build.Project) Pair(bndtools.types.Pair) Job(org.eclipse.core.runtime.jobs.Job) IFormPart(org.eclipse.ui.forms.IFormPart) IDocumentWrapper(bndtools.editor.model.IDocumentWrapper) IOException(java.io.IOException) ExecutionException(org.eclipse.core.commands.ExecutionException) Run(aQute.bnd.build.Run) File(java.io.File) ProjectBuildPage(bndtools.editor.pages.ProjectBuildPage) BndConstants(bndtools.BndConstants) ScrolledForm(org.eclipse.ui.forms.widgets.ScrolledForm) ResolveJob(org.bndtools.core.resolve.ResolveJob) NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) UIJob(org.eclipse.ui.progress.UIJob) IResource(org.eclipse.core.resources.IResource) Platform(org.eclipse.core.runtime.Platform) BundleDescriptionPage(bndtools.editor.pages.BundleDescriptionPage) WorkspacePage(bndtools.editor.pages.WorkspacePage) Logger(org.bndtools.api.Logger) IPriority(bndtools.editor.common.IPriority) Control(org.eclipse.swt.widgets.Control) IDocumentProvider(org.eclipse.ui.texteditor.IDocumentProvider) IElementStateListener(org.eclipse.ui.texteditor.IElementStateListener) PartInitException(org.eclipse.ui.PartInitException) BadLocationException(aQute.bnd.properties.BadLocationException) IOException(java.io.IOException) ExecutionException(org.eclipse.core.commands.ExecutionException)

Aggregations

IEditorSite (org.eclipse.ui.IEditorSite)26 IWorkbenchPartSite (org.eclipse.ui.IWorkbenchPartSite)7 List (java.util.List)5 Control (org.eclipse.swt.widgets.Control)5 IEditorPart (org.eclipse.ui.IEditorPart)5 PartInitException (org.eclipse.ui.PartInitException)5 IDocumentProvider (org.eclipse.ui.texteditor.IDocumentProvider)5 ITextEditor (org.eclipse.ui.texteditor.ITextEditor)5 InputStream (java.io.InputStream)4 ArrayList (java.util.ArrayList)4 StyledText (org.eclipse.swt.custom.StyledText)4 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)4 SelectionEvent (org.eclipse.swt.events.SelectionEvent)4 FillLayout (org.eclipse.swt.layout.FillLayout)4 GridData (org.eclipse.swt.layout.GridData)4 Composite (org.eclipse.swt.widgets.Composite)4 IWorkbenchWindow (org.eclipse.ui.IWorkbenchWindow)4 DBPDataSource (org.jkiss.dbeaver.model.DBPDataSource)4 DBPDataSourceContainer (org.jkiss.dbeaver.model.DBPDataSourceContainer)4 DBPIdentifierCase (org.jkiss.dbeaver.model.DBPIdentifierCase)4