Commit fe9ea64a authored by Alexander Diewald's avatar Alexander Diewald
Browse files

Tree-wide: Update ratings to mirror the rating state of the svn repo.



* Since the tooling helpers used in the svn installation and the git
  version, a re-rating of all files was required (less work than fixing
  the tooling code that would be only used once).
* Updates the hashes of the classes in the .rating files.
* Removes empty .rating files from directories without ratable files.
Signed-off-by: Alexander Diewald's avatarAlexander Diewald <diewald@fortiss.org>
parent c4269a1d
ToolingBaseUIActivator.java 9b98571fbfb16a013093fec423eb03f9ced2c71c GREEN
ToolingBaseUIActivator.java 45d90dd4c3eebaa75b4957d6d91f6295844c19fb GREEN
HierarchicalNameComparator.java 7fc571fc820dc2469121863927a4b73d57a05cf0 GREEN
HierarchicalNameComparator.java 479dc1a3da772e551d15cbfb0d820cce87c15d63 GREEN
AnnotationEditingSupportBase.java 7e542e9d1084e929b798cf19de5c6b0e995e5922 GREEN
CheckBoxEditingSupport.java 5ef3594428071da0c8df68202a101fda0fbc516c GREEN
ComboBoxEditingSupport.java 98a8af91fc86ab15c7e57d6d5497374be21ab8cd GREEN
EditingSupportFactory.java 1c4226e983ac7a7b63df273323ed9aec98d1b238 GREEN
ElementCommentEditingSupport.java b7cbec5084aab81efc1da6b48647b172206f6256 GREEN
ElementEditingSupportBase.java f7e731a8720aa8c2a0f12b57c0ae11e21dad22cc GREEN
ElementNameEditingSupport.java 6393bb52ad1f7ff4823a3f0dd30128124b0e3347 GREEN
LabelValueMapping.java 4493051db8444e8e2651802fe65603adf7bbd906 GREEN
MultiSelectionCellEditor.java 115039c4ed80dcb984d90d98496eb70f81a78686 GREEN
MultiSelectionEditingSupport.java 0f650b71943755333dd3a72d630ec7972084856e GREEN
TextEditingSupport.java f4d21fc3dc480e9f9ad5f9b960805c7488123f5a GREEN
AnnotationEditingSupportBase.java ef0033f37de2c0bd601cf3c9fbb2760a54734ded GREEN
CheckBoxEditingSupport.java 1d8d9dd444f0e52767c65fd2711321438d3a9b29 GREEN
ComboBoxEditingSupport.java b1f0141af2a242d6fe4bdcc8f7c627146b3b9347 GREEN
EditingSupportFactory.java 291d4d0389f9fc4713701af9afede0e312712da5 GREEN
ElementCommentEditingSupport.java 4be366924a040caf3f80e35b383e796e84aedcac GREEN
ElementEditingSupportBase.java a6360f99ee149276f0fbd299820ebd1c9731ea97 GREEN
ElementNameEditingSupport.java 0dcaecf4ba5f8ddefa3ccb7d6f4e4506f7f09b26 GREEN
LabelValueMapping.java 267a390e5451212af4b9fadd3e259dac7491c59f GREEN
MultiSelectionCellEditor.java 6415d4e8ae464a3a7455679c280fc2e8b2ae58da GREEN
MultiSelectionEditingSupport.java ca89f1c69d2cb28e7b1eceae6428c1c7880ff36f GREEN
TextEditingSupport.java e761ea393816f23ca41157f2a9a9a8d8ef30b858 GREEN
AnnotationLabelProvider.java a592cde4a9ae83a832969a0e3379223aaaa793d2 GREEN
CheckBoxLabelProvider.java fc68dc493591ebd7427f029b715de61f7696a2cb GREEN
ElementCommentLabelProvider.java b1b2fb39a2ec33bf5e1763186cd44634654f9a3a GREEN
ElementLabelProviderBase.java 83b5e374fdd3357dffd8bd357b8db432825963d4 GREEN
ElementNameLabelProvider.java 6b12d3c6841c261a1cf6e8501a3edfd6f83bfe9e GREEN
LabelProviderBase.java a5f27ad40b1ac427418bd8a57a14a0779281df87 GREEN
LabelProviderFactory.java fc14fb327dc642d5988f693844a632068cc9c7bb GREEN
AnnotationLabelProvider.java ddebfc2bf2c8306884eb748c2c649ff0fe9c3d21 GREEN
CheckBoxLabelProvider.java 44d1e8394703802f14041a058eae89a70501792c GREEN
ElementCommentLabelProvider.java 76aa6e9b930ce5680607852fd776172942c89ce5 GREEN
ElementLabelProviderBase.java f33502f73033ebdf30316df627e8a9c87e7d1b28 GREEN
ElementNameLabelProvider.java 897296ac8318b6dfdea9c50fc73aaeea23c2fffa GREEN
LabelProviderBase.java d8c4dae010246c94bb8d1596bd60f7af8d1ad7c6 GREEN
LabelProviderFactory.java 45e2d0ad0449182b9f8196257b20f0dba3c27f35 GREEN
AnnotationViewPartBase.java 2e89e60e68afa1bfaaec153a3c2bf26ce5f1df24 GREEN
IAnnotationViewPart.java e52191270c1bde81ec5ff914ecde0275dd2683d7 GREEN
AnnotationViewPartBase.java cfbe1fd7602fbd5d7fbcb06d2a35714cb0b069af GREEN
IAnnotationViewPart.java a011f327370ded8738031059f9c3b94ce6ba63d1 GREEN
ColumnHandle.java 133a43480037921ac4501b9f43feab56aed46941 GREEN
GenericAnnotationView.java 782362f13579378700bd41f9d5532c60217f1414 RED
HierarchicalNameViewerComparator.java edf1d012a3d18860d2ef7f9e07baf46cdfeec381 GREEN
ColumnHandle.java 8fc5f04cbb0127e5df8c7a9e3b2620502bf93716 GREEN
GenericAnnotationView.java 53d2c1715edd2ec311ccd93b397657caa4ca71b3 RED
HierarchicalNameViewerComparator.java 393f888a671d788c05650d17c937b76dda8a0f43 GREEN
AnnotationFilter.java ab3e2d0b60696cc6a1abb00295c6e066b7cf6151 GREEN
AnnotationFilterWidget.java 9e2d724a13b523982c27ffa41666e3708a100389 GREEN
TextFocusListener.java 6a657b1c6d1f539982ea5a5d76414a6e36e960c5 GREEN
AnnotationFilter.java 987cc56bd7d1943f8ed750f5dbd108382608a6bf GREEN
AnnotationFilterWidget.java 78ddeeadae647cc6c4ef047ae60e13feeeb461af GREEN
TextFocusListener.java 53aac76e88517ecbb34be84e6d2476e6ba101a31 GREEN
ConstraintBasedProcessCompositor.java 8979106994ba208714f2fd49edbafae8400e0091 GREEN
ConstraintBasedProcessCompositor.java b456614f088f75929f954f85225cb3713f00f291 GREEN
TableContentProviderBase.java 54451bb587e3d1e3e1c1f819cd2d3f2bb0e07986 GREEN
TableContentProviderBase.java 6773e5be4c6f4aa5f7215b7e821b5b3f57fa6991 GREEN
AbstractDecoratedStyledTextCellDatabindingEditingSupport.java 60b92a03286a08d8b3bb302288333f1e842e47c9 GREEN
AbstractDecoratedTextCellDatabindingEditingSupport.java fc0886d0513cc8c2d2152dd38c7f500e098ed941 GREEN
AbstractStyledTextCellDatabindingEditingSupport.java 175328d4e3dafa8bcbbbaad60de391f8ec1bae6f GREEN
AbstractTextCellDatabindingEditingSupport.java b5db4bbd78c2ff29887e04324153bb222c0f93fa GREEN
FloatValidator.java 05cb2ca5e1bb3b0eb3c7538fe25846935b1d9f01 GREEN
IntValidator.java 6ec626ed20d61642049fc500dda7c1bd51c6052b GREEN
NumberPositiveZeroValidator.java c43fbcffd87469fe07766d7c4a3c78236e3df23e GREEN
AbstractDecoratedStyledTextCellDatabindingEditingSupport.java 53608573d2b4c6ad3d5f239bb74b406995de5297 GREEN
AbstractDecoratedTextCellDatabindingEditingSupport.java 29dcf5df2bb3d23c1db0cada9e0a580a70ad77fc GREEN
AbstractStyledTextCellDatabindingEditingSupport.java 235097003fe1d2e38503541d17a4ae7f500a6174 GREEN
AbstractTextCellDatabindingEditingSupport.java 8819dd1f57a05a41ac41efea255afd644409e9fe GREEN
FloatValidator.java 371c13a05481c3d03304e82997b523eeec8746aa GREEN
IntValidator.java 6362bd7648937720f85027878e3e84d2b5a534d5 GREEN
NumberPositiveZeroValidator.java efca8363866409125fbc16e703aff8e7c42c4f42 GREEN
ButtonDialog.java 1ac5f7842d52ea384c8a73c2d59a685e516ce4a5 GREEN
CheckBoxTreeDialog.java bdddcf60b63598d5517fc860ab02da7ab3f56ef5 GREEN
ElementTreeMultiSelectDialog.java 4dd9ed281145f9f58f9827d66f05b13733068df3 GREEN
ElementTreeSingleSelectDialog.java 563b61edd516acbe6dfc4e8d8e5dc2bea76edc87 GREEN
IDialogEditSupport.java f4128d109c23470544bbe47c9b3321180c6d24ed GREEN
MessageUtilsExtended.java b107e70f15965c563ff1e804fdf2cfc5252853ff GREEN
ModelElementTreeContentProvider.java dc5b51728333ddbc3a79034dbe2f8b5c79b49f34 GREEN
ModelElementWithRefCopyMessageHandler.java e334cda33829f30996f41d0b3e7c881c6f8b71a4 GREEN
MultiFieldInputDialog.java ea831811ed66d82b900a68eaa72ec9f1d4949932 GREEN
MultiRootTreeContentProvider.java 977d6a4551d2f8cc401d382316cfe88bf90e1365 GREEN
ButtonDialog.java aa4d5a9ed8b8eafeb4632d4a3c6b81db07fb936b GREEN
CheckBoxTreeDialog.java 2737a18ff8dda511466ba0f467d777a3a56e99a3 GREEN
ElementTreeMultiSelectDialog.java 375e85d3d63be138d4a8a290b6c2aa50614885f5 GREEN
ElementTreeSingleSelectDialog.java bdc7e19ee74f700c9e7c73320d90d3237c01c6a8 GREEN
IDialogEditSupport.java 3c66b23d66cffaaf9bb4848b025a3fdb1a5b86dc GREEN
MessageUtilsExtended.java 930a54539160f6a214b6c0d98b0e3b3459c0740c GREEN
ModelElementTreeContentProvider.java ac8da7ee7adf800850c528aa35e139b76a7d0318 GREEN
ModelElementWithRefCopyMessageHandler.java 12d77e083b68c513c4c494969879cf2208213ef7 GREEN
MultiFieldInputDialog.java deee851937705b39feaff24090ceab036e71e431 GREEN
MultiRootTreeContentProvider.java 279ed5c5bcc5f000bf4e8f0fa3c131ba0411221b GREEN
ConnectionCompositionDropTargetListener.java 5d9b9b1ceebe054d5f32e64a6a2e18b3983dfa01 GREEN
ElementCompositionDropTargetListener.java 6d2d93d706a61aaa3069826c66410591d0bee72a GREEN
ConnectionCompositionDropTargetListener.java 4b7e08ad36ea432ef82f3185830c70d955da916b GREEN
ElementCompositionDropTargetListener.java 8941932b4cfe889c7b50de5ed88135a81166666d GREEN
ViewerElementCompositionDropAdapter.java 255646545e2c72055c1c090396525f21491f70e4 GREEN
ViewerElementCompositionDropAdapter.java fe78ecb4854495f1fae994ad33dece9edb423650 GREEN
AdvancedTreeViewerEditorBase.java 3bb67c52886069379765289885df3b23790b88c9 GREEN
AllocationDiagramEditorBase.java 3c03b9220f1c342ded673d6d1b2fd2c01b57fba6 GREEN
CommonDiagramEditorBase.java 438babd95dd7a185bd32246cb8180b00bb53f18a GREEN
ConstraintBasedProcessEditor.java 2b565588008fc9fdd6472e5d9035e69d4682840c GREEN
ConstraintBasedProcessEditorHelper.java 68402c6733552a9d5923eae2f697ac7ce0874744 GREEN
DiagramEditorBase.java 3d2bb40e18548ebca0dfdd78f094598e5ee298d1 GREEN
DiagramKeyHandler.java 8b64048b966e6e8cacfa7fb78edebef2a4981fc4 GREEN
FormsEditorBase.java 50934d36124dea9b16ac45fe3621d878afb48bc7 GREEN
GEFEditorBase.java 7cc55eaf9c9ffa351b683512832273a4b54a3830 GREEN
StyledTextCellEditor.java 3e678e4e8dbadb8463201bc62e7a67003acae8a8 GREEN
TreeViewerEditorBase.java 7d8c9a87d38a609b0fce0d2596e89bd4dbc06dad GREEN
AdvancedTreeViewerEditorBase.java 34e37880adc67c3ee45bcb74ed7572d3360bcc0f GREEN
AllocationDiagramEditorBase.java fa544546f73eea1150d90b7257b0e6bce82c288c GREEN
CommonDiagramEditorBase.java f0a243caa6fc7c66434ffb4028628c6d6aa657fd GREEN
ConstraintBasedProcessEditor.java 06891ab7f5c5eb7549e8aee0d3760ea5a534d99d GREEN
ConstraintBasedProcessEditorHelper.java 651e909b90fe1b777206c35ca91a36630365435e GREEN
DiagramEditorBase.java 09663ce095074d1a8eef086284eea0a7776e0431 GREEN
DiagramKeyHandler.java 71a16de8c567c534dee74bf6ccc272ac6ec65664 GREEN
FormsEditorBase.java 7b058bbd0583b1cf2d1b82009814ece8b8ec0c32 GREEN
GEFEditorBase.java 0d86de1e98b9f3e943054c959b5b5784339672b4 GREEN
StyledTextCellEditor.java c709c5092bf54d42ddbac53c8751659020060aef GREEN
TreeViewerEditorBase.java 22b2bc9e07905b52a49bffb27e37e2d9731b0491 GREEN
/*-------------------------------------------------------------------------+
| Copyright 2017 fortiss GmbH |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
| You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
+--------------------------------------------------------------------------*/
package org.fortiss.tooling.base.ui.editor;
import static org.eclipse.jface.viewers.AbstractTreeViewer.ALL_LEVELS;
import static org.eclipse.swt.SWT.NONE;
import static org.fortiss.tooling.kernel.ui.util.EObjectSelectionUtils.getEObjectElements;
import static org.fortiss.tooling.kernel.ui.util.EObjectSelectionUtils.getFirstElement;
import java.util.Collection;
import java.util.List;
import org.eclipse.emf.common.notify.Adapter;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.util.EContentAdapter;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.viewers.ColumnViewerToolTipSupport;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.KeyAdapter;
import org.eclipse.swt.events.KeyEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Menu;
import org.fortiss.tooling.base.ui.dnd.jface.ViewerElementCompositionDropAdapter;
import org.fortiss.tooling.kernel.ui.extension.base.EditorBase;
import org.fortiss.tooling.kernel.ui.extension.data.ContextMenuContextProvider;
import org.fortiss.tooling.kernel.ui.service.IActionService;
import org.fortiss.tooling.kernel.ui.service.IContextMenuService;
/**
* Customization of {@link TreeViewerEditorBase} which provide keyboard shortcuts on the tree.
*
* (Used in featuremodel)
*
* @author aravantinos
*/
public class AdvancedTreeViewerEditorBase<T extends EObject> extends EditorBase<T> implements
ContextMenuContextProvider {
/** Stores the {@link TreeViewer}. */
protected TreeViewer treeViewer;
/** Menu manager for an element in tree viewer */
protected MenuManager menuManager;
/** The root composite for the editor controls. */
protected Composite rootComposite;
/** The adapter used for dealing with changes of the content. */
protected final Adapter editedObjectChanged = new EContentAdapter() {
@Override
public void notifyChanged(Notification notification) {
// super.notifyChanged(notification);
if(notification.getEventType() != Notification.REMOVING_ADAPTER &&
!treeViewer.getTree().isDisposed()) {
treeViewer.refresh(true);
}
}
};
/** {@inheritDoc} */
@Override
public void createPartControl(Composite parent) {
rootComposite = new Composite(parent, NONE);
rootComposite.setLayout(new GridLayout(1, false));
rootComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
treeViewer = createTreeViewer(rootComposite);
treeViewer.getTree().setHeaderVisible(true);
treeViewer.getTree().setLinesVisible(true);
treeViewer.getTree().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
treeViewer.setAutoExpandLevel(ALL_LEVELS);
setupTreeViewer(treeViewer);
ViewerElementCompositionDropAdapter dndAdapter =
new ViewerElementCompositionDropAdapter(treeViewer);
treeViewer.addDropSupport(dndAdapter.getSupportedDNDOperations(),
dndAdapter.getPreferredTransfers(), dndAdapter);
setTreeViewerInput();
getEditorSite().setSelectionProvider(treeViewer);
ColumnViewerToolTipSupport.enableFor(treeViewer);
getEditorSite().setSelectionProvider(treeViewer);
}
/** Sets the input and adapter for {@link #treeViewer}. */
protected void setTreeViewerInput() {
treeViewer.setInput(editedObject);
editedObject.eAdapters().add(editedObjectChanged);
}
/**
* Creates the {@link TreeViewer} instance.
*
* @param parent
* The parent, in which the {@link TreeViewer} is supposed to be embedded in.
* @return The new {@link TreeViewer}.
*/
protected TreeViewer createTreeViewer(Composite parent) {
return new TreeViewer(parent);
}
/** {@inheritDoc} */
@Override
public void dispose() {
editedObject.eAdapters().remove(editedObjectChanged);
super.dispose();
}
/** Returns the elements currently selected in the tree. */
protected Collection<EObject> getTreeSelection() {
List<EObject> result = getEObjectElements(treeViewer.getSelection());
if(result.isEmpty()) {
result.add(editedObject);
}
return result;
}
/** {@inheritDoc} */
@Override
public void setFocus() {
treeViewer.getTree().setFocus();
}
/** Returns treeViewer. */
public TreeViewer getTreeViewer() {
return treeViewer;
}
/**
* This method is used to configure the tree viewer, e.g. set the content
* provider, and the label provider.
*/
protected void setupTreeViewer(TreeViewer treeViewer) {
menuManager = IContextMenuService.getInstance().createDefaultContextMenu(this);
Menu contextMenu = menuManager.createContextMenu(treeViewer.getControl());
treeViewer.getControl().setMenu(contextMenu);
getSite().registerContextMenu(menuManager, treeViewer);
treeViewer.getControl().addKeyListener(new ViewerKeyAdapter());
treeViewer.expandAll();
}
/** Key adapter to deal with copy/paste/delete/... done through the keyboard. */
private class ViewerKeyAdapter extends KeyAdapter {
/** Constructor. */
public ViewerKeyAdapter() {
}
/** {@inheritDoc} */
@Override
public void keyReleased(KeyEvent e) {
if((e.stateMask & SWT.CTRL) != 0 && e.keyCode == 0x63) {
IActionService.getInstance().runGlobalCopyAction();
} else if((e.stateMask & SWT.CTRL) != 0 && e.keyCode == 0x76) {
IActionService.getInstance().runGlobalPasteAction();
} else if(e.keyCode == SWT.DEL) {
IActionService.getInstance().runGlobalDeleteAction();
} else if((e.stateMask & SWT.CTRL) != 0 && e.keyCode == 0x78) {
IActionService.getInstance().runGlobalCutAction();
} else if((e.stateMask & SWT.CTRL) != 0 && e.keyCode == 0x7A) {
IActionService.getInstance().runGlobalUndoAction();
} else if((e.stateMask & SWT.CTRL) != 0 && e.keyCode == 0x79) {
IActionService.getInstance().runGlobalRedoAction();
}
}
}
/** {@inheritDoc} */
@Override
public EObject getSelectedModelElement() {
if(getSite().getSelectionProvider() != null) {
return getFirstElement(getSite().getSelectionProvider().getSelection());
}
return null;
}
/** {@inheritDoc} */
@Override
public List<EObject> getSelectedModelElementList() {
if(getSite().getSelectionProvider() != null) {
return getEObjectElements(getSite().getSelectionProvider().getSelection());
}
return null;
}
}
/*-------------------------------------------------------------------------+
| Copyright 2017 fortiss GmbH |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
| You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
+--------------------------------------------------------------------------*/
package org.fortiss.tooling.base.ui.editor;
import static org.eclipse.jface.viewers.AbstractTreeViewer.ALL_LEVELS;
import static org.eclipse.swt.SWT.NONE;
import static org.fortiss.tooling.kernel.ui.util.EObjectSelectionUtils.getEObjectElements;
import static org.fortiss.tooling.kernel.ui.util.EObjectSelectionUtils.getFirstElement;
import java.util.Collection;
import java.util.List;
import org.eclipse.emf.common.notify.Adapter;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.util.EContentAdapter;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.viewers.ColumnViewerToolTipSupport;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.KeyAdapter;
import org.eclipse.swt.events.KeyEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Menu;
import org.fortiss.tooling.base.ui.dnd.jface.ViewerElementCompositionDropAdapter;
import org.fortiss.tooling.kernel.ui.extension.base.EditorBase;
import org.fortiss.tooling.kernel.ui.extension.data.ContextMenuContextProvider;
import org.fortiss.tooling.kernel.ui.service.IActionService;
import org.fortiss.tooling.kernel.ui.service.IContextMenuService;
/**
* Customization of {@link TreeViewerEditorBase} which provide keyboard shortcuts on the tree.
*
* (Used in featuremodel)
*
* @author aravantinos
*/
public class AdvancedTreeViewerEditorBase<T extends EObject> extends EditorBase<T> implements
ContextMenuContextProvider {
/** Stores the {@link TreeViewer}. */
protected TreeViewer treeViewer;
/** Menu manager for an element in tree viewer */
protected MenuManager menuManager;
/** The root composite for the editor controls. */
protected Composite rootComposite;
/** The adapter used for dealing with changes of the content. */
protected final Adapter editedObjectChanged = new EContentAdapter() {
@Override
public void notifyChanged(Notification notification) {
// super.notifyChanged(notification);
if(notification.getEventType() != Notification.REMOVING_ADAPTER &&
!treeViewer.getTree().isDisposed()) {
treeViewer.refresh(true);
}
}
};
/** {@inheritDoc} */
@Override
public void createPartControl(Composite parent) {
rootComposite = new Composite(parent, NONE);
rootComposite.setLayout(new GridLayout(1, false));
rootComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
treeViewer = createTreeViewer(rootComposite);
treeViewer.getTree().setHeaderVisible(true);
treeViewer.getTree().setLinesVisible(true);
treeViewer.getTree().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
treeViewer.setAutoExpandLevel(ALL_LEVELS);
setupTreeViewer(treeViewer);
ViewerElementCompositionDropAdapter dndAdapter =
new ViewerElementCompositionDropAdapter(treeViewer);
treeViewer.addDropSupport(dndAdapter.getSupportedDNDOperations(),
dndAdapter.getPreferredTransfers(), dndAdapter);
setTreeViewerInput();
getEditorSite().setSelectionProvider(treeViewer);
ColumnViewerToolTipSupport.enableFor(treeViewer);
getEditorSite().setSelectionProvider(treeViewer);
}
/** Sets the input and adapter for {@link #treeViewer}. */
protected void setTreeViewerInput() {
treeViewer.setInput(editedObject);
editedObject.eAdapters().add(editedObjectChanged);
}
/**
* Creates the {@link TreeViewer} instance.
*
* @param parent
* The parent, in which the {@link TreeViewer} is supposed to be embedded in.
* @return The new {@link TreeViewer}.
*/
protected TreeViewer createTreeViewer(Composite parent) {
return new TreeViewer(parent);
}
/** {@inheritDoc} */
@Override
public void dispose() {
editedObject.eAdapters().remove(editedObjectChanged);
super.dispose();
}
/** Returns the elements currently selected in the tree. */
protected Collection<EObject> getTreeSelection() {
List<EObject> result = getEObjectElements(treeViewer.getSelection());
if(result.isEmpty()) {
result.add(editedObject);
}
return result;
}
/** {@inheritDoc} */
@Override
public void setFocus() {
treeViewer.getTree().setFocus();
}
/** Returns treeViewer. */
public TreeViewer getTreeViewer() {
return treeViewer;
}
/**
* This method is used to configure the tree viewer, e.g. set the content
* provider, and the label provider.
*/
protected void setupTreeViewer(TreeViewer treeViewer) {
menuManager = IContextMenuService.getInstance().createDefaultContextMenu(this);
Menu contextMenu = menuManager.createContextMenu(treeViewer.getControl());
treeViewer.getControl().setMenu(contextMenu);
getSite().registerContextMenu(menuManager, treeViewer);
treeViewer.getControl().addKeyListener(new ViewerKeyAdapter());
treeViewer.expandAll();
}
/** Key adapter to deal with copy/paste/delete/... done through the keyboard. */
private class ViewerKeyAdapter extends KeyAdapter {
/** Constructor. */
public ViewerKeyAdapter() {
}
/** {@inheritDoc} */
@Override
public void keyReleased(KeyEvent e) {
if((e.stateMask & SWT.CTRL) != 0 && e.keyCode == 0x63) {
IActionService.getInstance().runGlobalCopyAction();
} else if((e.stateMask & SWT.CTRL) != 0 && e.keyCode == 0x76) {
IActionService.getInstance().runGlobalPasteAction();
} else if(e.keyCode == SWT.DEL) {
IActionService.getInstance().runGlobalDeleteAction();
} else if((e.stateMask & SWT.CTRL) != 0 && e.keyCode == 0x78) {
IActionService.getInstance().runGlobalCutAction();
} else if((e.stateMask & SWT.CTRL) != 0 && e.keyCode == 0x7A) {
IActionService.getInstance().runGlobalUndoAction();
} else if((e.stateMask & SWT.CTRL) != 0 && e.keyCode == 0x79) {