Search in sources :

Example 26 with IStatusLineManager

use of org.eclipse.jface.action.IStatusLineManager in project webtools.sourceediting by eclipse.

the class GotoAnnotationAction method gotoAnnotation.

/**
 * Jumps to the error next according to the given direction based off
 * JavaEditor#gotoAnnotation()
 *
 * @param forward
 *            is the direction
 */
public void gotoAnnotation(boolean forward) {
    ITextSelection selection = (ITextSelection) getTextEditor().getSelectionProvider().getSelection();
    Position position = new Position(0, 0);
    if (false) /* delayed - see bug 18316 */
    {
        getNextAnnotation(selection.getOffset(), selection.getLength(), forward, position);
        getTextEditor().selectAndReveal(position.getOffset(), position.getLength());
    } else /* no delay - see bug 18316 */
    {
        Annotation annotation = getNextAnnotation(selection.getOffset(), selection.getLength(), forward, position);
        IEditorStatusLine editorStatusLine = getTextEditor().getAdapter(IEditorStatusLine.class);
        if (editorStatusLine != null) {
            editorStatusLine.setMessage(true, null, null);
            editorStatusLine.setMessage(false, null, null);
        } else {
            IStatusLineManager mgr = getStatusLineManager();
            if (mgr != null) {
                mgr.setErrorMessage(null);
                mgr.setMessage(null, null);
            }
        }
        if (annotation != null) {
            updateAnnotationViews(annotation);
            if (_debug) {
                // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
                System.out.println("select and reveal " + annotation.getType() + "@" + position.getOffset() + ":" + position.getLength());
            }
            getTextEditor().selectAndReveal(position.getOffset(), position.getLength());
            if (editorStatusLine != null) {
                editorStatusLine.setMessage(true, null, null);
                editorStatusLine.setMessage(false, annotation.getText(), null);
            } else {
                IStatusLineManager mgr = getStatusLineManager();
                if (mgr != null) {
                    mgr.setErrorMessage(null);
                    mgr.setMessage(null, annotation.getText());
                }
                getTextEditor().getSelectionProvider().addSelectionChangedListener(new StatusLineClearer(mgr));
            }
        }
    }
}
Also used : Position(org.eclipse.jface.text.Position) IStatusLineManager(org.eclipse.jface.action.IStatusLineManager) ITextSelection(org.eclipse.jface.text.ITextSelection) Annotation(org.eclipse.jface.text.source.Annotation) SimpleMarkerAnnotation(org.eclipse.ui.texteditor.SimpleMarkerAnnotation) IEditorStatusLine(org.eclipse.ui.texteditor.IEditorStatusLine)

Example 27 with IStatusLineManager

use of org.eclipse.jface.action.IStatusLineManager in project webtools.sourceediting by eclipse.

the class ConfigurableContentOutlinePage method dispose.

public void dispose() {
    getSite().getWorkbenchWindow().getSelectionService().removePostSelectionListener(getSelectionServiceListener());
    if (fDoubleClickProvider != null) {
        getTreeViewer().removeDoubleClickListener(fDoubleClickProvider);
    }
    // dispose menu controls
    if (fContextMenu != null) {
        fContextMenu.dispose();
    }
    if (fContextMenuManager != null) {
        fContextMenuManager.removeMenuListener(fGroupAdder);
        fContextMenuManager.removeAll();
        fContextMenuManager.dispose();
    }
    fDropTarget.dispose();
    fDragSource.dispose();
    IStatusLineManager statusLineManager = getSite().getActionBars().getStatusLineManager();
    if (statusLineManager != null) {
        statusLineManager.setMessage(null);
    }
    unconfigure();
    super.dispose();
}
Also used : IStatusLineManager(org.eclipse.jface.action.IStatusLineManager)

Example 28 with IStatusLineManager

use of org.eclipse.jface.action.IStatusLineManager in project webtools.sourceediting by eclipse.

the class PlatformStatusLineUtil method _displayTemporaryMessage.

static boolean _displayTemporaryMessage(ITextViewer viewer, String msg, boolean isError) {
    boolean messageShown = false;
    IEditorPart editor = getActiveEditor();
    if (editor != null) {
        ITextEditor textEditor = editor.getAdapter(ITextEditor.class);
        if (textEditor != null && textEditor instanceof StructuredTextEditor) {
            if (((StructuredTextEditor) textEditor).getTextViewer() == viewer) {
                IStatusLineManager statusLineManager = editor.getEditorSite().getActionBars().getStatusLineManager();
                if (isError)
                    statusLineManager.setErrorMessage(msg);
                else
                    statusLineManager.setMessage(msg);
                new OneTimeListener(viewer.getTextWidget(), new ClearStatusLine(statusLineManager, isError));
                messageShown = true;
            }
        }
    }
    if (!messageShown) {
        displayErrorMessage(msg);
        addOneTimeClearListener();
    }
    return messageShown;
}
Also used : ITextEditor(org.eclipse.ui.texteditor.ITextEditor) IStatusLineManager(org.eclipse.jface.action.IStatusLineManager) IEditorPart(org.eclipse.ui.IEditorPart) StructuredTextEditor(org.eclipse.wst.sse.ui.StructuredTextEditor)

