use of org.eclipse.jface.action.IStatusLineManager in project InformationSystem by ObeoNetwork.
the class InteractionEditor method getContentOutlinePage.
/**
* This accesses a cached version of the content outliner.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public IContentOutlinePage getContentOutlinePage() {
if (contentOutlinePage == null) {
//
class MyContentOutlinePage extends ContentOutlinePage {
@Override
public void createControl(Composite parent) {
super.createControl(parent);
contentOutlineViewer = getTreeViewer();
contentOutlineViewer.addSelectionChangedListener(this);
// Set up the tree viewer.
//
contentOutlineViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));
contentOutlineViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
contentOutlineViewer.setInput(editingDomain.getResourceSet());
// Make sure our popups work.
//
createContextMenuFor(contentOutlineViewer);
if (!editingDomain.getResourceSet().getResources().isEmpty()) {
// Select the root object in the view.
//
contentOutlineViewer.setSelection(new StructuredSelection(editingDomain.getResourceSet().getResources().get(0)), true);
}
}
@Override
public void makeContributions(IMenuManager menuManager, IToolBarManager toolBarManager, IStatusLineManager statusLineManager) {
super.makeContributions(menuManager, toolBarManager, statusLineManager);
contentOutlineStatusLineManager = statusLineManager;
}
@Override
public void setActionBars(IActionBars actionBars) {
super.setActionBars(actionBars);
getActionBarContributor().shareGlobalActions(this, actionBars);
}
}
contentOutlinePage = new MyContentOutlinePage();
// Listen to selection so that we can handle it is a special way.
//
contentOutlinePage.addSelectionChangedListener(new ISelectionChangedListener() {
// This ensures that we handle selections correctly.
//
public void selectionChanged(SelectionChangedEvent event) {
handleContentOutlineSelection(event.getSelection());
}
});
}
return contentOutlinePage;
}
use of org.eclipse.jface.action.IStatusLineManager in project gemoc-studio by eclipse.
the class FsmEditor method getContentOutlinePage.
/**
* This accesses a cached version of the content outliner.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public IContentOutlinePage getContentOutlinePage() {
if (contentOutlinePage == null) {
//
class MyContentOutlinePage extends ContentOutlinePage {
@Override
public void createControl(Composite parent) {
super.createControl(parent);
contentOutlineViewer = getTreeViewer();
contentOutlineViewer.addSelectionChangedListener(this);
// Set up the tree viewer.
//
contentOutlineViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));
contentOutlineViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
contentOutlineViewer.setInput(editingDomain.getResourceSet());
// Make sure our popups work.
//
createContextMenuFor(contentOutlineViewer);
if (!editingDomain.getResourceSet().getResources().isEmpty()) {
// Select the root object in the view.
//
contentOutlineViewer.setSelection(new StructuredSelection(editingDomain.getResourceSet().getResources().get(0)), true);
}
}
@Override
public void makeContributions(IMenuManager menuManager, IToolBarManager toolBarManager, IStatusLineManager statusLineManager) {
super.makeContributions(menuManager, toolBarManager, statusLineManager);
contentOutlineStatusLineManager = statusLineManager;
}
@Override
public void setActionBars(IActionBars actionBars) {
super.setActionBars(actionBars);
getActionBarContributor().shareGlobalActions(this, actionBars);
}
}
contentOutlinePage = new MyContentOutlinePage();
// Listen to selection so that we can handle it is a special way.
//
contentOutlinePage.addSelectionChangedListener(new ISelectionChangedListener() {
// This ensures that we handle selections correctly.
//
public void selectionChanged(SelectionChangedEvent event) {
handleContentOutlineSelection(event.getSelection());
}
});
}
return contentOutlinePage;
}
use of org.eclipse.jface.action.IStatusLineManager in project gemoc-studio by eclipse.
the class GexpressionsEditor method getContentOutlinePage.
/**
* This accesses a cached version of the content outliner.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public IContentOutlinePage getContentOutlinePage() {
if (contentOutlinePage == null) {
//
class MyContentOutlinePage extends ContentOutlinePage {
@Override
public void createControl(Composite parent) {
super.createControl(parent);
contentOutlineViewer = getTreeViewer();
contentOutlineViewer.addSelectionChangedListener(this);
// Set up the tree viewer.
//
contentOutlineViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));
contentOutlineViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
contentOutlineViewer.setInput(editingDomain.getResourceSet());
// Make sure our popups work.
//
createContextMenuFor(contentOutlineViewer);
if (!editingDomain.getResourceSet().getResources().isEmpty()) {
// Select the root object in the view.
//
contentOutlineViewer.setSelection(new StructuredSelection(editingDomain.getResourceSet().getResources().get(0)), true);
}
}
@Override
public void makeContributions(IMenuManager menuManager, IToolBarManager toolBarManager, IStatusLineManager statusLineManager) {
super.makeContributions(menuManager, toolBarManager, statusLineManager);
contentOutlineStatusLineManager = statusLineManager;
}
@Override
public void setActionBars(IActionBars actionBars) {
super.setActionBars(actionBars);
getActionBarContributor().shareGlobalActions(this, actionBars);
}
}
contentOutlinePage = new MyContentOutlinePage();
// Listen to selection so that we can handle it is a special way.
//
contentOutlinePage.addSelectionChangedListener(new ISelectionChangedListener() {
// This ensures that we handle selections correctly.
//
public void selectionChanged(SelectionChangedEvent event) {
handleContentOutlineSelection(event.getSelection());
}
});
}
return contentOutlinePage;
}
use of org.eclipse.jface.action.IStatusLineManager in project titan.EclipsePlug-ins by eclipse.
the class MinimizeScopeActionFromEditor method findSelection.
private Definition findSelection() {
// getting the active editor
final IEditorPart editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
TTCN3Editor targetEditor;
if (editor == null || !(editor instanceof TTCN3Editor)) {
return null;
} else {
targetEditor = (TTCN3Editor) editor;
}
final IStatusLineManager statusLineManager = targetEditor.getEditorSite().getActionBars().getStatusLineManager();
// getting current selection
final ISelectionService selectionService = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService();
final TextSelection textSelection = extractSelection(selectionService.getSelection());
// iterating through part of the module
final IResource selectedRes = extractResource(targetEditor);
if (!(selectedRes instanceof IFile)) {
ErrorReporter.logError("SelectionFinder.findSelection(): Selected resource `" + selectedRes.getName() + "' is not a file.");
return null;
}
final IFile selectedFile = (IFile) selectedRes;
final ProjectSourceParser projectSourceParser = GlobalParser.getProjectSourceParser(selectedFile.getProject());
final Module selectedModule = projectSourceParser.containedModule(selectedFile);
// getting current selection nodes
final int selectionOffset = textSelection.getOffset() + textSelection.getLength();
final SelectionFinderVisitor selVisitor = new SelectionFinderVisitor(selectionOffset);
selectedModule.accept(selVisitor);
final Definition selectedDef = selVisitor.getSelection();
if (selectedDef == null) {
ErrorReporter.logWarning("SelectionFinder.findSelection(): Visitor did not find a definition in the selection.");
statusLineManager.setErrorMessage(ERR_MSG_NO_SELECTION);
return null;
}
return selectedDef;
}
use of org.eclipse.jface.action.IStatusLineManager in project webtools.servertools by eclipse.
the class ServerEditorActionBarContributor method setActiveEditor.
/**
* Sets the active editor for the contributor.
* <p>
* The <code>EditorActionBarContributor</code> implementation of this method does
* nothing. Subclasses may reimplement. This generally entails disconnecting
* from the old editor, connecting to the new editor, and updating the actions
* to reflect the new editor.
* </p>
*
* @param targetEditor the new target editor
*/
public void setActiveEditor(IEditorPart targetEditor) {
super.setActiveEditor(targetEditor);
if (targetEditor != null && targetEditor.equals(editor))
return;
IActionBars actionBars = getActionBars();
boolean actionBarsUpdated = false;
if (editor != null) {
editor.setStatus(null, null);
IStatusLineManager status = actionBars.getStatusLineManager();
status.removeAll();
IToolBarManager tbm = actionBars.getToolBarManager();
tbm.removeAll();
actionBarsUpdated = true;
}
if (targetEditor instanceof ServerEditor) {
editor = (ServerEditor) targetEditor;
if (Trace.FINEST) {
Trace.trace(Trace.STRING_FINEST, "Editor action bar contributor for: " + editor);
}
editor.updateUndoAction();
editor.updateRedoAction();
actionBars.setGlobalActionHandler(ActionFactory.UNDO.getId(), editor.getUndoAction());
actionBars.setGlobalActionHandler(ActionFactory.REDO.getId(), editor.getRedoAction());
actionBars.setGlobalActionHandler(ActionFactory.COPY.getId(), editor.getCopyAction());
actionBars.setGlobalActionHandler(ActionFactory.CUT.getId(), editor.getCutAction());
actionBars.setGlobalActionHandler(ActionFactory.PASTE.getId(), editor.getPasteAction());
IStatusLineManager status = actionBars.getStatusLineManager();
StatusLineContributionItem item = new StatusLineContributionItem("id");
status.add(item);
editor.setStatus(status, item);
editor.updateStatusLine();
IAction[] actions = editor.getEditorActions();
IToolBarManager tbm = actionBars.getToolBarManager();
tbm.add(new Separator(SERVER_EDITOR_SEPARATOR));
boolean modified = false;
if (actions != null) {
int size = actions.length;
if (Trace.FINEST) {
Trace.trace(Trace.STRING_FINEST, "Attempting to add editor actions: " + size);
}
for (int i = 0; i < size; i++) {
if (Trace.FINEST) {
Trace.trace(Trace.STRING_FINEST, "action: " + actions[i]);
}
tbm.appendToGroup(SERVER_EDITOR_SEPARATOR, actions[i]);
modified = true;
}
}
if (modified)
tbm.update(false);
actionBarsUpdated = true;
} else
editor = null;
if (actionBarsUpdated)
actionBars.updateActionBars();
}
Aggregations