Search in sources :

Example 1 with ConfigurableContentOutlinePage

use of org.eclipse.wst.sse.ui.internal.contentoutline.ConfigurableContentOutlinePage in project webtools.sourceediting by eclipse.

the class CustomFilterHandler method execute.

public Object execute(ExecutionEvent event) throws ExecutionException {
    IEditorPart editor = HandlerUtil.getActiveEditor(event);
    Object page = editor.getAdapter(IContentOutlinePage.class);
    if (page instanceof ConfigurableContentOutlinePage) {
        ((ConfigurableContentOutlinePage) page).getOutlineFilterProcessor().openDialog();
    }
    return null;
}
Also used : ConfigurableContentOutlinePage(org.eclipse.wst.sse.ui.internal.contentoutline.ConfigurableContentOutlinePage) IEditorPart(org.eclipse.ui.IEditorPart)

Example 2 with ConfigurableContentOutlinePage

use of org.eclipse.wst.sse.ui.internal.contentoutline.ConfigurableContentOutlinePage in project webtools.sourceediting by eclipse.

the class StructuredTextEditor method update.

/**
 * Update should be called whenever the model is set or changed (as in
 * swapped)
 * <p>
 * Not API. May be removed in the future.
 * </p>
 */
public void update() {
    if (fOutlinePage != null && fOutlinePage instanceof ConfigurableContentOutlinePage) {
        ContentOutlineConfiguration cfg = createContentOutlineConfiguration();
        ((ConfigurableContentOutlinePage) fOutlinePage).setConfiguration(cfg);
        IStructuredModel internalModel = getInternalModel();
        ((ConfigurableContentOutlinePage) fOutlinePage).setInputContentTypeIdentifier(internalModel == null ? null : internalModel.getContentTypeIdentifier());
        ((ConfigurableContentOutlinePage) fOutlinePage).setInput(internalModel);
    }
    if (fPropertySheetPage != null && fPropertySheetPage instanceof ConfigurablePropertySheetPage) {
        PropertySheetConfiguration cfg = createPropertySheetConfiguration();
        ((ConfigurablePropertySheetPage) fPropertySheetPage).setConfiguration(cfg);
    }
    disposeModelDependentFields();
    fShowInTargetIds = createShowInTargetIds();
    if (getSourceViewerConfiguration() instanceof StructuredTextViewerConfiguration && fStatusLineLabelProvider != null) {
        fStatusLineLabelProvider.dispose();
    }
    String configurationId = fViewerConfigurationTargetId;
    updateSourceViewerConfiguration();
    /* Only reinstall if the configuration id has changed */
    if (configurationId != null && !configurationId.equals(fViewerConfigurationTargetId)) {
        uninstallSemanticHighlighting();
        installSemanticHighlighting();
    }
    if (getSourceViewerConfiguration() instanceof StructuredTextViewerConfiguration) {
        fStatusLineLabelProvider = ((StructuredTextViewerConfiguration) getSourceViewerConfiguration()).getStatusLineLabelProvider(getSourceViewer());
        updateStatusLine(null);
    }
    if (fEncodingSupport != null && fEncodingSupport instanceof EncodingSupport) {
        ((EncodingSupport) fEncodingSupport).reinitialize(getConfigurationPoints());
    }
    createModelDependentFields();
}
Also used : ConfigurableContentOutlinePage(org.eclipse.wst.sse.ui.internal.contentoutline.ConfigurableContentOutlinePage) ConfigurablePropertySheetPage(org.eclipse.wst.sse.ui.internal.properties.ConfigurablePropertySheetPage) IStructuredModel(org.eclipse.wst.sse.core.internal.provisional.IStructuredModel) PropertySheetConfiguration(org.eclipse.wst.sse.ui.views.properties.PropertySheetConfiguration) ContentOutlineConfiguration(org.eclipse.wst.sse.ui.views.contentoutline.ContentOutlineConfiguration)

Example 3 with ConfigurableContentOutlinePage

use of org.eclipse.wst.sse.ui.internal.contentoutline.ConfigurableContentOutlinePage in project webtools.sourceediting by eclipse.

the class StructuredTextEditor method dispose.

/*
	 * (non-Javadoc)
	 * 
	 * @see org.eclipse.ui.IWorkbenchPart#dispose()
	 */
