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));
}
}
}
}
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();
}
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;
}
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);
}
}
}
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());
}
Aggregations