Example 29 with IStatusLineManager

use of org.eclipse.jface.action.IStatusLineManager in project webtools.sourceediting by eclipse.

the class XMLMultiPageEditorPart method updateStatusLine.

void updateStatusLine(ISelection selection) {
    IStatusLineManager statusLineManager = getEditorSite().getActionBars().getStatusLineManager();
    if (fStatusLineLabelProvider != null && statusLineManager != null) {
        String text = null;
        Image image = null;
        if (selection instanceof IStructuredSelection && !selection.isEmpty()) {
            Object firstElement = ((IStructuredSelection) selection).getFirstElement();
            if (firstElement != null) {
                text = fStatusLineLabelProvider.getText(firstElement);
                image = fStatusLineLabelProvider.getImage((firstElement));
            }
        }
        if (image == null) {
            statusLineManager.setMessage(text);
        } else {
            statusLineManager.setMessage(image, text);
        }
    }
}
Also used : IStatusLineManager(org.eclipse.jface.action.IStatusLineManager) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) Image(org.eclipse.swt.graphics.Image)

Example 30 with IStatusLineManager

use of org.eclipse.jface.action.IStatusLineManager in project lwjgl by LWJGL.

the class LWJGLTestView method createPartControl.

/**
 * {@inheritDoc}
 * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
 */
@Override
public void createPartControl(Composite parent) {
    String strVersion = getFeatureVersion("org.lwjgl");
    this.setPartName("org.lwjgl " + strVersion);
    IStatusLineManager statusLine = this.getViewSite().getActionBars().getStatusLineManager();
    fpsstatuslineitem = new FpsStatusLineItem();
    statusLine.add(fpsstatuslineitem);
    GLData data = new GLData();
    data.doubleBuffer = true;
    canvas = new GLCanvas(parent, SWT.NONE, data);
    canvas.setCurrent();
    try {
        GLContext.useContext(canvas);
    } catch (LWJGLException e) {
        e.printStackTrace();
    }
    canvas.addListener(SWT.Resize, new Listener() {

        public void handleEvent(Event event) {
            Rectangle bounds = canvas.getBounds();
            float fAspect = (float) bounds.width / (float) bounds.height;
            canvas.setCurrent();
            try {
                GLContext.useContext(canvas);
            } catch (LWJGLException e) {
                e.printStackTrace();
            }
            GL11.glViewport(0, 0, bounds.width, bounds.height);
            GL11.glMatrixMode(GL11.GL_PROJECTION);
            GL11.glLoadIdentity();
            GLU.gluPerspective(45.0f, fAspect, 0.5f, 400.0f);
            GL11.glMatrixMode(GL11.GL_MODELVIEW);
            GL11.glLoadIdentity();
        }
    });
    GL11.glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
    GL11.glColor3f(1.0f, 0.0f, 0.0f);
    GL11.glHint(GL11.GL_PERSPECTIVE_CORRECTION_HINT, GL11.GL_NICEST);
    GL11.glClearDepth(1.0);
    GL11.glLineWidth(2);
    GL11.glEnable(GL11.GL_DEPTH_TEST);
    Display.getCurrent().asyncExec(initRunnable());
}
Also used : GLCanvas(org.eclipse.swt.opengl.GLCanvas) Listener(org.eclipse.swt.widgets.Listener) IStatusLineManager(org.eclipse.jface.action.IStatusLineManager) GLData(org.eclipse.swt.opengl.GLData) Rectangle(org.eclipse.swt.graphics.Rectangle) Event(org.eclipse.swt.widgets.Event) LWJGLException(org.lwjgl.LWJGLException)

Aggregations

IStatusLineManager (org.eclipse.jface.action.IStatusLineManager)68 IToolBarManager (org.eclipse.jface.action.IToolBarManager)33 IActionBars (org.eclipse.ui.IActionBars)33 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)32 ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)31 SelectionChangedEvent (org.eclipse.jface.viewers.SelectionChangedEvent)31 AdapterFactoryContentProvider (org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider)30 AdapterFactoryLabelProvider (org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider)30 IMenuManager (org.eclipse.jface.action.IMenuManager)30 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)30 Composite (org.eclipse.swt.widgets.Composite)30 ContentOutlinePage (org.eclipse.ui.views.contentoutline.ContentOutlinePage)30 IContentOutlinePage (org.eclipse.ui.views.contentoutline.IContentOutlinePage)30 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)7 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)5 ArrayList (java.util.ArrayList)4 IContributionItem (org.eclipse.jface.action.IContributionItem)4 IFile (org.eclipse.core.resources.IFile)3 IAction (org.eclipse.jface.action.IAction)3 StatusLineContributionItem (org.eclipse.jface.action.StatusLineContributionItem)3