public void dispose() {
    // $NON-NLS-1$ //$NON-NLS-2$
    Logger.trace("Source Editor", "StructuredTextEditor::dispose entry");
    if (org.eclipse.wst.sse.core.internal.util.Debug.perfTestAdapterClassLoading) {
        // $NON-NLS-1$
        System.out.println("Total calls to getAdapter: " + adapterRequests);
        // $NON-NLS-1$
        System.out.println("Total time in getAdapter: " + adapterTime);
        // $NON-NLS-1$
        System.out.println("Average time per call: " + (adapterTime / adapterRequests));
    }
    ISourceViewer viewer = getSourceViewer();
    if (viewer instanceof ITextViewerExtension)
        ((ITextViewerExtension) viewer).removeVerifyKeyListener(fPairInserter);
    // dispose of information presenter
    if (fInformationPresenter != null) {
        fInformationPresenter.dispose();
        fInformationPresenter = null;
    }
    if (fOutlineHandler != null) {
        fOutlineHandler.dispose();
        fOutlineHandler = null;
    }
    // dispose of selection history
    if (fSelectionHistory != null) {
        fSelectionHistory.dispose();
        fSelectionHistory = null;
    }
    if (fProjectionSupport != null) {
        fProjectionSupport.dispose();
        fProjectionSupport = null;
    }
    if (fFoldingGroup != null) {
        fFoldingGroup.dispose();
        fFoldingGroup = null;
    }
    // dispose of menus that were being tracked
    if (fTextContextMenu != null) {
        fTextContextMenu.dispose();
        fTextContextMenu = null;
    }
    if (fRulerContextMenu != null) {
        fRulerContextMenu.dispose();
        fRulerContextMenu = null;
    }
    if (fTextContextMenuManager != null) {
        fTextContextMenuManager.removeMenuListener(getContextMenuListener());
        fTextContextMenuManager.removeAll();
        fTextContextMenuManager.dispose();
    }
    if (fRulerContextMenuManager != null) {
        fRulerContextMenuManager.removeMenuListener(getContextMenuListener());
        fRulerContextMenuManager.removeAll();
        fRulerContextMenuManager.dispose();
    }
    // less severe.
    if (fStructuredModel != null) {
        fStructuredModel.removeModelStateListener(getInternalModelStateListener());
    // fStructuredModel.setStructuredDocument(null);
    /* BUG398460 - Editor is still marked dirty when relaunching editor after closing without saving changes */
    // fStructuredModel = null;
    }
    // to document, so nothing to remove
    if (getDocumentProvider() != null) {
        IDocument doc = getDocumentProvider().getDocument(getEditorInput());
        if (doc != null) {
            if (doc instanceof IExecutionDelegatable) {
                ((IExecutionDelegatable) doc).setExecutionDelegate(null);
            }
        }
    }
    // up after themselves
    if (fOutlinePage != null) {
        if (fOutlinePage instanceof ConfigurableContentOutlinePage && fOutlinePageListener != null) {
            ((ConfigurableContentOutlinePage) fOutlinePage).removeDoubleClickListener(fOutlinePageListener);
        }
        if (fOutlinePageListener != null) {
            fOutlinePage.removeSelectionChangedListener(fOutlinePageListener);
            fOutlinePageListener = null;
        }
        fOutlinePage = null;
    }
    fEditorDisposed = true;
    disposeModelDependentFields();
    if (fDropTarget != null)
        fDropTarget.dispose();
    if (fPartListener != null) {
        getSite().getWorkbenchWindow().getPartService().removePartListener(fPartListener);
        fPartListener = null;
    }
    uninstallSemanticHighlighting();
    if (fPairInserter != null) {
        fPairInserter.dispose();
        fPairInserter = null;
    }
    setPreferenceStore(null);
    /*
		 * Strictly speaking, but following null outs should not be needed,
		 * but in the event of a memory leak, they make the memory leak less
		 * severe
		 */
    fDropAdapter = null;
    fDropTarget = null;
    if (fStructuredSelectionProvider != null) {
        fStructuredSelectionProvider.dispose();
        fStructuredSelectionProvider = null;
    }
    if (fStatusLineLabelProvider != null) {
        fStatusLineLabelProvider.dispose();
        fStatusLineLabelProvider = null;
    }
    setStatusLineMessage(null);
    super.dispose();
    // $NON-NLS-1$ //$NON-NLS-2$
    Logger.trace("Source Editor", "StructuredTextEditor::dispose exit");
}
Also used : ITextViewerExtension(org.eclipse.jface.text.ITextViewerExtension) ConfigurableContentOutlinePage(org.eclipse.wst.sse.ui.internal.contentoutline.ConfigurableContentOutlinePage) IExecutionDelegatable(org.eclipse.wst.sse.core.internal.text.IExecutionDelegatable) ISourceViewer(org.eclipse.jface.text.source.ISourceViewer) IDocument(org.eclipse.jface.text.IDocument)

