</key>\r
</extension>
<extension\r
+ point="org.eclipse.ui.handlers">\r
+ <handler\r
+ class="org.tizen.common.ui.commandbar.textAssist.SelectAllHandler"\r
+ commandId="org.eclipse.ui.edit.selectAll">\r
+ <activeWhen>\r
+ <or>\r
+ <with variable="activeFocusControlId">\r
+ <equals value="org.tizen.common.ui.commandbar.textAssist.TextAssist"/>\r
+ </with>\r
+ </or>\r
+ </activeWhen>\r
+ </handler>\r
+ <handler\r
+ class="org.tizen.common.ui.commandbar.textAssist.CopyHandler"\r
+ commandId="org.eclipse.ui.edit.copy">\r
+ <activeWhen>\r
+ <or>\r
+ <with variable="activeFocusControlId">\r
+ <equals value="org.tizen.common.ui.commandbar.textAssist.TextAssist"/>\r
+ </with>\r
+ </or>\r
+ </activeWhen>\r
+ </handler>\r
+ <handler\r
+ class="org.tizen.common.ui.commandbar.textAssist.CutHandler"\r
+ commandId="org.eclipse.ui.edit.cut">\r
+ <activeWhen>\r
+ <or>\r
+ <with variable="activeFocusControlId">\r
+ <equals value="org.tizen.common.ui.commandbar.textAssist.TextAssist"/>\r
+ </with>\r
+ </or>\r
+ </activeWhen>\r
+ </handler>\r
+ <handler\r
+ class="org.tizen.common.ui.commandbar.textAssist.PasteHandler"\r
+ commandId="org.eclipse.ui.edit.paste">\r
+ <activeWhen>\r
+ <or>\r
+ <with variable="activeFocusControlId">\r
+ <equals value="org.tizen.common.ui.commandbar.textAssist.TextAssist"/>\r
+ </with>\r
+ </or>\r
+ </activeWhen>\r
+ </handler>\r
+ </extension>\r
+ <!-- /Command Bar -->\r
+\r
+ <extension\r
point="org.tizen.common.ui.tipoftheday">\r
<tip\r
file="resources/tips/commandbar.html">\r
--- /dev/null
+/*
+ * Common
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Changhyun Lee <changhyun1.lee@samsung.com>
+ * Hyeongseok Heo <hyeongseok.heo@samsung.com>
+ * BonYong Lee <bonyong.lee@samsung.com>
+ * Kangho Kim <kh5325.kim@samsung.com>
+ *
+ * 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.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+package org.tizen.common.ui.commandbar.textAssist;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.swt.custom.StyledText;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+public class CopyHandler extends AbstractHandler {
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ Object activeFocusControl = HandlerUtil.getVariable(event, "activeFocusControl");
+ if (activeFocusControl instanceof StyledText) {
+ StyledText textWidget = (StyledText) activeFocusControl;
+ textWidget.copy();
+ }
+ return null;
+ }
+}
--- /dev/null
+/*
+ * Common
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Changhyun Lee <changhyun1.lee@samsung.com>
+ * Hyeongseok Heo <hyeongseok.heo@samsung.com>
+ * BonYong Lee <bonyong.lee@samsung.com>
+ * Kangho Kim <kh5325.kim@samsung.com>
+ *
+ * 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.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+package org.tizen.common.ui.commandbar.textAssist;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.swt.custom.StyledText;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+public class CutHandler extends AbstractHandler {
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ Object activeFocusControl = HandlerUtil.getVariable(event, "activeFocusControl");
+ if (activeFocusControl instanceof StyledText) {
+ StyledText textWidget = (StyledText) activeFocusControl;
+ textWidget.cut();
+ }
+ return null;
+ }
+}
--- /dev/null
+/*
+ * Common
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Changhyun Lee <changhyun1.lee@samsung.com>
+ * Hyeongseok Heo <hyeongseok.heo@samsung.com>
+ * BonYong Lee <bonyong.lee@samsung.com>
+ * Kangho Kim <kh5325.kim@samsung.com>
+ *
+ * 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.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+package org.tizen.common.ui.commandbar.textAssist;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.swt.custom.StyledText;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+public class PasteHandler extends AbstractHandler {
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ Object activeFocusControl = HandlerUtil.getVariable(event, "activeFocusControl");
+ if (activeFocusControl instanceof StyledText) {
+ StyledText textWidget = (StyledText) activeFocusControl;
+ textWidget.paste();
+ }
+ return null;
+ }
+}
--- /dev/null
+/*
+ * Common
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Changhyun Lee <changhyun1.lee@samsung.com>
+ * Hyeongseok Heo <hyeongseok.heo@samsung.com>
+ * BonYong Lee <bonyong.lee@samsung.com>
+ * Kangho Kim <kh5325.kim@samsung.com>
+ *
+ * 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.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+package org.tizen.common.ui.commandbar.textAssist;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.swt.custom.StyledText;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+public class SelectAllHandler extends AbstractHandler {
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ Object activeFocusControl = HandlerUtil.getVariable(event, "activeFocusControl");
+ if (activeFocusControl instanceof StyledText) {
+ StyledText textWidget = (StyledText) activeFocusControl;
+ textWidget.selectAll();
+ }
+ return null;
+ }
+}
import org.eclipse.swt.widgets.TableColumn;\r
import org.eclipse.swt.widgets.TableItem;\r
import org.eclipse.swt.widgets.Widget;\r
+import org.eclipse.ui.PlatformUI;\r
+import org.eclipse.ui.swt.IFocusService;\r
import org.tizen.common.util.ArrayUtil;\r
import org.tizen.common.util.CollectionUtil;\r
import org.tizen.common.util.ObjectUtil;\r
// For example,\r
// it works when Connection Explorer view is selected (org.eclipse.ui.internal.handlers.WidgetMethodHandler)\r
// it does not work when Console view is selected (org.eclipse.ui.console.actions.TextViewerAction)\r
- // So, I should implement key listener for CTRL-A, CTRL-C and CTRL-V.\r
- // cf.)) http://wiki.eclipse.org/FAQ_How_do_I_hook_into_global_actions,_such_as_Copy_and_Delete%3F\r
- // Each view or editor is allowed to contribute a handler for these actions; when a new part becomes active, its handler takes control of that action.\r
- text.addListener(SWT.KeyUp, new Listener() {\r
- @Override\r
- public void handleEvent(Event event) {\r
- if (event.stateMask == SWT.MOD1) {\r
- if (event.keyCode == 'A' || event.keyCode == 'a') {\r
- text.selectAll();\r
- }\r
- else if (event.keyCode == 'C' || event.keyCode == 'c') {\r
- text.copy();\r
- }\r
- else if (event.keyCode == 'V' || event.keyCode == 'v') {\r
- text.paste();\r
- }\r
- else if (event.keyCode == 'X' || event.keyCode == 'x') {\r
- text.cut();\r
- }\r
- }\r
- }\r
- });\r
+ // http://www.eclipsezone.com/eclipse/forums/t98133.html\r
+ IFocusService focusService = (IFocusService) PlatformUI.getWorkbench().getService(IFocusService.class);\r
+ // cf.)) plugin.xml 'org.eclipse.ui.handlers' extension\r
+ focusService.addFocusTracker(text, "org.tizen.common.ui.commandbar.textAssist.TextAssist");\r
+\r
addSelectOnFocusToText(text);\r
// Removed gradient by the error 'BadPixmap (invalid Pixmap parameter)'\r
// cf.)) https://bugs.eclipse.org/bugs/show_bug.cgi?id=236324\r