Author: rob.stryker(a)jboss.com
Date: 2010-08-11 05:29:41 -0400 (Wed, 11 Aug 2010)
New Revision: 24037
Added:
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/actions/ExploreActionDelegate.java
Removed:
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/tools/as/rse/
Modified:
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/actions/ExploreUtils.java
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/tools/as/wst/server/ui/xpl/ServerActionProvider.java
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.ui/plugin.xml
Log:
Merging recent changes to trunk into workspace
Added:
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/actions/ExploreActionDelegate.java
===================================================================
---
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/actions/ExploreActionDelegate.java
(rev 0)
+++
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/actions/ExploreActionDelegate.java 2010-08-11
09:29:41 UTC (rev 24037)
@@ -0,0 +1,62 @@
+/*************************************************************************************
+ * Copyright (c) 2008-2009 JBoss by Red Hat and others.
+ * All rights reserved. This program and the accompanying materials
+ * are 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:
+ * JBoss by Red Hat - Initial implementation.
+ ************************************************************************************/
+package org.jboss.ide.eclipse.as.ui.actions;
+
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.IObjectActionDelegate;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.wst.server.core.IServer;
+
+/**
+ * @author Snjeza
+ *
+ */
+public class ExploreActionDelegate implements IObjectActionDelegate {
+
+ private ISelection fCurrentSelection;
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
+ */
+
+ public void run(IAction action) {
+ if (fCurrentSelection instanceof IStructuredSelection) {
+ IStructuredSelection structuredSelection = (IStructuredSelection) fCurrentSelection;
+ Object object = structuredSelection.getFirstElement();
+ if (object instanceof IServer) {
+ IServer server = (IServer) object;
+ String deployDirectory = ExploreUtils.getDeployDirectory(server);
+ if (deployDirectory != null && deployDirectory.length() > 0) {
+ ExploreUtils.explore(deployDirectory);
+ }
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see
org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction,
org.eclipse.jface.viewers.ISelection)
+ */
+
+ public void selectionChanged(IAction action, ISelection selection) {
+ fCurrentSelection= selection;
+ }
+
+ /* (non-Javadoc)
+ * @see
org.eclipse.ui.IObjectActionDelegate#setActivePart(org.eclipse.jface.action.IAction,
org.eclipse.ui.IWorkbenchPart)
+ */
+
+ public void setActivePart(IAction action, IWorkbenchPart targetPart) {
+
+ }
+
+}
Modified:
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/actions/ExploreUtils.java
===================================================================
---
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/actions/ExploreUtils.java 2010-08-11
09:16:07 UTC (rev 24036)
+++
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/actions/ExploreUtils.java 2010-08-11
09:29:41 UTC (rev 24037)
@@ -14,14 +14,14 @@
import java.io.IOException;
import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Status;
import org.eclipse.wst.server.core.IModule;
import org.eclipse.wst.server.core.IServer;
import org.eclipse.wst.server.core.IServerWorkingCopy;
-import org.jboss.ide.eclipse.as.core.publishers.LocalPublishMethod;
import org.jboss.ide.eclipse.as.core.server.IDeployableServer;
-import org.jboss.ide.eclipse.as.core.server.internal.DeployableServerBehavior;
import org.jboss.ide.eclipse.as.core.server.internal.ServerAttributeHelper;
import org.jboss.ide.eclipse.as.core.util.ServerConverter;
import org.jboss.ide.eclipse.as.ui.JBossServerUIPlugin;
@@ -55,12 +55,9 @@
return exploreFileCommand;
}
- @SuppressWarnings("nls")
private static void setExploreCommands() {
if (Platform.OS_MACOSX.equals(Platform.getOS())) {
- exploreFolderCommand = "/usr/bin/open -a /System/Library/CoreServices/Finder.app
\"" //$NON-NLS-1$
- + PATH + "\""; //$NON-NLS-1$
- exploreFileCommand = exploreFolderCommand;
+ exploreFolderCommandArray = new String[] {"/usr/bin/open", "-a",
"/System/Library/CoreServices/Finder.app", ""}; //$NON-NLS-1$
//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
} else if (Platform.OS_WIN32.equals(Platform.getOS())) {
exploreFolderCommand = "cmd /C start explorer /root,/e,\""
//$NON-NLS-1$
+ PATH + "\""; //$NON-NLS-1$
@@ -97,15 +94,12 @@
public static boolean canExplore(IServer server) {
String deployDirectory = ExploreUtils.getDeployDirectory(server);
- if (deployDirectory == null || deployDirectory.length() <= 0) {
+ if (deployDirectory == null || deployDirectory.length() <= 0 && new
File(deployDirectory).exists()) {
return false;
}
if (ExploreUtils.getExploreCommand() == null) {
return false;
}
- DeployableServerBehavior dsb = ServerConverter.getDeployableServerBehavior(server);
- if(
!dsb.createPublishMethod().getPublishMethodType().getId().equals(LocalPublishMethod.LOCAL_PUBLISH_METHOD))
- return false;
return true;
}
@@ -123,12 +117,19 @@
}
try {
- if (Platform.OS_LINUX.equals(Platform.getOS())) {
+ if (Platform.OS_LINUX.equals(Platform.getOS()) ||
Platform.OS_MACOSX.equals(Platform.getOS())) {
int len = exploreFolderCommandArray.length;
exploreFolderCommandArray[len-1] = name;
Runtime.getRuntime().exec(exploreFolderCommandArray);
+ } else if (Platform.getOS().equals(Platform.OS_WIN32)) {
+ command = command.replace(ExploreUtils.PATH, name);
+ Runtime.getRuntime().exec(command);
} else {
command = command.replace(ExploreUtils.PATH, name);
+ if (JBossServerUIPlugin.getDefault().isDebugging()) {
+ IStatus status = new Status(IStatus.WARNING, JBossServerUIPlugin.PLUGIN_ID,
"command=" + command, null); //$NON-NLS-1$
+ JBossServerUIPlugin.getDefault().getLog().log(status);
+ }
Runtime.getRuntime().exec(command);
}
} catch (IOException e) {
@@ -137,7 +138,6 @@
}
}
- @SuppressWarnings("nls")
public static IPath getDeployPath(IDeployableServer server,IModule[] moduleTree) {
IPath root = new Path( server.getDeployFolder() );
String type, name;
Modified:
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/tools/as/wst/server/ui/xpl/ServerActionProvider.java
===================================================================
---
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/tools/as/wst/server/ui/xpl/ServerActionProvider.java 2010-08-11
09:16:07 UTC (rev 24036)
+++
workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/tools/as/wst/server/ui/xpl/ServerActionProvider.java 2010-08-11
09:29:41 UTC (rev 24037)
@@ -137,7 +137,7 @@
clipboard = new Clipboard(tableViewer.getTree().getDisplay());
Shell shell = tableViewer.getTree().getShell();
- actions = new Action[6];
+ actions = new Action[5];
// create the start actions
actions[0] = new StartAction(shell, provider, ILaunchManager.DEBUG_MODE);
actions[1] = new StartAction(shell, provider, ILaunchManager.RUN_MODE);
@@ -148,7 +148,7 @@
// create the publish actions
actions[4] = new PublishAction(shell, provider);
- actions[5] = new ExploreAction(shell,provider);
+ //actions[5] = new ExploreAction(shell,provider);
// create the open action
openAction = new OpenAction(provider);
Modified: workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.ui/plugin.xml
===================================================================
--- workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.ui/plugin.xml 2010-08-11
09:16:07 UTC (rev 24036)
+++ workspace/rstryker/rse/as/plugins/org.jboss.ide.eclipse.as.ui/plugin.xml 2010-08-11
09:29:41 UTC (rev 24037)
@@ -585,4 +585,28 @@
typeIds="%AllJBossServerTypes">
</runtimeLocator>
</extension>
+ <extension point="org.eclipse.ui.popupMenus">
+ <objectContribution
+ adaptable="true"
+ id="org.jboss.ide.eclipse.as.ui.actions.exploreAction"
+ objectClass="org.eclipse.wst.server.core.IServer">
+ <enablement>
+ <adapt type="org.eclipse.wst.server.core.IServer">
+ <test forcePluginActivation="true"
+ property="org.eclipse.wst.server.ui.serverType"
+ value="org.jboss.ide.eclipse.as*" />
+ </adapt>
+ </enablement>
+
+ <action
+ label="Explore"
+ icon="icons/actions/xpl/explore.gif"
+
class="org.jboss.ide.eclipse.as.ui.actions.ExploreActionDelegate"
+ tooltip="Explore"
+
menubarPath="org.eclipse.wst.server.ui.internal.cnf.controlServerSectionEnd"
+ enablesFor="1"
+ id="org.jboss.ide.eclipse.as.ui.actions.ExploreAction">
+ </action>
+ </objectContribution>
+ </extension>
</plugin>