Author: akazakov
Date: 2008-08-26 11:36:02 -0400 (Tue, 26 Aug 2008)
New Revision: 9906
Added:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/refactoring/SeamComponentRenameHandler.java
Removed:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/refactoring/SeamComponentRefactoringHandler.java
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/plugin.xml
Log:
https://jira.jboss.org/jira/browse/JBIDE-1077
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/plugin.xml
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/plugin.xml 2008-08-26 14:18:36 UTC (rev
9905)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/plugin.xml 2008-08-26 15:36:02 UTC (rev
9906)
@@ -565,9 +565,9 @@
<command
commandId="org.jboss.tools.seam.ui.refactoring.component"
id="org.jboss.tools.seam.ui.open.component.submenu"
- label="Refactor Seam Component"
+ label="Rename Seam Component"
style="push"
- tooltip="Refactor Seam Component">
+ tooltip="Rename Seam Component">
</command>
</menu>
</menuContribution>
@@ -577,8 +577,8 @@
point="org.eclipse.ui.commands">
<command
id="org.jboss.tools.seam.ui.refactoring.component"
- description="Seam Refactoring"
- name="Seam Refactoring">
+ description="Seam Component Renaming"
+ name="Seam Component Renaming">
</command>
</extension>
@@ -586,7 +586,7 @@
point="org.eclipse.ui.handlers">
<handler
commandId="org.jboss.tools.seam.ui.refactoring.component"
-
class="org.jboss.tools.seam.ui.refactoring.SeamComponentRefactoringHandler"/>
+
class="org.jboss.tools.seam.ui.refactoring.SeamComponentRenameHandler"/>
</extension>
</plugin>
\ No newline at end of file
Deleted:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/refactoring/SeamComponentRefactoringHandler.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/refactoring/SeamComponentRefactoringHandler.java 2008-08-26
14:18:36 UTC (rev 9905)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/refactoring/SeamComponentRefactoringHandler.java 2008-08-26
15:36:02 UTC (rev 9906)
@@ -1,42 +0,0 @@
- /*******************************************************************************
- * Copyright (c) 2008 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at
http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.seam.ui.refactoring;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.handlers.HandlerUtil;
-
-/**
- * @author Alexey Kazakov
- *
- */
-public class SeamComponentRefactoringHandler extends AbstractHandler {
-
- /* (non-Javadoc)
- * @see
org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
- */
- public Object execute(ExecutionEvent event) throws ExecutionException {
- IWorkbenchPart part = HandlerUtil.getActivePart(event);
- IEditorPart editor = HandlerUtil.getActiveEditor(event);
- ISelection selection = HandlerUtil.getCurrentSelection(event);
-
-// Object context = event.getApplicationContext();
-// if (context instanceof IEvaluationContext) {
-// IEvaluationContext appContext = (IEvaluationContext) context;
-//
-// }
- return null;
- }
-}
\ No newline at end of file
Copied:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/refactoring/SeamComponentRenameHandler.java
(from rev 9899,
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/refactoring/SeamComponentRefactoringHandler.java)
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/refactoring/SeamComponentRenameHandler.java
(rev 0)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/refactoring/SeamComponentRenameHandler.java 2008-08-26
15:36:02 UTC (rev 9906)
@@ -0,0 +1,54 @@
+ /*******************************************************************************
+ * Copyright (c) 2008 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.seam.ui.refactoring;
+
+import java.util.Set;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.handlers.HandlerUtil;
+import org.jboss.tools.seam.core.ISeamComponent;
+import org.jboss.tools.seam.core.ISeamProject;
+import org.jboss.tools.seam.core.SeamCorePlugin;
+
+/**
+ * @author Alexey Kazakov
+ *
+ */
+public class SeamComponentRenameHandler extends AbstractHandler {
+
+ /* (non-Javadoc)
+ * @see
org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+ */
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ IEditorPart editor = HandlerUtil.getActiveEditor(event);
+
+ IEditorInput input = editor.getEditorInput();
+ if(input instanceof IFile) {
+ IFile file = (IFile)input;
+ IProject project = file.getProject();
+ ISeamProject seamProject = SeamCorePlugin.getSeamProject(project, true);
+ if(seamProject!=null) {
+ Set<ISeamComponent> components =
seamProject.getComponentsByPath(file.getFullPath());
+ if(components.size() > 0) {
+ ISeamComponent component = components.iterator().next();
+ // TODO this is a component which we want to rename.
+ }
+ }
+ }
+ return null;
+ }
+}
\ No newline at end of file