[542588] Fix CCE starting ValidityView
diff --git a/examples/org.eclipse.ocl.examples.emf.validation.validity.ui/src/org/eclipse/ocl/examples/emf/validation/validity/ui/view/ValidityView.java b/examples/org.eclipse.ocl.examples.emf.validation.validity.ui/src/org/eclipse/ocl/examples/emf/validation/validity/ui/view/ValidityView.java
index d9ad134..d7af684 100644
--- a/examples/org.eclipse.ocl.examples.emf.validation.validity.ui/src/org/eclipse/ocl/examples/emf/validation/validity/ui/view/ValidityView.java
+++ b/examples/org.eclipse.ocl.examples.emf.validation.validity.ui/src/org/eclipse/ocl/examples/emf/validation/validity/ui/view/ValidityView.java
@@ -113,7 +113,7 @@
/**
* The ValidityView provides a dual view of ValidatableNode model elements and
- * ConstrainingNode model classes to browse, filter and control model validation.
+ * ConstrainingNode model classes to browse, filter and control model validation.
*/
public class ValidityView extends ViewPart implements ISelectionListener
{
@@ -237,51 +237,51 @@
protected FilteredCheckboxTree filteredValidatableNodesTree;
protected FilteredCheckboxTree filteredConstrainingNodesTree;
-
+
private final @NonNull ValidityViewRefreshJob refreshJob = new ValidityViewRefreshJob();
protected final @NonNull IDEValidityManager validityManager;
-
+
/** Keeps a reference to the toolkit used to create our form. */
private FormToolkit formToolkit;
-
+
/** Form that will contain the Validity View itself. */
private Form validityViewForm;
-
+
/** Allows us to display error/warning messages directly on the form. */
private FormMessageManager messageManager;
/** Form that will contain the Validatable column View. */
private SashForm validateableElementsForm;
-
+
/** Form that will contain the Constraining column View. */
private SashForm constrainingElementsForm;
-
+
/** We'll create this {@link SashForm} as the main body of the Validity view form. */
private SashForm formBody;
-
+
/**
* Keeps a reference to the "validateable Elements" section of the Validity view form.
*/
private Section validatableNodesSection;
-
+
/** The message key. */
private final String messageKey = "ValidityViewMessageKey";
/** Kept as an instance member, this will allow us to set unique identifiers to the status messages. */
private int messageCount;
-
+
/**
* Keeps a reference to the "constraining Nodes" section of the Validity view form.
*/
private Section constrainingNodesSection;
-
+
protected ResourceSet modelResourceSet;
-
+
/**Context Menu.*/
private ShowElementInEditorAction showValidatableElementInEditorAction;
private ShowElementInEditorAction showConstrainingElementInEditorAction;
-
+
/**Local Tool Bar.*/
private Action expandAllNodesAction;
private Action collapseAllNodesAction;
@@ -342,7 +342,7 @@
private void contributeToActionBars() {
IToolBarManager toolBarManager = getForm().getToolBarManager();
fillLocalToolBar(toolBarManager);
-
+
// validatable Column
ToolBarManager validatableSectionToolBarManager = createSectionToolBar(validatableNodesSection);
fillValidatableColumnToolBar(validatableSectionToolBarManager);
@@ -354,7 +354,7 @@
/**
* Creates a tool bar for the given section.
- *
+ *
* @param section
* The section for which we need a tool bar.
* @return The created tool bar.
@@ -367,6 +367,7 @@
toolBar.setCursor(handCursor);
// Cursor needs to be explicitly disposed
toolBar.addDisposeListener(new DisposeListener() {
+ @Override
public void widgetDisposed(DisposeEvent e) {
if (!handCursor.isDisposed()) {
handCursor.dispose();
@@ -378,14 +379,15 @@
toolBar.setData(toolBarManager);
// Do not keep a reference to the manager when we dispose the tool bar
toolBar.addDisposeListener(new DisposeListener() {
+ @Override
public void widgetDisposed(DisposeEvent e) {
toolBar.setData(null);
}
});
-
+
return toolBarManager;
}
-
+
/**
* This is a callback that will allow us
* to create the viewer and initialize it.
@@ -393,26 +395,13 @@
@Override
public void createPartControl(Composite parent) {
Composite sash = new SashForm(parent, SWT.HORIZONTAL);
- {
- GridLayout layout = new GridLayout();
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- layout.verticalSpacing = 0;
- layout.horizontalSpacing = 0;
- sash.setLayout(layout);
- GridData gridData = new GridData(GridData.FILL_BOTH);
- gridData.horizontalIndent = 1;
- sash.setLayoutData(gridData);
- }
-
formToolkit = new FormToolkit(sash.getDisplay());
-
createValidityViewForm(formToolkit, sash);
}
-
+
/**
* This will be called in order to create the actual body of the validity view, the "Validity" form.
- *
+ *
* @param toolkit
* Toolkit that can be used to create the form.
* @param parent
@@ -428,15 +417,15 @@
IContentProvider constrainingNodeContentProvider = new ConstrainingNodeContentProvider(validityManager);
ICheckStateProvider nodeCheckStateProvider = new NodeCheckStateProvider();
ILabelProvider nodeDecoratingLabelProvider = new DecoratingNodeLabelProvider(nodeLabelProvider);
-
+
validityViewForm = toolkit.createForm(parent);
messageManager = new FormMessageManager(getForm());
messageManager.setDecorationPosition(SWT.LEFT | SWT.TOP);
toolkit.decorateFormHeading(getForm());
-
+
getForm().setText(ValidityUIMessages.ValidityView_viewTitle);
messageManager.addMessage(messageKey + messageCount++, ValidityUIMessages.ValidityView_Messages_NoSelection, IStatus.WARNING, getForm());
-
+
Composite mainBody = getForm().getBody();
mainBody.setLayout(new GridLayout());
formBody = new SashForm(mainBody, SWT.HORIZONTAL | SWT.SMOOTH);
@@ -448,7 +437,7 @@
validatableNodesSection = toolkit.createSection(validateableElementsForm, ExpandableComposite.TITLE_BAR);
validatableNodesSection.setText(ValidityUIMessages.ValidityView_validatableNodesSectionName);
-
+
CheckboxTreeViewer validatableNodesViewer;
{
Composite validatableNodesSectionBody = toolkit.createComposite(validatableNodesSection);
@@ -464,24 +453,24 @@
gridData.grabExcessVerticalSpace = true;
validatableNodesSectionBody.setLayoutData(gridData);
}
-
+
PatternFilter filter = new PatternFilter();
filteredValidatableNodesTree = new FilteredCheckboxTree(validatableNodesSectionBody, SWT.CHECK | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.VIRTUAL, filter);
filteredValidatableNodesTree.disableTextWidget();
filteredValidatableNodesTree.getViewer().setUseHashlookup(true);
-
+
GridData gridData = new GridData(GridData.FILL_BOTH);
gridData.grabExcessHorizontalSpace = true;
gridData.grabExcessVerticalSpace = true;
filteredValidatableNodesTree.setLayoutData(gridData);
-
+
validatableNodesViewer = getValidatableNodesViewer();
validatableNodesViewer.getControl().setLayoutData(gridData);
-
+
toolkit.paintBordersFor(validatableNodesSectionBody);
validatableNodesSection.setClient(validatableNodesSectionBody);
}
-
+
constrainingElementsForm = new SashForm(formBody, SWT.VERTICAL | SWT.SMOOTH);
toolkit.adapt(constrainingElementsForm);
@@ -503,20 +492,20 @@
gridData.grabExcessVerticalSpace = true;
constrainingNodesSectionBody.setLayoutData(gridData);
}
-
+
PatternFilter filter = new PatternFilter();
filteredConstrainingNodesTree = new FilteredCheckboxTree(constrainingNodesSectionBody, SWT.CHECK | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.VIRTUAL, filter);
filteredConstrainingNodesTree.disableTextWidget();
filteredConstrainingNodesTree.getViewer().setUseHashlookup(true);
-
+
GridData gridData = new GridData(GridData.FILL_BOTH);
gridData.grabExcessHorizontalSpace = true;
gridData.grabExcessVerticalSpace = true;
filteredConstrainingNodesTree.setLayoutData(gridData);
-
+
constrainingNodesViewer = getConstrainingNodesViewer();
constrainingNodesViewer.getControl().setLayoutData(gridData);
-
+
toolkit.paintBordersFor(constrainingNodesSectionBody);
constrainingNodesSection.setClient(constrainingNodesSectionBody);
}
@@ -526,26 +515,26 @@
validatableNodesViewer.setCheckStateProvider(nodeCheckStateProvider);
validatableNodesViewer.addCheckStateListener(nodeCheckStateListener);
// validatableNodesViewer.addFilter(validatableNodesFilterByKind);
-
+
constrainingNodesViewer.setContentProvider(constrainingNodeContentProvider);
constrainingNodesViewer.setLabelProvider(nodeDecoratingLabelProvider);
constrainingNodesViewer.setCheckStateProvider(nodeCheckStateProvider);
constrainingNodesViewer.addCheckStateListener(nodeCheckStateListener);
// constrainingNodesViewer.addFilter(constrainingNodesFilterByKind);
-
+
formBody.setWeights(new int[] {1, 1, });
-
+
// Create the help context id for the viewer's control
makeActions();
hookContextMenu();
hookConstrainingNodesDoubleClickAction();
hookValidatableNodesDoubleClickAction();
contributeToActionBars();
-
+
IWorkbenchPage page = getSite().getPage();
assert page != null;
- ISelectionService service = (ISelectionService) getSite().getService(ISelectionService.class);
+ ISelectionService service = getSite().getService(ISelectionService.class);
if (service != null) {
IEditorPart activeEditor = page.getActiveEditor();
service.addSelectionListener(this);
@@ -560,13 +549,13 @@
}
refreshJob.initViewers(this, validatableNodesViewer, constrainingNodesViewer);
Dialog.applyDialogFont(parent);
-
+
ColumnViewerToolTipSupport.enableFor(validatableNodesViewer);
ColumnViewerToolTipSupport.enableFor(constrainingNodesViewer);
}
/**
- * Return the most recent selection as IResource, if it can be converted possibly by resolving the Resource of an EObject.
+ * Return the most recent selection as IResource, if it can be converted possibly by resolving the Resource of an EObject.
*/
public @Nullable IResource getSelectedResource() {
Object selection = null;
@@ -604,19 +593,19 @@
}
return selection instanceof IResource ? (IResource)selection : null;
}
-
+
/**
* Returns the validity view form.
- *
+ *
* @return The validity view form.
*/
protected Form getForm() {
return validityViewForm;
}
-
+
@Override
public void dispose() {
- ISelectionService service = (ISelectionService) getSite().getService(ISelectionService.class);
+ ISelectionService service = getSite().getService(ISelectionService.class);
if (service != null) {
service.removeSelectionListener(this);
}
@@ -624,7 +613,7 @@
filteredConstrainingNodesTree.dispose();
super.dispose();
}
-
+
private void fillConstrainingColumnToolBar(IContributionManager manager) {
manager.add(expandAllConstrainingNodesAction);
manager.add(collapseAllConstrainingNodesAction);
@@ -636,7 +625,7 @@
manager.update(true);
}
-
+
private void fillConstrainingContextMenu(@NonNull IContributionManager manager) {
manager.add(expandAllConstrainingNodesAction);
manager.add(collapseAllConstrainingNodesAction);
@@ -646,7 +635,7 @@
manager.add(disableAllConstrainingNodesAction);
manager.add(new Separator());
manager.add(disableAllUnusedConstrainingNodesAction);
-
+
// Other plug-ins can contribute there actions here
manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
manager.add(new Separator());
@@ -693,7 +682,7 @@
manager.add(disableAllValidatableNodesAction);
manager.add(new Separator());
manager.add(disableAllUnusedValidatableNodesAction);
-
+
// Other plug-ins can contribute their actions here
manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
manager.add(new Separator());
@@ -705,7 +694,7 @@
/**
* gets the Constraining Nodes Viewer
- *
+ *
* @return the constrainingNodesViewer
*/
public @NonNull CheckboxTreeViewer getConstrainingNodesViewer(){
@@ -714,19 +703,19 @@
assert viewer != null;
return viewer;
}
-
+
/**
* gets the Validity Manager
- *
+ *
* @return the validityManager
*/
public @NonNull IDEValidityManager getValidityManager(){
return validityManager;
}
-
+
/**
* gets the validatable Nodes Viewer
- *
+ *
* @return the validatableNodesViewer
*/
public @NonNull CheckboxTreeViewer getValidatableNodesViewer(){
@@ -741,6 +730,7 @@
MenuManager menuMgrValidatable = new MenuManager("#PopupMenu");//$NON-NLS-1$
menuMgrValidatable.setRemoveAllWhenShown(true);
menuMgrValidatable.addMenuListener(new IMenuListener() {
+ @Override
public void menuAboutToShow(IMenuManager manager) {
@SuppressWarnings("null")@NonNull IMenuManager manager2 = manager;
ValidityView.this.fillValidatableContextMenu(manager2);
@@ -754,6 +744,7 @@
MenuManager menuMgrConstraining = new MenuManager("#PopupMenu");//$NON-NLS-1$
menuMgrConstraining.setRemoveAllWhenShown(true);
menuMgrConstraining.addMenuListener(new IMenuListener() {
+ @Override
public void menuAboutToShow(IMenuManager manager) {
@SuppressWarnings("null")@NonNull IMenuManager manager2 = manager;
ValidityView.this.fillConstrainingContextMenu(manager2);
@@ -766,6 +757,7 @@
private void hookConstrainingNodesDoubleClickAction() {
getConstrainingNodesViewer().addDoubleClickListener(new IDoubleClickListener() {
+ @Override
public void doubleClick(DoubleClickEvent event) {
constrainingNodesDoubleClickAction.run();
}
@@ -774,6 +766,7 @@
private void hookValidatableNodesDoubleClickAction() {
getValidatableNodesViewer().addDoubleClickListener(new IDoubleClickListener() {
+ @Override
public void doubleClick(DoubleClickEvent event) {
validatableNodesDoubleClickAction.run();
}
@@ -790,7 +783,7 @@
forceValidityViewRefreshAction = new ForceValidityViewRefreshAction(validityManager, this);
showValidatableElementInEditorAction = new ShowElementInEditorAction(validityManager, getValidatableNodesViewer());
showConstrainingElementInEditorAction = new ShowElementInEditorAction(validityManager, getConstrainingNodesViewer());
-
+
/*Toolbar actions*/
expandAllNodesAction = new ExpandAllNodesAction(this, true, true);
collapseAllNodesAction = new CollapseAllNodesAction(this, true, true);
@@ -806,16 +799,16 @@
/* Validatable Tool bar actions*/
expandAllValidatableNodesAction = new ExpandAllNodesAction(this, true, false);
collapseAllValidatableNodesAction = new CollapseAllNodesAction(this, true, false);
- enableAllValidatableNodesAction = new EnableDisableAllNodesAction(this, true, true);
- disableAllValidatableNodesAction = new EnableDisableAllNodesAction(this, false, true);
- disableAllUnusedValidatableNodesAction = new DisableAllUnusedNodesAction(this, true);
-
+ enableAllValidatableNodesAction = new EnableDisableAllNodesAction(this, true, true);
+ disableAllValidatableNodesAction = new EnableDisableAllNodesAction(this, false, true);
+ disableAllUnusedValidatableNodesAction = new DisableAllUnusedNodesAction(this, true);
+
/* Constraining Tool bar actions*/
expandAllConstrainingNodesAction = new ExpandAllNodesAction(this, false, true);
collapseAllConstrainingNodesAction = new CollapseAllNodesAction(this, false, true);
enableAllConstrainingNodesAction = new EnableDisableAllNodesAction(this, true, false);
disableAllConstrainingNodesAction = new EnableDisableAllNodesAction(this, false, false);
- disableAllUnusedConstrainingNodesAction = new DisableAllUnusedNodesAction(this, false);
+ disableAllUnusedConstrainingNodesAction = new DisableAllUnusedNodesAction(this, false);
/*Double Click actions*/
constrainingNodesDoubleClickAction = new Action() {
@@ -858,7 +851,7 @@
}
};
}
-
+
/**
* Schedule a redraw of validatable and constraining trees.
*/
@@ -875,12 +868,13 @@
}
redraw();
}
-
+
public void removeFilteredSeverity(@NonNull Severity severity) {
validityManager.removeFilteredSeverity(severity);
redraw();
}
+ @Override
public void selectionChanged(IWorkbenchPart part, ISelection selection) {
currentPart = part;
currentSelection = selection;
@@ -904,7 +898,7 @@
setSelection(input);
}
}
-
+
protected synchronized void setSelection(final Notifier newSelection) {
if (newSelection != selection) {
selection = newSelection;
@@ -921,14 +915,14 @@
private void validationRootChanged(RootNode rootNode) {
messageManager.removeMessages(getForm());
-
+
String currentMessagekey = null;
String currentMessageText = null;
int currentStatus = 0;
if (rootNode != null) {
if (rootNode.getValidatableNodes().isEmpty()) {
filteredValidatableNodesTree.disableTextWidget();
-
+
currentMessagekey = messageKey + messageCount++;
currentMessageText = ValidityUIMessages.ValidityView_Messages_NoModelElement;
currentStatus = IStatus.INFO;
@@ -947,12 +941,12 @@
} else {
filteredValidatableNodesTree.disableTextWidget();
filteredConstrainingNodesTree.disableTextWidget();
-
+
currentMessagekey = messageKey + messageCount++;
currentMessageText = ValidityUIMessages.ValidityView_Messages_NoSelection;
currentStatus = IStatus.WARNING;
}
-
+
if (currentMessagekey != null) {
messageManager.addMessage(currentMessagekey, currentMessageText, currentStatus, getForm());
}
@@ -965,7 +959,7 @@
@Override
public void setFocus() {
getValidatableNodesViewer().getControl().setFocus();
-
+
// Refresh the view
filteredValidatableNodesTree.resetFilter();
filteredConstrainingNodesTree.resetFilter();
diff --git a/examples/org.eclipse.ocl.examples.xtext.console/src/org/eclipse/ocl/examples/xtext/console/xtfo/EmbeddedXtextEditor.java b/examples/org.eclipse.ocl.examples.xtext.console/src/org/eclipse/ocl/examples/xtext/console/xtfo/EmbeddedXtextEditor.java
index 5717e03..b7e3e54 100644
--- a/examples/org.eclipse.ocl.examples.xtext.console/src/org/eclipse/ocl/examples/xtext/console/xtfo/EmbeddedXtextEditor.java
+++ b/examples/org.eclipse.ocl.examples.xtext.console/src/org/eclipse/ocl/examples/xtext/console/xtfo/EmbeddedXtextEditor.java
@@ -1,6 +1,6 @@
/*******************************************************************************
* Copyright (c) 2010, 2018 ProxiAD and Others
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
@@ -9,7 +9,7 @@
* Contributors:
* Obeo - initial API and implementation
* itemis AG - source viewer configuration
- * Sebastian Zarnekow (itemis AG) - synthetic resource creation and source viewer configuration
+ * Sebastian Zarnekow (itemis AG) - synthetic resource creation and source viewer configuration
* Cedric Vidal (ProxiAD) - integration with global scope
* E.D.Willink - integration of XTFO code uder CQ 4866
* L.Goubert (Obeo) - generalize to XtextResource
@@ -127,26 +127,26 @@
private Composite fControl;
private int fStyle;
-
+
private XtextSourceViewer fSourceViewer;
private XtextResource fResource;
private XtextDocument fDocument;
-
+
@Inject
@Named(Constants.FILE_EXTENSIONS)
private String fFileExtension;
private XtextSourceViewerConfiguration fViewerConfiguration;
-
+
@Inject
private HighlightingHelper fHighlightingHelper;
-
+
@Inject
private IResourceSetProvider fResourceSetProvider;
@Inject
private IGrammarAccess fGrammarAccess;
-
+
@Inject
private XtextSourceViewer.Factory fSourceViewerFactory;
@@ -163,17 +163,17 @@
@Inject
private IPreferenceStoreAccess fPreferenceStoreAccess;
-
+
@Inject
private ICharacterPairMatcher characterPairMatcher;
-
+
@Inject(optional = true)
private AnnotationPainter.IDrawingStrategy projectionAnnotationDrawingStrategy;
-
+
// private EmbeddedFoldingStructureProvider fFoldingStructureProvider;
-
+
private IOverviewRuler fOverviewRuler;
-
+
private IAnnotationAccess fAnnotationAccess;
/**
@@ -187,9 +187,9 @@
private @NonNull OCLInternal ocl;
/**
- * Creates a new EmbeddedXtextEditor. It must have the SWT.V_SCROLL style at least not to
+ * Creates a new EmbeddedXtextEditor. It must have the SWT.V_SCROLL style at least not to
* throw NPE when computing overview ruler.
- *
+ *
* @param control the parent composite that will contain the editor
* @param injector the Guice injector to get Xtext configuration elements
* @param style the SWT style of the {@link SourceViewer} of this editor.
@@ -198,7 +198,7 @@
fControl = control;
fStyle = style;
fAnnotationPreferences = new MarkerAnnotationPreferences();
-
+
injector.injectMembers(this);
ocl = OCLInternal.newInstance();
ResourceSet csResourceSet = getResourceSet();
@@ -207,12 +207,12 @@
}
createEditor(fControl);
}
-
+
/**
* Creates a new EmbeddedXtextEditor.
- *
+ *
* Equivalent to EmbeddedXtextEditor(control, injector, job, fileExtension, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
- *
+ *
* @param control the parent composite that will contain the editor
* @param injector the Guice injector to get Xtext configuration elements
*/
@@ -223,22 +223,22 @@
public Composite getControl() {
return fControl;
}
-
+
public XtextSourceViewer getViewer() {
return fSourceViewer;
}
-
+
public XtextResource getResource() {
return fResource;
}
-
+
public IXtextDocument getDocument() {
return fDocument;
}
-
+
/**
- * Should be called only once, during initialization.
- *
+ * Should be called only once, during initialization.
+ *
* Then, you should call {@link #update(String)};
*/
protected void setText(XtextDocument document, String text) {
@@ -256,7 +256,7 @@
}
fSourceViewer.setDocument(document, annotationModel);
}
-
+
private XtextResource createResource(String content) {
XtextResource result = createResource();
try {
@@ -266,16 +266,16 @@
}
return result;
}
-
+
private void createEditor(Composite parent) {
createViewer(parent);
-
+
Control control = fSourceViewer.getControl();
GridData data = new GridData(SWT.FILL, SWT.FILL, true, true);
control.setLayoutData(data);
createActions();
-
+
MenuManager manager = new MenuManager(null, null);
manager.setRemoveAllWhenShown(true);
manager.addMenuListener(new IMenuListener() {
@@ -284,12 +284,12 @@
EmbeddedXtextEditor.this.menuAboutToShow(mgr);
}
});
-
+
StyledText text = fSourceViewer.getTextWidget();
Menu menu = manager.createContextMenu(text);
text.setMenu(menu);
}
-
+
private void menuAboutToShow(IMenuManager menu) {
menu.add(new Separator(ITextEditorActionConstants.GROUP_EDIT));
menu.appendToGroup(ITextEditorActionConstants.GROUP_EDIT, fActions.get(ITextEditorActionConstants.CUT));
@@ -297,16 +297,16 @@
menu.appendToGroup(ITextEditorActionConstants.GROUP_EDIT, fActions.get(ITextEditorActionConstants.PASTE));
menu.add(new Separator(ICommonMenuConstants.GROUP_GENERATE));
- menu.appendToGroup(ICommonMenuConstants.GROUP_GENERATE, fActions.get(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS));
+ menu.appendToGroup(ICommonMenuConstants.GROUP_GENERATE, fActions.get(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS));
}
-
+
private void createViewer(Composite parent) {
createSourceViewer(parent);
installFoldingSupport(fSourceViewer);
setText(fDocument, ""); //$NON-NLS-1$
fHighlightingHelper.install(fViewerConfiguration, fSourceViewer);
}
-
+
/**
* Creates the vertical ruler to be used by this editor.
* Subclasses may re-implement this method.
@@ -316,10 +316,10 @@
private IVerticalRuler createVerticalRuler() {
return new CompositeRuler();
}
-
+
/** The editor's vertical ruler. */
private IVerticalRuler fVerticalRuler;
-
+
/**
* Creates the annotation ruler column. Subclasses may re-implement or extend.
*
@@ -330,20 +330,20 @@
return new AnnotationRulerColumn(VERTICAL_RULER_WIDTH, getAnnotationAccess());
}
-
+
private void createSourceViewer(Composite parent) {
fVerticalRuler = createVerticalRuler();
fSourceViewer = fSourceViewerFactory.createSourceViewer(parent, fVerticalRuler, getOverviewRuler(), true, fStyle);
fViewerConfiguration = fSourceViewerConfigurationProvider.get();
- fSourceViewer.configure(fViewerConfiguration);
-
+ fSourceViewer.configure(fViewerConfiguration);
+
/*fProjectionSupport =*/ installProjectionSupport(fSourceViewer);
-
+
// make sure the source viewer decoration support is initialized
getSourceViewerDecorationSupport(fSourceViewer);
-
+
fSourceViewer.getTextWidget().addFocusListener(new SourceViewerFocusListener());
-
+
fSourceViewerDecorationSupport.install(fPreferenceStoreAccess.getPreferenceStore());
parent.addDisposeListener(new DisposeListener() {
@Override
@@ -352,29 +352,29 @@
}
});
fDocument = fDocumentProvider.get();
-
+
IDocumentPartitioner partitioner = documentPartitioner.get();
partitioner.connect(fDocument);
fDocument.setDocumentPartitioner(partitioner);
-
-
- ValidationJob job = new ValidationJob(fResourceValidator, fDocument,
+
+
+ ValidationJob job = new ValidationJob(fResourceValidator, fDocument,
new IValidationIssueProcessor() {
private AnnotationIssueProcessor annotationIssueProcessor;
-
+
@Override
public void processIssues(List<Issue> issues, IProgressMonitor monitor) {
if (annotationIssueProcessor == null) {
- annotationIssueProcessor = new AnnotationIssueProcessor(fDocument,
- fSourceViewer.getAnnotationModel(),
+ annotationIssueProcessor = new AnnotationIssueProcessor(fDocument,
+ fSourceViewer.getAnnotationModel(),
new IssueResolutionProvider.NullImpl());
}
if (annotationIssueProcessor != null)
- annotationIssueProcessor.processIssues(issues, monitor);
+ annotationIssueProcessor.processIssues(issues, monitor);
}
}, CheckMode.FAST_ONLY);
fDocument.setValidationJob(job);
-
+
fSourceViewer.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
@@ -382,24 +382,24 @@
}
});
}
-
+
// private ProjectionSupport fProjectionSupport;
@Inject
private Provider<IDocumentPartitioner> documentPartitioner;
-
+
private static final String ERROR_ANNOTATION_TYPE = "org.eclipse.xtext.ui.editor.error"; //$NON-NLS-1$
private static final String WARNING_ANNOTATION_TYPE = "org.eclipse.xtext.ui.editor.warning"; //$NON-NLS-1$
-
+
private ProjectionSupport installProjectionSupport(ProjectionViewer projectionViewer) {
ProjectionSupport projectionSupport = new ProjectionSupport(projectionViewer, getAnnotationAccess(),
getSharedColors());
- projectionSupport.addSummarizableAnnotationType(WARNING_ANNOTATION_TYPE);
+ projectionSupport.addSummarizableAnnotationType(WARNING_ANNOTATION_TYPE);
projectionSupport.addSummarizableAnnotationType(ERROR_ANNOTATION_TYPE);
projectionSupport.setAnnotationPainterDrawingStrategy(projectionAnnotationDrawingStrategy);
projectionSupport.install();
return projectionSupport;
}
-
+
/**
* Helper for managing the decoration support of this editor's viewer.
*
@@ -408,13 +408,13 @@
* {@link #getSourceViewerDecorationSupport(ISourceViewer)} instead.</p>
*/
private SourceViewerDecorationSupport fSourceViewerDecorationSupport;
-
+
private void installFoldingSupport(ProjectionViewer projectionViewer) {
// fFoldingStructureProvider.install(this, projectionViewer);
// projectionViewer.doOperation(ProjectionViewer.TOGGLE);
// fFoldingStructureProvider.initialize();
}
-
+
/**
* Returns the source viewer decoration support.
*
@@ -428,7 +428,7 @@
}
return fSourceViewerDecorationSupport;
}
-
+
/**
* Configures the decoration support for this editor's source viewer. Subclasses may override this
* method, but should call their superclass' implementation at some point.
@@ -444,14 +444,14 @@
support.setCursorLinePainterPreferenceKeys(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_CURRENT_LINE, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_CURRENT_LINE_COLOR);
support.setMarginPainterPreferenceKeys(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_PRINT_MARGIN, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_PRINT_MARGIN_COLOR, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_PRINT_MARGIN_COLUMN);
// support.setSymbolicFontName(getFontPropertyPreferenceKey());
-
+
if (characterPairMatcher != null) {
support.setCharacterPairMatcher(characterPairMatcher);
support.setMatchingCharacterPainterPreferenceKeys(BracketMatchingPreferencesInitializer.IS_ACTIVE_KEY,
BracketMatchingPreferencesInitializer.COLOR_KEY);
}
}
-
+
/**
* Returns the overview ruler.
*
@@ -462,10 +462,10 @@
fOverviewRuler= createOverviewRuler(getSharedColors());
return fOverviewRuler;
}
-
+
/** The width of the vertical ruler. */
private static final int VERTICAL_RULER_WIDTH= 12;
-
+
/**
* Returns the annotation access.
*
@@ -476,7 +476,7 @@
fAnnotationAccess= createAnnotationAccess();
return fAnnotationAccess;
}
-
+
/**
* Creates the annotation access for this editor.
*
@@ -493,12 +493,12 @@
}
};
}
-
+
/**
* The annotation preferences.
*/
private MarkerAnnotationPreferences fAnnotationPreferences;
-
+
private IOverviewRuler createOverviewRuler(ISharedTextColors sharedColors) {
IOverviewRuler ruler= new OverviewRuler(getAnnotationAccess(), VERTICAL_RULER_WIDTH, sharedColors);
@@ -510,25 +510,25 @@
}
return ruler;
}
-
+
private ISharedTextColors getSharedColors() {
return EditorsUI.getSharedTextColors();
}
-
+
/**
* Updates the text of this editor with the given String
- *
+ *
* @param text
*/
public void update(String text) {
IDocument document = fSourceViewer.getDocument();
-
+
fSourceViewer.setRedraw(false);
document.set(text);
fSourceViewer.setVisibleRegion(0, text.length());
fSourceViewer.setRedraw(true);
}
-
+
private void createActions() {
{
TextViewerAction action= new TextViewerAction(fSourceViewer, ITextOperationTarget.CUT);
@@ -536,28 +536,28 @@
setAction(ITextEditorActionConstants.CUT, action);
setAsSelectionDependantAction(action);
}
-
+
{
TextViewerAction action= new TextViewerAction(fSourceViewer, ITextOperationTarget.COPY);
action.setText("Copy"); //$NON-NLS-1$
setAction(ITextEditorActionConstants.COPY, action);
setAsSelectionDependantAction(action);
}
-
+
{
TextViewerAction action= new TextViewerAction(fSourceViewer, ITextOperationTarget.PASTE);
action.setText("Paste"); //$NON-NLS-1$
setAction(ITextEditorActionConstants.PASTE, action);
setAsSelectionDependantAction(action);
}
-
+
{
TextViewerAction action = new TextViewerAction(fSourceViewer, ISourceViewer.CONTENTASSIST_PROPOSALS);
action.setText("Content Assist"); //$NON-NLS-1$
setAction(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS, action);
setAsContextDependantAction(action);
}
-
+
if (fViewerConfiguration.getContentFormatter(fSourceViewer) != null) {
TextViewerAction action = new TextViewerAction(fSourceViewer, ISourceViewer.FORMAT);
action.setText("Format"); //$NON-NLS-1$
@@ -566,28 +566,28 @@
}
{
- ToggleSLCommentAction action = new ToggleSLCommentAction(fSourceViewer);
+ ToggleSLCommentAction action = new ToggleSLCommentAction(fSourceViewer);
setAction(XTEXT_UI_TOGGLE_SL_COMMENT_ACTION, action);
setAsContextDependantAction(action);
action.configure(fSourceViewer, fViewerConfiguration);
}
}
-
+
private void setAction(String actionID, IAction action) {
if (action.getId() == null)
action.setId(actionID); // make sure the action ID has been set
-
+
fActions.put(actionID, action);
}
-
+
private void setAsContextDependantAction(IAction action) {
fActionHandlers.add(new ActionHandler(action));
}
-
+
private void setAsSelectionDependantAction(IAction action) {
fSelectionDependentActions.add(action);
}
-
+
private void updateSelectionDependentActions() {
for(IAction action : fSelectionDependentActions) {
if (action instanceof IUpdate) {
@@ -597,30 +597,30 @@
}
protected void updateAction(IAction action) {
-
+
}
-
+
private Map<String, IAction> fActions = Maps.newHashMap();
private List<IAction> fSelectionDependentActions = Lists.newArrayList();
private List<ActionHandler> fActionHandlers = Lists.newArrayList();
-
+
/**
* Source viewer focus listener that activates/deactivates action handlers on focus state change.
- *
+ *
* @author Mikaël Barbero
*
*/
private final class SourceViewerFocusListener implements FocusListener {
private static final String EMBEDEDXTEXT_EDITOR_CONTEXT = "org.eclipse.ocl.examples.xtext.console.xtext.embededxtextEditor.context"; //$NON-NLS-1$
-
+
private final Expression fExpression;
private final List<IHandlerActivation> fHandlerActivations;
private IContextActivation fContextActivation;
-
+
public SourceViewerFocusListener() {
fExpression = new ActiveShellExpression(fSourceViewer.getControl().getShell());
fHandlerActivations = Lists.newArrayList();
-
+
fSourceViewer.getControl().addDisposeListener(new DisposeListener() {
@Override
public void widgetDisposed(DisposeEvent e) {
@@ -632,7 +632,7 @@
}
});
}
-
+
@Override
public void focusLost(FocusEvent e) {
if (fContextActivation != null) {
@@ -643,8 +643,9 @@
IEditorPart activeEditor = activePage.getActiveEditor();
if (activeEditor != null) {
IWorkbenchPartSite site = activeEditor.getSite();
- @SuppressWarnings("cast") // Needed for org.eclipse.ui.workbench < 3.107.0
- IContextService contextService = (IContextService)site.getService(IContextService.class);
+ Object contextServiceAsObject = site.getService(IContextService.class); // Needed for org.eclipse.ui.workbench < 3.107.0
+ IContextService contextService = (IContextService)contextServiceAsObject;
+ assert contextService != null;
contextService.deactivateContext(fContextActivation);
}
}
@@ -664,8 +665,9 @@
IEditorPart activeEditor = activePage.getActiveEditor();
if (activeEditor != null) {
IWorkbenchPartSite site = activeEditor.getSite();
- @SuppressWarnings("cast") // Needed for org.eclipse.ui.workbench < 3.107.0
- IContextService contextService = (IContextService)site.getService(IContextService.class);
+ Object contextServiceAsObject = site.getService(IContextService.class); // Needed for org.eclipse.ui.workbench < 3.107.0
+ IContextService contextService = (IContextService)contextServiceAsObject;
+ assert contextService != null;
fContextActivation = contextService.activateContext(EMBEDEDXTEXT_EDITOR_CONTEXT);
}
else {
@@ -700,7 +702,7 @@
ocl2.dispose();
// }
}
-
+
public ResourceSet getResourceSet() {
return fResourceSetProvider.get(null);
}
@@ -715,7 +717,7 @@
/**
* Reconfigure this editor to support editing with respect to any OCL provided by esResourceSet.
- * The value of esResourceSet is cached so that repeated calls have no effect.
+ * The value of esResourceSet is cached so that repeated calls have no effect.
* If esResourceSet changes to null, a new OCL is created.
*/
public synchronized void setContext(@Nullable ResourceSet esResourceSet) {
diff --git a/plugins/org.eclipse.ocl.pivot/annotations/org/eclipse/ui/services/IServiceLocator.eea b/plugins/org.eclipse.ocl.pivot/annotations/org/eclipse/ui/services/IServiceLocator.eea
new file mode 100644
index 0000000..d6e5436
--- /dev/null
+++ b/plugins/org.eclipse.ocl.pivot/annotations/org/eclipse/ui/services/IServiceLocator.eea
@@ -0,0 +1,4 @@
+class org/eclipse/ui/services/IServiceLocator
+getService
+ <T:Ljava/lang/Object;>(Ljava/lang/Class<TT;>;)TT;
+ <T:Ljava/lang/Object;>(Ljava/lang/Class<TT;>;)T0T;