Example 4 with ConfigurableContentOutlinePage

use of org.eclipse.wst.sse.ui.internal.contentoutline.ConfigurableContentOutlinePage in project webtools.sourceediting by eclipse.

the class StructuredTextEditor method getAdapter.

/*
	 * (non-Javadoc)
	 * 
	 * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
	 */
public Object getAdapter(Class required) {
    if (org.eclipse.wst.sse.core.internal.util.Debug.perfTestAdapterClassLoading) {
        startPerfTime = System.currentTimeMillis();
    }
    Object result = null;
    // text editor
    IStructuredModel internalModel = getInternalModel();
    if (ITextEditor.class.equals(required) || ITextEditorExtension5.class.equals(required) || ITextEditorExtension4.class.equals(required) || ITextEditorExtension3.class.equals(required) || ITextEditorExtension2.class.equals(required) || ITextEditorExtension.class.equals(required)) {
        result = this;
    } else if (IWorkbenchSiteProgressService.class.equals(required)) {
        return getEditorPart().getSite().getAdapter(IWorkbenchSiteProgressService.class);
    } else // content outline page
    if (IContentOutlinePage.class.equals(required)) {
        if (fOutlinePage == null && !fEditorDisposed) {
            ContentOutlineConfiguration cfg = createContentOutlineConfiguration();
            if (cfg != null) {
                ConfigurableContentOutlinePage outlinePage = new ConfigurableContentOutlinePage();
                outlinePage.setConfiguration(cfg);
                if (internalModel != null) {
                    outlinePage.setInputContentTypeIdentifier(internalModel.getContentTypeIdentifier());
                    outlinePage.setInput(internalModel);
                }
                if (fOutlinePageListener == null) {
                    fOutlinePageListener = new OutlinePageListener();
                }
                outlinePage.addSelectionChangedListener(fOutlinePageListener);
                outlinePage.addDoubleClickListener(fOutlinePageListener);
                fOutlinePage = outlinePage;
            }
        }
        result = fOutlinePage;
    } else // property sheet page, but only if the input's editable
    if (IPropertySheetPage.class.equals(required) && isEditable()) {
        if (fPropertySheetPage == null || fPropertySheetPage.getControl() == null || fPropertySheetPage.getControl().isDisposed()) {
            PropertySheetConfiguration cfg = createPropertySheetConfiguration();
            if (cfg != null) {
                ConfigurablePropertySheetPage propertySheetPage = new ConfigurablePropertySheetPage();
                propertySheetPage.setConfiguration(cfg);
                fPropertySheetPage = propertySheetPage;
            }
        }
        result = fPropertySheetPage;
    } else if (IDocument.class.equals(required)) {
        result = getDocumentProvider().getDocument(getEditorInput());
    } else if (ISourceEditingTextTools.class.equals(required)) {
        result = createSourceEditingTextTools();
    } else if (IToggleBreakpointsTarget.class.equals(required)) {
        result = ToggleBreakpointsTarget.getInstance();
    } else if (ITextEditorExtension4.class.equals(required)) {
        result = this;
    } else if (IShowInTargetList.class.equals(required)) {
        result = new ShowInTargetListAdapter();
    } else if (IVerticalRuler.class.equals(required)) {
        return getVerticalRuler();
    } else if (SelectionHistory.class.equals(required)) {
        if (fSelectionHistory == null)
            fSelectionHistory = new SelectionHistory(this);
        result = fSelectionHistory;
    } else if (IResource.class.equals(required)) {
        IEditorInput input = getEditorInput();
        if (input != null) {
            result = input.getAdapter(required);
        }
    } else {
        if (result == null && internalModel != null) {
            result = internalModel.getAdapter(required);
        }
        // others
        if (result == null)
            result = super.getAdapter(required);
    }
    if (result == null) {
    // Logger.log(Logger.INFO_DEBUG, "StructuredTextEditor.getAdapter returning null for " + required); //$NON-NLS-1$
    }
    if (org.eclipse.wst.sse.core.internal.util.Debug.perfTestAdapterClassLoading) {
        long stop = System.currentTimeMillis();
        adapterRequests++;
        adapterTime += (stop - startPerfTime);
    }
    if (org.eclipse.wst.sse.core.internal.util.Debug.perfTestAdapterClassLoading) {
        // $NON-NLS-1$
        System.out.println("Total calls to getAdapter: " + adapterRequests);
        // $NON-NLS-1$
        System.out.println("Total time in getAdapter: " + adapterTime);
        // $NON-NLS-1$
        System.out.println("Average time per call: " + (adapterTime / adapterRequests));
    }
    return result;
}
Also used : ITextEditor(org.eclipse.ui.texteditor.ITextEditor) ITextEditorExtension5(org.eclipse.ui.texteditor.ITextEditorExtension5) ITextEditorExtension4(org.eclipse.ui.texteditor.ITextEditorExtension4) ITextEditorExtension3(org.eclipse.ui.texteditor.ITextEditorExtension3) IVerticalRuler(org.eclipse.jface.text.source.IVerticalRuler) PropertySheetConfiguration(org.eclipse.wst.sse.ui.views.properties.PropertySheetConfiguration) ContentOutlineConfiguration(org.eclipse.wst.sse.ui.views.contentoutline.ContentOutlineConfiguration) ConfigurableContentOutlinePage(org.eclipse.wst.sse.ui.internal.contentoutline.ConfigurableContentOutlinePage) ConfigurablePropertySheetPage(org.eclipse.wst.sse.ui.internal.properties.ConfigurablePropertySheetPage) IWorkbenchSiteProgressService(org.eclipse.ui.progress.IWorkbenchSiteProgressService) ITextEditorExtension(org.eclipse.ui.texteditor.ITextEditorExtension) ISourceEditingTextTools(org.eclipse.wst.sse.ui.internal.provisional.extensions.ISourceEditingTextTools) IStructuredModel(org.eclipse.wst.sse.core.internal.provisional.IStructuredModel) IResource(org.eclipse.core.resources.IResource) IEditorInput(org.eclipse.ui.IEditorInput) SelectionHistory(org.eclipse.wst.sse.ui.internal.selection.SelectionHistory)

