diff options
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/CopyUtils.java')
-rw-r--r-- | bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/CopyUtils.java | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/CopyUtils.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/CopyUtils.java index e1d2c2a51..d4b13da3f 100644 --- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/CopyUtils.java +++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/CopyUtils.java @@ -27,7 +27,7 @@ import org.eclipse.ui.handlers.IHandlerService; import org.eclipse.ui.swt.IFocusService; public class CopyUtils { - public static final String NEWLINE = System.getProperty("line.separator"); //$NON-NLS-1$ + public static final String NEWLINE = System.lineSeparator(); public static final String DELIMITER = "\t"; //$NON-NLS-1$ private static final String NESTING_INDENT = " "; //$NON-NLS-1$ @@ -46,8 +46,9 @@ public class CopyUtils { } /** - * Install a copy popup menu on the specified control and activate the copy handler for the control when - * the control has focus. The handler will be deactivated when the control is disposed. + * Install a copy popup menu on the specified control and activate the copy + * handler for the control when the control has focus. The handler will be + * deactivated when the control is disposed. * * @param copyable the copyable that will perform the copy * @param control the control on which to install the menu and handler @@ -58,18 +59,21 @@ public class CopyUtils { new CopyPopup(copyable, control); if (fs != null && hs != null) { fs.addFocusTracker(control, CONTROL_ID); - final IHandlerActivation handlerActivation = hs.activateHandler(CopyHandler.ID, new CopyHandler(copyable), new Expression() { - @Override - public EvaluationResult evaluate(IEvaluationContext context) { - return context.getVariable(ISources.ACTIVE_FOCUS_CONTROL_NAME) == control ? EvaluationResult.TRUE : EvaluationResult.FALSE; - } + final IHandlerActivation handlerActivation = hs.activateHandler(CopyHandler.ID, new CopyHandler(copyable), + new Expression() { + @Override + public EvaluationResult evaluate(IEvaluationContext context) { + return context.getVariable(ISources.ACTIVE_FOCUS_CONTROL_NAME) == control + ? EvaluationResult.TRUE + : EvaluationResult.FALSE; + } - @Override - public void collectExpressionInfo(final ExpressionInfo info) { - info.addVariableNameAccess(ISources.ACTIVE_FOCUS_CONTROL_NAME); - } + @Override + public void collectExpressionInfo(final ExpressionInfo info) { + info.addVariableNameAccess(ISources.ACTIVE_FOCUS_CONTROL_NAME); + } - }); + }); control.addDisposeListener(e -> hs.deactivateHandler(handlerActivation)); } } |