Aggregations

ConfigurableContentOutlinePage (org.eclipse.wst.sse.ui.internal.contentoutline.ConfigurableContentOutlinePage)4 IStructuredModel (org.eclipse.wst.sse.core.internal.provisional.IStructuredModel)2 ConfigurablePropertySheetPage (org.eclipse.wst.sse.ui.internal.properties.ConfigurablePropertySheetPage)2 ContentOutlineConfiguration (org.eclipse.wst.sse.ui.views.contentoutline.ContentOutlineConfiguration)2 PropertySheetConfiguration (org.eclipse.wst.sse.ui.views.properties.PropertySheetConfiguration)2 IResource (org.eclipse.core.resources.IResource)1 IDocument (org.eclipse.jface.text.IDocument)1 ITextViewerExtension (org.eclipse.jface.text.ITextViewerExtension)1 ISourceViewer (org.eclipse.jface.text.source.ISourceViewer)1 IVerticalRuler (org.eclipse.jface.text.source.IVerticalRuler)1 IEditorInput (org.eclipse.ui.IEditorInput)1 IEditorPart (org.eclipse.ui.IEditorPart)1 IWorkbenchSiteProgressService (org.eclipse.ui.progress.IWorkbenchSiteProgressService)1 ITextEditor (org.eclipse.ui.texteditor.ITextEditor)1 ITextEditorExtension (org.eclipse.ui.texteditor.ITextEditorExtension)1 ITextEditorExtension3 (org.eclipse.ui.texteditor.ITextEditorExtension3)1 ITextEditorExtension4 (org.eclipse.ui.texteditor.ITextEditorExtension4)1 ITextEditorExtension5 (org.eclipse.ui.texteditor.ITextEditorExtension5)1 IExecutionDelegatable (org.eclipse.wst.sse.core.internal.text.IExecutionDelegatable)1 ISourceEditingTextTools (org.eclipse.wst.sse.ui.internal.provisional.extensions.ISourceEditingTextTools)1