JBoss Tools SVN: r5958 - trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/server.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2008-01-24 17:22:42 -0500 (Thu, 24 Jan 2008)
New Revision: 5958
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/server/AbstractServerActionDelegate.java
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/server/RefreshServerActionDelegate.java
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/server/RunServerActionDelegate.java
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/server/SelectServerActionDelegate.java
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/server/StopServerActionDelegate.java
Log:
JBIDE-1459 - Start / Stop ignored normal WTP conventions. Classes have *all* been modified to use WTP Server-related Jobs instead of custom jobs, to keep this UI in sync with the Servers view / JBoss Servers View methodology.
Also, much code in these classes was Tomcat specific. That has all been removed.
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/server/AbstractServerActionDelegate.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/server/AbstractServerActionDelegate.java 2008-01-24 22:09:13 UTC (rev 5957)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/server/AbstractServerActionDelegate.java 2008-01-24 22:22:42 UTC (rev 5958)
@@ -10,15 +10,20 @@
******************************************************************************/
package org.jboss.tools.jst.web.ui.action.server;
-import java.util.*;
+import java.util.HashMap;
+import java.util.Map;
+
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.*;
-
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.IWorkbenchWindowActionDelegate;
import org.jboss.tools.common.model.util.ClassLoaderUtil;
import org.jboss.tools.jst.web.WebModelPlugin;
-import org.jboss.tools.jst.web.server.*;
+import org.jboss.tools.jst.web.server.ServerManager;
+import org.jboss.tools.jst.web.server.ServerManagerListener;
public abstract class AbstractServerActionDelegate implements IWorkbenchWindowActionDelegate, ServerManagerListener {
static {
@@ -123,4 +128,22 @@
return null;
}
+
+ // a stub that can be used by subclasses
+ protected static ISelectionProvider getSelectionProvider() {
+ return new ISelectionProvider() {
+ public void addSelectionChangedListener(
+ ISelectionChangedListener listener) {
+ }
+ public ISelection getSelection() {
+ return null;
+ }
+ public void removeSelectionChangedListener(
+ ISelectionChangedListener listener) {
+ }
+ public void setSelection(ISelection selection) {
+ }
+ };
+ }
+
}
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/server/RefreshServerActionDelegate.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/server/RefreshServerActionDelegate.java 2008-01-24 22:09:13 UTC (rev 5957)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/server/RefreshServerActionDelegate.java 2008-01-24 22:22:42 UTC (rev 5958)
@@ -10,25 +10,21 @@
******************************************************************************/
package org.jboss.tools.jst.web.ui.action.server;
-import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.debug.core.ILaunchManager;
import org.eclipse.wst.server.core.IServer;
-import org.jboss.tools.common.model.ServiceDialog;
-import org.jboss.tools.common.model.options.PreferenceModelUtilities;
+import org.eclipse.wst.server.ui.internal.view.servers.StartAction;
import org.jboss.tools.jst.web.messages.xpl.WebUIMessages;
-import org.jboss.tools.jst.web.server.*;
+import org.jboss.tools.jst.web.server.ServerManager;
public class RefreshServerActionDelegate extends AbstractServerActionDelegate {
+ private StartAction delegate;
protected void doRun() {
IServer server = ServerManager.getInstance().getSelectedServer();
if(server == null) return;
- ServiceDialog d = PreferenceModelUtilities.getPreferenceModel().getService();
- try {
- server.restart(getLaunchMode(server), new NullProgressMonitor());
- } catch (Exception e) {
- d.showDialog(WebUIMessages.ERROR, e.getMessage(), new String[]{WebUIMessages.CLOSE}, null, ServiceDialog.ERROR);
- }
+ delegate = new StartAction(window.getShell(), getSelectionProvider(), getLaunchMode(server));
+ if( delegate.accept(server))
+ delegate.perform(server);
}
protected String getLaunchMode(IServer server) {
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/server/RunServerActionDelegate.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/server/RunServerActionDelegate.java 2008-01-24 22:09:13 UTC (rev 5957)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/server/RunServerActionDelegate.java 2008-01-24 22:22:42 UTC (rev 5958)
@@ -10,34 +10,16 @@
******************************************************************************/
package org.jboss.tools.jst.web.ui.action.server;
-import java.util.*;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.debug.core.*;
-import org.eclipse.jdt.launching.IVMInstall;
+import org.eclipse.debug.core.ILaunchManager;
import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.wst.server.core.IRuntime;
import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.server.core.internal.Runtime;
-import org.eclipse.wst.server.core.internal.RuntimeWorkingCopy;
-
-import org.jboss.tools.common.meta.action.SpecialWizard;
-import org.jboss.tools.common.meta.action.SpecialWizardFactory;
-import org.jboss.tools.common.model.ServiceDialog;
-import org.jboss.tools.common.model.options.PreferenceModelUtilities;
-import org.jboss.tools.jst.web.WebModelPlugin;
+import org.eclipse.wst.server.ui.internal.view.servers.StartAction;
import org.jboss.tools.jst.web.messages.xpl.WebUIMessages;
-import org.jboss.tools.jst.web.server.*;
-import org.jboss.tools.jst.web.tomcat.TomcatVMHelper;
-import org.jboss.tools.jst.web.ui.WebUiPlugin;
+import org.jboss.tools.jst.web.server.ServerManager;
public class RunServerActionDelegate extends AbstractServerActionDelegate {
- static Set startingServers = new HashSet();
+ private StartAction delegate;
public void init(IWorkbenchWindow window) {
super.init(window);
update();
@@ -45,28 +27,11 @@
protected void doRun() {
IServer server = ServerManager.getInstance().getSelectedServer();
- if(server == null || startingServers.contains(server.getName())) return;
- ServiceDialog d = PreferenceModelUtilities.getPreferenceModel().getService();
-
- IRuntime runtime = server.getRuntime();
- if(runtime == null) {
- String message = WebUIMessages.RUNTIME_REFERENCED_HAS_BEEN_REMOVED;
- d.showDialog(WebUIMessages.RUN_SERVER, message, new String[]{WebUIMessages.CLOSE}, null, ServiceDialog.WARNING);
+ if(server == null || server.getServerState() != IServer.STATE_STOPPED)
return;
- }
- IStatus status = runtime.validate(new NullProgressMonitor());
-
- if(status.getSeverity() == IStatus.ERROR || status.getSeverity() == IStatus.WARNING) {
- if(!checkToolsJar(runtime)) {
- if(!createJVM(runtime)) return;
- } else {
- int i = d.showDialog(WebUIMessages.RUN_SERVER, status.getMessage(), new String[]{WebUIMessages.RUN, WebUIMessages.CANCEL}, null, ServiceDialog.WARNING);
- if(i != 0) return;
- }
- }
- startingServers.add(server.getName());
- RunServerJob job = new RunServerJob(this, server, getLaunchMode());
- job.schedule();
+ delegate = new StartAction(window.getShell(), getSelectionProvider(), getLaunchMode());
+ if( delegate.accept(server))
+ delegate.perform(server);
updateAll();
}
@@ -78,8 +43,7 @@
IServer selected = ServerManager.getInstance().getSelectedServer();
return (selected != null
&& selected.getServerState() != IServer.STATE_STARTED
- && selected.getServerState() != IServer.STATE_STARTING)
- && !startingServers.contains(selected.getName());
+ && selected.getServerState() != IServer.STATE_STARTING);
}
protected String computeToolTip() {
@@ -88,83 +52,105 @@
return WebUIMessages.START + name;
}
- private boolean checkToolsJar(IRuntime runtime) {
- String id = getVMInstallTypeId(runtime);
- if(id == null) return false;
- IVMInstall vmInstall = TomcatVMHelper.getJVMInstallById(id);
- if(vmInstall == null) return false;
- String jvm = (vmInstall == null) ? null : vmInstall.getInstallLocation().getPath();
- String toolsPath = TomcatVMHelper.findToolsJarInVM(jvm);
- return (toolsPath != null);
- }
- String getVMInstallTypeId(IRuntime runtime) {
- try {
- return ((Runtime)runtime).getAttribute("vm-install-id", (String)null); //$NON-NLS-1$
- } catch (Exception e) {
- WebModelPlugin.getPluginLog().logError(e);
- }
- return null;
- }
- void setVMInstallTypeId(IRuntime runtime, String id, String typeId) {
- try {
- RuntimeWorkingCopy copy = (RuntimeWorkingCopy)runtime.createWorkingCopy();
- copy.setAttribute("vm-install-id", id); //$NON-NLS-1$
- copy.setAttribute("vm-install-type-id", typeId); //$NON-NLS-1$
- copy.save(true, new NullProgressMonitor());
- } catch (Exception e) {
- WebUiPlugin.getPluginLog().logError(e);
- }
- }
+
+
+
+ /*
+ * This code is very Tomcat specific
+ * and arguably unnecessary.
+ * Switching implementation to use WTP API's.
+ *
+ * - rob.stryker
+ */
+
+// private boolean checkToolsJar(IRuntime runtime) {
+// String id = getVMInstallTypeId(runtime);
+// if(id == null) return false;
+// IVMInstall vmInstall = TomcatVMHelper.getJVMInstallById(id);
+// if(vmInstall == null) return false;
+// String jvm = (vmInstall == null) ? null : vmInstall.getInstallLocation().getPath();
+// String toolsPath = TomcatVMHelper.findToolsJarInVM(jvm);
+// return (toolsPath != null);
+// }
+//
+// String getVMInstallTypeId(IRuntime runtime) {
+// try {
+// return ((Runtime)runtime).getAttribute("vm-install-id", (String)null); //$NON-NLS-1$
+// } catch (Exception e) {
+// WebModelPlugin.getPluginLog().logError(e);
+// }
+// return null;
+// }
+// void setVMInstallTypeId(IRuntime runtime, String id, String typeId) {
+// try {
+// RuntimeWorkingCopy copy = (RuntimeWorkingCopy)runtime.createWorkingCopy();
+// copy.setAttribute("vm-install-id", id); //$NON-NLS-1$
+// copy.setAttribute("vm-install-type-id", typeId); //$NON-NLS-1$
+// copy.save(true, new NullProgressMonitor());
+// } catch (Exception e) {
+// WebUiPlugin.getPluginLog().logError(e);
+// }
+// }
+//
+// boolean createJVM(IRuntime runtime) {
+// runtime = runtime.createWorkingCopy();
+// SpecialWizard wizard = SpecialWizardFactory.createSpecialWizard("org.jboss.tools.jst.web.ui.wizards.tomcatvm.TomcatVMWizard"); //$NON-NLS-1$
+// Properties p = new Properties();
+// wizard.setObject(p);
+// int ii = wizard.execute();
+// if(ii != 0) return false;
+// String jvm = p.getProperty("vm"); //$NON-NLS-1$
+// if(jvm != null) jvm = jvm.trim();
+// String name = TomcatVMHelper.createVM(jvm);
+// IVMInstall vm = TomcatVMHelper.getJVMInstall(name);
+// String id = vm.getId();
+// String typeId = vm.getVMInstallType().getId();
+// setVMInstallTypeId(runtime, id, typeId);
+// return true;
+// }
+//
- boolean createJVM(IRuntime runtime) {
- runtime = runtime.createWorkingCopy();
- SpecialWizard wizard = SpecialWizardFactory.createSpecialWizard("org.jboss.tools.jst.web.ui.wizards.tomcatvm.TomcatVMWizard"); //$NON-NLS-1$
- Properties p = new Properties();
- wizard.setObject(p);
- int ii = wizard.execute();
- if(ii != 0) return false;
- String jvm = p.getProperty("vm"); //$NON-NLS-1$
- if(jvm != null) jvm = jvm.trim();
- String name = TomcatVMHelper.createVM(jvm);
- IVMInstall vm = TomcatVMHelper.getJVMInstall(name);
- String id = vm.getId();
- String typeId = vm.getVMInstallType().getId();
- setVMInstallTypeId(runtime, id, typeId);
- return true;
- }
}
-class RunServerJob extends Job {
- IServer server;
- String launchMode;
- RunServerActionDelegate action;
-
- public RunServerJob(RunServerActionDelegate action, IServer server, String launchMode) {
- super(WebUIMessages.RUN_SERVER+ " " + server.getName());
- this.launchMode = launchMode;
- this.server = server;
- this.action = action;
- }
- protected IStatus run(IProgressMonitor monitor) {
- try {
- boolean publishBefore = RegistrationHelper.canPublish(server);
- if(publishBefore) {
- server.publish(IServer.PUBLISH_INCREMENTAL, new NullProgressMonitor());
- }
- server.start(launchMode, new NullProgressMonitor());
- if(!publishBefore) {
- server.publish(IServer.PUBLISH_INCREMENTAL, new NullProgressMonitor());
- }
- } catch (Exception e) {
- return new Status(IStatus.ERROR, "org.jboss.tools.jst.web", 0, WebUIMessages.CANNOT_START_SERVER + e.getMessage(), e); //$NON-NLS-1$
- } finally {
- RunServerActionDelegate.startingServers.remove(server.getName());
- RunServerActionDelegate.updateAll();
- }
- return Status.OK_STATUS;
- }
-
-}
+/*
+ * This class is an inefficient (and less functional)
+ * duplicate of StartAction (inside WTP).
+ *
+ * - rob.stryker
+ */
+
+//class RunServerJob extends Job {
+// IServer server;
+// String launchMode;
+// RunServerActionDelegate action;
+//
+// public RunServerJob(RunServerActionDelegate action, IServer server, String launchMode) {
+// super(WebUIMessages.RUN_SERVER+ " " + server.getName());
+// this.launchMode = launchMode;
+// this.server = server;
+// this.action = action;
+// }
+//
+// protected IStatus run(IProgressMonitor monitor) {
+// try {
+// boolean publishBefore = RegistrationHelper.canPublish(server);
+// if(publishBefore) {
+// server.publish(IServer.PUBLISH_INCREMENTAL, new NullProgressMonitor());
+// }
+// server.start(launchMode, new NullProgressMonitor());
+// if(!publishBefore) {
+// server.publish(IServer.PUBLISH_INCREMENTAL, new NullProgressMonitor());
+// }
+// } catch (Exception e) {
+// return new Status(IStatus.ERROR, "org.jboss.tools.jst.web", 0, WebUIMessages.CANNOT_START_SERVER + e.getMessage(), e); //$NON-NLS-1$
+// } finally {
+// RunServerActionDelegate.startingServers.remove(server.getName());
+// RunServerActionDelegate.updateAll();
+// }
+// return Status.OK_STATUS;
+// }
+//
+//}
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/server/SelectServerActionDelegate.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/server/SelectServerActionDelegate.java 2008-01-24 22:09:13 UTC (rev 5957)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/server/SelectServerActionDelegate.java 2008-01-24 22:22:42 UTC (rev 5958)
@@ -130,13 +130,13 @@
private void newServer() {
NewServerWizard wizard = new NewServerWizard();
ClosableWizardDialog dialog = new ClosableWizardDialog(window.getShell(), wizard);
- if (dialog.open() == Window.CANCEL) {
- return;
+ if (dialog.open() != Window.CANCEL) {
+ IServer server = (IServer)wizard.getRootFragment().getTaskModel().getObject(TaskModel.TASK_SERVER);
+ if(server != null) {
+ ServerManager.getInstance().setSelectedServer(server.getId());
+ update();
+ }
}
- IServer server = (IServer)wizard.getRootFragment().getTaskModel().getObject(TaskModel.TASK_SERVER);
- if(server == null) return;
- ServerManager.getInstance().setSelectedServer(server.getId());
- update();
}
// server images
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/server/StopServerActionDelegate.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/server/StopServerActionDelegate.java 2008-01-24 22:09:13 UTC (rev 5957)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/server/StopServerActionDelegate.java 2008-01-24 22:22:42 UTC (rev 5958)
@@ -10,24 +10,28 @@
******************************************************************************/
package org.jboss.tools.jst.web.ui.action.server;
+import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.wst.server.core.IServer;
-
+import org.eclipse.wst.server.ui.internal.view.servers.StopAction;
import org.jboss.tools.common.model.ServiceDialog;
import org.jboss.tools.common.model.options.PreferenceModelUtilities;
import org.jboss.tools.jst.web.messages.xpl.WebUIMessages;
-import org.jboss.tools.jst.web.server.*;
+import org.jboss.tools.jst.web.server.ServerManager;
public class StopServerActionDelegate extends AbstractServerActionDelegate {
+ protected StopAction delegate;
+ public void init(IWorkbenchWindow window) {
+ super.init(window);
+ update();
+ delegate = new StopAction(window.getShell(), getSelectionProvider());
+ }
+
protected void doRun() {
IServer server = ServerManager.getInstance().getSelectedServer();
if(server == null) return;
- ServiceDialog d = PreferenceModelUtilities.getPreferenceModel().getService();
- try {
- server.stop(false);
- } catch (Exception e) {
- d.showDialog(WebUIMessages.ERROR, e.getMessage(), new String[]{WebUIMessages.CLOSE}, null, ServiceDialog.ERROR);
- }
+ if( delegate.accept(server))
+ delegate.perform(server);
}
protected boolean isActionEnabled() {
16 years, 11 months
JBoss Tools SVN: r5957 - trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/providers.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2008-01-24 17:09:13 -0500 (Thu, 24 Jan 2008)
New Revision: 5957
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/providers/EventLogViewProvider.java
Log:
printout from debug still included. oops.
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/providers/EventLogViewProvider.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/providers/EventLogViewProvider.java 2008-01-24 21:35:20 UTC (rev 5956)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/providers/EventLogViewProvider.java 2008-01-24 22:09:13 UTC (rev 5957)
@@ -277,7 +277,6 @@
this.selection = selection;
if( selection.length == 1 && selection[0] == this.provider) {
menu.add(clearLogAction);
- System.out.println("clear");
}
if( selection.length == 1 && selection[0] instanceof EventLogTreeItem &&
(((EventLogTreeItem)selection[0]).getEventClass().equals(EventLogModel.EVENT_TYPE_EXCEPTION) ||
16 years, 11 months
JBoss Tools SVN: r5956 - trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/providers.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2008-01-24 16:35:20 -0500 (Thu, 24 Jan 2008)
New Revision: 5956
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/providers/EventLogViewProvider.java
Log:
crazy parenthesis error led to Class Cast Exception. Weird.
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/providers/EventLogViewProvider.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/providers/EventLogViewProvider.java 2008-01-24 20:41:24 UTC (rev 5955)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/providers/EventLogViewProvider.java 2008-01-24 21:35:20 UTC (rev 5956)
@@ -275,11 +275,13 @@
public void fillContextMenu(Shell shell, IMenuManager menu, Object selection[]) {
this.selection = selection;
- if( selection.length == 1 && selection[0] == this.provider)
+ if( selection.length == 1 && selection[0] == this.provider) {
menu.add(clearLogAction);
+ System.out.println("clear");
+ }
if( selection.length == 1 && selection[0] instanceof EventLogTreeItem &&
- (((EventLogTreeItem)selection[0]).getEventClass().equals(EventLogModel.EVENT_TYPE_EXCEPTION)) ||
- ((EventLogTreeItem)selection[0]).getSpecificType().equals(EventLogModel.EVENT_TYPE_EXCEPTION)) {
+ (((EventLogTreeItem)selection[0]).getEventClass().equals(EventLogModel.EVENT_TYPE_EXCEPTION) ||
+ ((EventLogTreeItem)selection[0]).getSpecificType().equals(EventLogModel.EVENT_TYPE_EXCEPTION))) {
menu.add(showStackTraceAction);
}
}
16 years, 11 months
JBoss Tools SVN: r5955 - trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/expression.
by jbosstools-commits@lists.jboss.org
Author: dsakovich
Date: 2008-01-24 15:41:24 -0500 (Thu, 24 Jan 2008)
New Revision: 5955
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/expression/VpeFunctionSrc.java
Log:
http://jira.jboss.com/jira/browse/JBIDE-1686
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/expression/VpeFunctionSrc.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/expression/VpeFunctionSrc.java 2008-01-24 19:12:50 UTC (rev 5954)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/expression/VpeFunctionSrc.java 2008-01-24 20:41:24 UTC (rev 5955)
@@ -7,7 +7,7 @@
*
* Contributors:
* Exadel, Inc. and Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
+ ******************************************************************************/
package org.jboss.tools.vpe.editor.template.expression;
import java.io.File;
@@ -34,156 +34,183 @@
import org.jboss.tools.vpe.VpePlugin;
import org.jboss.tools.vpe.editor.context.VpePageContext;
import org.jboss.tools.vpe.editor.css.ResourceReference;
+import org.jboss.tools.vpe.editor.template.VpeCreatorUtil;
import org.w3c.dom.Node;
public class VpeFunctionSrc extends VpeFunction {
static final String IMG_UNRESOLVED = "unresolved.gif";
static final String IMG_PREFIX = "file:///";
- public VpeValue exec(VpePageContext pageContext, Node sourceNode) {
- String tagValue = getParameter(0).exec(pageContext, sourceNode).stringValue();
- tagValue = processValue(pageContext, sourceNode, tagValue);
-
- // decode string from utf
- try {
- tagValue = URLDecoder.decode(tagValue,"UTF-8");
- } catch (UnsupportedEncodingException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
+ public VpeValue exec(VpePageContext pageContext, Node sourceNode) {
+ String tagValue = getParameter(0).exec(pageContext, sourceNode)
+ .stringValue();
+ IFile iFile = VpeCreatorUtil.getFile(tagValue, pageContext);
+ if (iFile != null) {
+ return new VpeValue(getPrefix()+iFile.getLocation().toString());
+ }
+ tagValue = processValue(pageContext, sourceNode, tagValue);
+ // decode string from utf
+ try {
+ tagValue = URLDecoder.decode(tagValue, "UTF-8");
+ } catch (UnsupportedEncodingException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
- IPath tagPath = new Path(tagValue);
- if (tagPath.isEmpty()) return new VpeValue(getUnresolved());
+ IPath tagPath = new Path(tagValue);
+ if (tagPath.isEmpty())
+ return new VpeValue(getUnresolved());
- String device = (tagPath.getDevice()==null?tagPath.segment(0):tagPath.getDevice());
- if (device != null &&
- ("http:".equalsIgnoreCase(device) || "file:".equalsIgnoreCase(device))) return new VpeValue(tagValue);
+ String device = (tagPath.getDevice() == null ? tagPath.segment(0)
+ : tagPath.getDevice());
+ if (device != null
+ && ("http:".equalsIgnoreCase(device) || "file:"
+ .equalsIgnoreCase(device)))
+ return new VpeValue(tagValue);
- File locFile = tagPath.toFile();
- if (locFile.exists()) return new VpeValue(getPrefix() + locFile.getAbsolutePath());
+ File locFile = tagPath.toFile();
+ if (locFile.exists())
+ return new VpeValue(getPrefix() + locFile.getAbsolutePath());
- IEditorInput input = pageContext.getEditPart().getEditorInput();
- IPath inputPath = getInputParentPath(input);
- IPath imgPath = null;
- if (input instanceof ILocationProvider) {
- imgPath = inputPath.append(tagValue);
+ IEditorInput input = pageContext.getEditPart().getEditorInput();
+ IPath inputPath = getInputParentPath(input);
+ IPath imgPath = null;
+ if (input instanceof ILocationProvider) {
+ imgPath = inputPath.append(tagValue);
+ } else {
+ IPath basePath = tagPath.isAbsolute() ? getRootPath(input)
+ : inputPath;
+ if (basePath != null) {
+ imgPath = basePath.append(tagPath);
+ }
+ }
+
+ if (imgPath != null && imgPath.toFile().exists()) {
+ return new VpeValue(getPrefix() + imgPath.toString());
+ } else {
+ IFile file = null;
+ if (input instanceof IFileEditorInput) {
+ file = ((IFileEditorInput) input).getFile();
+ }
+
+ if (null != file) {
+ ResourceReference resourceReference = null;
+ if ("/".equals(tagValue.substring(0, 1))) {
+ resourceReference = pageContext
+ .getRuntimeAbsoluteFolder(file);
+ tagValue = tagValue.substring(1);
} else {
- IPath basePath = tagPath.isAbsolute() ? getRootPath(input) : inputPath;
- if (basePath != null) {
- imgPath = basePath.append(tagPath);
- }
+ resourceReference = pageContext
+ .getRuntimeRelativeFolder(file);
}
- if (imgPath != null && imgPath.toFile().exists()) {
- return new VpeValue(getPrefix() + imgPath.toString());
- } else {
- IFile file = null;
- if (input instanceof IFileEditorInput) {
- file = ((IFileEditorInput)input).getFile();
- }
+ String location = null;
+ if (resourceReference != null) {
+ location = resourceReference.getLocation();
+ }
- if (null != file) {
- ResourceReference resourceReference = null;
- if ("/".equals(tagValue.substring(0, 1))) {
- resourceReference = pageContext.getRuntimeAbsoluteFolder(file);
- tagValue = tagValue.substring(1);
- } else {
- resourceReference = pageContext.getRuntimeRelativeFolder(file);
- }
+ if (null == location && null != file.getLocation()) {
+ location = file.getLocation().toFile().getParent();
+ }
- String location = null;
- if (resourceReference != null) {
- location = resourceReference.getLocation();
- }
-
- if (null == location && null != file.getLocation()) {
- location = file.getLocation().toFile().getParent();
- }
-
- if (null != location) {
- File f = new File(location + File.separator + tagValue);
- if (f.exists()) {
- return new VpeValue(getPrefix() + f.getPath());
- }
- }
+ if (null != location) {
+ File f = new File(location + File.separator + tagValue);
+ if (f.exists()) {
+ return new VpeValue(getPrefix() + f.getPath());
}
}
+ }
+ }
+
+ return new VpeValue(getUnresolved());
+ }
- return new VpeValue(getUnresolved());
+ protected IPath getInputParentPath(IEditorInput input) {
+ IPath inputPath = null;
+ if (input instanceof ILocationProvider) {
+ inputPath = ((ILocationProvider) input).getPath(input);
+ } else if (input instanceof IFileEditorInput) {
+ IFile inputFile = ((IFileEditorInput) input).getFile();
+ if (inputFile != null) {
+ inputPath = inputFile.getLocation();
+ }
}
+ if (inputPath != null && !inputPath.isEmpty()) {
+ inputPath = inputPath.removeLastSegments(1);
+ }
+ return inputPath;
+ }
- protected IPath getInputParentPath(IEditorInput input) {
- IPath inputPath = null;
- if (input instanceof ILocationProvider) {
- inputPath = ((ILocationProvider)input).getPath(input);
- } else if (input instanceof IFileEditorInput) {
- IFile inputFile = ((IFileEditorInput)input).getFile();
- if (inputFile != null) {
- inputPath = inputFile.getLocation();
+ protected IPath getRootPath(IEditorInput input) {
+ IPath rootPath = null;
+ if (input instanceof IFileEditorInput) {
+ IProject project = ((IFileEditorInput) input).getFile()
+ .getProject();
+ if (project != null && project.isOpen()) {
+ IModelNature modelNature = EclipseResourceUtil
+ .getModelNature(project);
+ if (modelNature != null) {
+ XModel model = modelNature.getModel();
+ String rootPathStr = WebProject.getInstance(model)
+ .getWebRootLocation();
+ if (rootPathStr != null) {
+ rootPath = new Path(rootPathStr);
+ } else {
+ rootPath = project.getLocation();
}
+ } else {
+ rootPath = project.getLocation();
}
- if (inputPath != null && !inputPath.isEmpty()) {
- inputPath = inputPath.removeLastSegments(1);
- }
- return inputPath;
+ }
}
-
- protected IPath getRootPath(IEditorInput input) {
- IPath rootPath = null;
- if (input instanceof IFileEditorInput) {
- IProject project = ((IFileEditorInput)input).getFile().getProject();
- if(project != null && project.isOpen()) {
- IModelNature modelNature = EclipseResourceUtil.getModelNature(project);
- if (modelNature != null) {
- XModel model = modelNature.getModel();
- String rootPathStr = WebProject.getInstance(model).getWebRootLocation();
- if(rootPathStr!=null) {
- rootPath = new Path(rootPathStr);
- } else {
- rootPath = project.getLocation();
- }
- } else {
- rootPath = project.getLocation();
- }
- }
- }
- return rootPath;
- }
+ return rootPath;
+ }
- protected String getUnresolved() {
- return IMG_UNRESOLVED;
+ protected String getUnresolved() {
+ return IMG_UNRESOLVED;
+ }
+
+ protected String getPrefix() {
+ return IMG_PREFIX;
+ }
+
+ String processValue(VpePageContext pageContext, Node sourceNode,
+ String tagValue) {
+ String attrName = null;
+ if (getParameter(0) instanceof VpeAttributeOperand) {
+ attrName = ((VpeAttributeOperand) getParameter(0))
+ .getAttributeName();
}
+ String query = (attrName == null) ? null : "/"
+ + sourceNode.getNodeName() + "@" + attrName;
- protected String getPrefix() {
- return IMG_PREFIX;
- }
-
- String processValue(VpePageContext pageContext, Node sourceNode, String tagValue) {
- String attrName = null;
- if(getParameter(0) instanceof VpeAttributeOperand) {
- attrName = ((VpeAttributeOperand)getParameter(0)).getAttributeName();
- }
- String query = (attrName == null) ? null : "/" + sourceNode.getNodeName() + "@" + attrName;
-
- IDocument document = pageContext.getSourceBuilder().getStructuredTextViewer().getDocument();
- if(document == null || query == null) return tagValue;
- WtpKbConnector connector = pageContext.getConnector();
- try {
- AttributeDescriptor descriptor = connector.getAttributeInformation(query);
- if(descriptor == null) return tagValue;
- AttributeValueDescriptor[] ds = descriptor.getValueDesriptors();
- for (int i = 0; i < ds.length; i++) {
- if(!"file".equals(ds[i].getType())) continue;
- ParamList params = ds[i].getParams();
- String[] vs = params.getParamsValues(IFilePathEncoder.PATH_ADDITION);
- if(vs == null || vs.length == 0) continue;
- if(tagValue.startsWith(vs[0])) tagValue = tagValue.substring(vs[0].length());
- }
- } catch (Exception e) {
- VpePlugin.getPluginLog().logError(e);
- }
+ IDocument document = pageContext.getSourceBuilder()
+ .getStructuredTextViewer().getDocument();
+ if (document == null || query == null)
+ return tagValue;
+ WtpKbConnector connector = pageContext.getConnector();
+ try {
+ AttributeDescriptor descriptor = connector
+ .getAttributeInformation(query);
+ if (descriptor == null)
return tagValue;
+ AttributeValueDescriptor[] ds = descriptor.getValueDesriptors();
+ for (int i = 0; i < ds.length; i++) {
+ if (!"file".equals(ds[i].getType()))
+ continue;
+ ParamList params = ds[i].getParams();
+ String[] vs = params
+ .getParamsValues(IFilePathEncoder.PATH_ADDITION);
+ if (vs == null || vs.length == 0)
+ continue;
+ if (tagValue.startsWith(vs[0]))
+ tagValue = tagValue.substring(vs[0].length());
+ }
+ } catch (Exception e) {
+ VpePlugin.getPluginLog().logError(e);
}
-
+ return tagValue;
+ }
+
}
\ No newline at end of file
16 years, 11 months
JBoss Tools SVN: r5954 - in trunk/seam/tests/org.jboss.tools.seam.ui.test: projects/TestSeamELContentAssist/src/action/org/domain/TestSeamELContentAssist/session and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2008-01-24 14:12:50 -0500 (Thu, 24 Jan 2008)
New Revision: 5954
Added:
trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/ca/SeamELContentAssistJbide1676Test.java
Modified:
trunk/seam/tests/org.jboss.tools.seam.ui.test/META-INF/MANIFEST.MF
trunk/seam/tests/org.jboss.tools.seam.ui.test/projects/TestSeamELContentAssist/src/action/org/domain/TestSeamELContentAssist/session/Authenticator.java
trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/SeamUiAllTests.java
Log:
http://jira.jboss.org/jira/browse/JBIDE-1676 Seam completion seem to assume it is always used within XML documents
JUnit Test Case is added for the issue.
Modified: trunk/seam/tests/org.jboss.tools.seam.ui.test/META-INF/MANIFEST.MF
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.ui.test/META-INF/MANIFEST.MF 2008-01-24 19:10:43 UTC (rev 5953)
+++ trunk/seam/tests/org.jboss.tools.seam.ui.test/META-INF/MANIFEST.MF 2008-01-24 19:12:50 UTC (rev 5954)
@@ -35,6 +35,7 @@
org.eclipse.wst.server.core,
org.eclipse.datatools.connectivity,
org.jboss.tools.jst.jsp,
+ org.jboss.tools.jst.jsp.test,
org.eclipse.jdt.ui
Export-Package: org.jboss.tools.seam.ui.test,
org.jboss.tools.seam.ui.test.view,
Modified: trunk/seam/tests/org.jboss.tools.seam.ui.test/projects/TestSeamELContentAssist/src/action/org/domain/TestSeamELContentAssist/session/Authenticator.java
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.ui.test/projects/TestSeamELContentAssist/src/action/org/domain/TestSeamELContentAssist/session/Authenticator.java 2008-01-24 19:10:43 UTC (rev 5953)
+++ trunk/seam/tests/org.jboss.tools.seam.ui.test/projects/TestSeamELContentAssist/src/action/org/domain/TestSeamELContentAssist/session/Authenticator.java 2008-01-24 19:12:50 UTC (rev 5954)
@@ -16,7 +16,7 @@
public boolean authenticate()
{
- log.info("authenticating #0", identity.getUsername());
+ log.info("authenticating #{} #0", identity.getUsername());
//write your authentication logic here,
//return true if the authentication was
//successful, false otherwise
Modified: trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/SeamUiAllTests.java
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/SeamUiAllTests.java 2008-01-24 19:10:43 UTC (rev 5953)
+++ trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/SeamUiAllTests.java 2008-01-24 19:12:50 UTC (rev 5954)
@@ -15,6 +15,7 @@
import junit.framework.TestSuite;
import org.jboss.tools.seam.ui.test.preferences.SeamPreferencesPageTest;
+import org.jboss.tools.seam.ui.test.ca.SeamELContentAssistJbide1676Test;
import org.jboss.tools.seam.ui.test.ca.SeamELContentAssistTest;
import org.jboss.tools.seam.ui.test.hyperlink.SeamViewHyperlinkPartitionerTest;
import org.jboss.tools.seam.ui.test.view.SeamComponentsViewAllTests;
@@ -37,6 +38,7 @@
suite.addTestSuite(SeamPreferencesPageTest.class);
suite.addTestSuite(SeamViewHyperlinkPartitionerTest.class);
suite.addTestSuite(SeamELContentAssistTest.class);
+ suite.addTestSuite(SeamELContentAssistJbide1676Test.class);
return suite;
}
}
Added: trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/ca/SeamELContentAssistJbide1676Test.java
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/ca/SeamELContentAssistJbide1676Test.java (rev 0)
+++ trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/ca/SeamELContentAssistJbide1676Test.java 2008-01-24 19:12:50 UTC (rev 5954)
@@ -0,0 +1,328 @@
+package org.jboss.tools.seam.ui.test.ca;
+
+import java.lang.reflect.Method;
+import java.util.Properties;
+import java.util.Set;
+import java.util.TreeSet;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.jdt.core.IMember;
+import org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.contentassist.ICompletionProposal;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.text.contentassist.IContentAssistant;
+import org.eclipse.jface.text.source.ISourceViewer;
+import org.eclipse.jface.text.source.SourceViewerConfiguration;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.part.FileEditorInput;
+import org.eclipse.ui.texteditor.AbstractTextEditor;
+import org.jboss.tools.common.model.util.EclipseResourceUtil;
+import org.jboss.tools.common.test.util.TestProjectProvider;
+import org.jboss.tools.jst.jsp.test.TestUtil;
+import org.jboss.tools.seam.ui.text.java.SeamELProposalProcessor;
+import org.jboss.tools.test.util.xpl.EditorTestHelper;
+
+public class SeamELContentAssistJbide1676Test extends TestCase {
+ TestProjectProvider provider = null;
+ IProject project = null;
+ boolean makeCopy = false;
+ private static final String PROJECT_NAME = "TestSeamELContentAssist";
+ private static final String JAVA_FILENAME = "org/domain/TestSeamELContentAssist/session/Authenticator.java";
+ private static final String EL_START_TEMPLATE = "#{";
+
+ private static final String[] VALID_SEAM_EL_PROPOSALS = new String[] {
+ "actor",
+ "applicationContext",
+ "authenticator",
+ "businessProcess",
+ "businessProcessContext",
+ "captcha",
+ "conversation",
+ "conversationContext",
+ "conversationList",
+ "conversationStack",
+ "currentDate",
+ "currentDatetime",
+ "currentTime",
+ "entityManager",
+ "eventContext",
+ "events",
+ "expressions",
+ "facesContext",
+ "facesMessages",
+ "httpError",
+ "identity",
+ "image",
+ "interpolator",
+ "isUserInRole",
+ "jbpmContext",
+ "locale",
+ "localeSelector",
+ "mailSession",
+ "messages",
+ "methodContext",
+ "mockSecureEntity",
+ "org.jboss.seam.captcha.captcha",
+ "org.jboss.seam.captcha.captchaImage",
+ "org.jboss.seam.core.actor",
+ "org.jboss.seam.core.applicationContext",
+ "org.jboss.seam.core.businessProcess",
+ "org.jboss.seam.core.businessProcessContext",
+ "org.jboss.seam.core.conversation",
+ "org.jboss.seam.core.conversationContext",
+ "org.jboss.seam.core.conversationEntries",
+ "org.jboss.seam.core.conversationList",
+ "org.jboss.seam.core.conversationStack",
+ "org.jboss.seam.core.dispatcher",
+ "org.jboss.seam.core.ejb",
+ "org.jboss.seam.core.eventContext",
+ "org.jboss.seam.core.events",
+ "org.jboss.seam.core.exceptions",
+ "org.jboss.seam.core.expressions",
+ "org.jboss.seam.core.facesContext",
+ "org.jboss.seam.core.facesMessages",
+ "org.jboss.seam.core.facesPage",
+ "org.jboss.seam.core.httpError",
+ "org.jboss.seam.core.image",
+ "org.jboss.seam.core.init",
+ "org.jboss.seam.core.interpolator",
+ "org.jboss.seam.core.isUserInRole",
+ "org.jboss.seam.core.jbpm",
+ "org.jboss.seam.core.jbpmContext",
+ "org.jboss.seam.core.locale",
+ "org.jboss.seam.core.localeSelector",
+ "org.jboss.seam.core.manager",
+ "org.jboss.seam.core.messages",
+ "org.jboss.seam.core.methodContext",
+ "org.jboss.seam.core.microcontainer",
+ "org.jboss.seam.core.pageContext",
+ "org.jboss.seam.core.pageflow",
+ "org.jboss.seam.core.pages",
+ "org.jboss.seam.core.persistenceContexts",
+ "org.jboss.seam.core.pojoCache",
+ "org.jboss.seam.core.pooledTask",
+ "org.jboss.seam.core.pooledTaskInstanceList",
+ "org.jboss.seam.core.processInstance",
+ "org.jboss.seam.core.processInstanceFinder",
+ "org.jboss.seam.core.processInstanceList",
+ "org.jboss.seam.core.redirect",
+ "org.jboss.seam.core.renderer",
+ "org.jboss.seam.core.resourceBundle",
+ "org.jboss.seam.core.safeActions",
+ "org.jboss.seam.core.sessionContext",
+ "org.jboss.seam.core.switcher",
+ "org.jboss.seam.core.taskInstance",
+ "org.jboss.seam.core.taskInstanceList",
+ "org.jboss.seam.core.taskInstanceListForType",
+ "org.jboss.seam.core.timeZone",
+ "org.jboss.seam.core.timeZoneSelector",
+ "org.jboss.seam.core.transactionListener",
+ "org.jboss.seam.core.transition",
+ "org.jboss.seam.core.uiComponent",
+ "org.jboss.seam.core.userPrincipal",
+ "org.jboss.seam.core.validation",
+ "org.jboss.seam.core.validators",
+ "org.jboss.seam.debug.contexts",
+ "org.jboss.seam.debug.hotDeployFilter",
+ "org.jboss.seam.debug.introspector",
+ "org.jboss.seam.framework.currentDate",
+ "org.jboss.seam.framework.currentDatetime",
+ "org.jboss.seam.framework.currentTime",
+ "org.jboss.seam.ioc.spring.contextLoader",
+ "org.jboss.seam.ioc.spring.springELResolver",
+ "org.jboss.seam.jms.queueConnection",
+ "org.jboss.seam.jms.queueSession",
+ "org.jboss.seam.jms.topicConnection",
+ "org.jboss.seam.jms.topicSession",
+ "org.jboss.seam.mail.mailSession",
+ "org.jboss.seam.pdf.documentStore",
+ "org.jboss.seam.persistence.persistenceProvider",
+ "org.jboss.seam.remoting.messaging.subscriptionRegistry",
+ "org.jboss.seam.remoting.remoting",
+ "org.jboss.seam.security.configuration",
+ "org.jboss.seam.security.identity",
+ "org.jboss.seam.servlet.characterEncodingFilter",
+ "org.jboss.seam.servlet.contextFilter",
+ "org.jboss.seam.servlet.exceptionFilter",
+ "org.jboss.seam.servlet.multipartFilter",
+ "org.jboss.seam.servlet.redirectFilter",
+ "org.jboss.seam.theme.theme",
+ "org.jboss.seam.theme.themeSelector",
+ "org.jboss.seam.ui.entityConverter",
+ "org.jboss.seam.ui.entityConverterStore",
+ "org.jboss.seam.ui.graphicImage.dynamicImageResource",
+ "org.jboss.seam.ui.graphicImage.dynamicImageStore",
+ "org.jboss.seam.ui.resource.webResource",
+ "pageContext",
+ "pageflow",
+ "pdfKeyStore",
+ "pojoCache",
+ "pooledTask",
+ "pooledTaskInstanceList",
+ "processInstance",
+ "processInstanceFinder",
+ "processInstanceList",
+ "queueSession",
+ "redirect",
+ "renderer",
+ "resourceBundle",
+ "securityRules",
+ "sessionContext",
+ "switcher",
+ "taskInstance",
+ "taskInstanceList",
+ "taskInstanceListForType",
+ "TestSeamELContentAssistEntityManagerFactory",
+ "theme",
+ "themeSelector",
+ "timeZone",
+ "timeZoneSelector",
+ "topicSession",
+ "transition",
+ "uiComponent",
+ "userPrincipal",
+ "validation"
+ };
+
+ protected Set<String> getJavaStringValidELProposals() {
+ TreeSet<String> pSet = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER);
+ for (int i = 0; i < VALID_SEAM_EL_PROPOSALS.length; i++) {
+ pSet.add(VALID_SEAM_EL_PROPOSALS[i]);
+ }
+
+ return pSet;
+ }
+
+ public static Test suite() {
+ return new TestSuite(SeamELContentAssistJbide1676Test.class);
+ }
+
+ public void setUp() throws Exception {
+ provider = new TestProjectProvider("org.jboss.tools.seam.ui.test", null, PROJECT_NAME, makeCopy);
+ project = provider.getProject();
+ Throwable exception = null;
+ try {
+ project.refreshLocal(IResource.DEPTH_INFINITE, null);
+ } catch (Exception x) {
+ exception = x;
+ x.printStackTrace();
+ }
+ assertNull("An exception caught: " + (exception != null? exception.getMessage() : ""), exception);
+ }
+
+ protected void tearDown() throws Exception {
+ if(provider != null) {
+ provider.dispose();
+ }
+ }
+
+ public void testSeamELContentAssistJbide1676() {
+ try {
+ EditorTestHelper.joinBackgroundActivities();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ assertTrue("Test project \"" + PROJECT_NAME + "\" is not loaded", (project != null));
+
+ IFolder srcRoot = (IFolder)EclipseResourceUtil.getJavaSourceRoot(project);
+ IFile javaFile = (srcRoot == null ? null : (IFile)srcRoot.findMember(JAVA_FILENAME));
+
+
+ assertTrue("The file \"" + JAVA_FILENAME + "\" is not found", (javaFile != null));
+ assertTrue("The file \"" + JAVA_FILENAME + "\" is not found", (javaFile.exists()));
+
+ FileEditorInput editorInput = new FileEditorInput(javaFile);
+ Throwable exception = null;
+ IEditorPart editorPart = null;
+ try {
+ editorPart = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().openEditor(editorInput, "org.eclipse.jdt.ui.CompilationUnitEditor");
+ } catch (PartInitException ex) {
+ exception = ex;
+ ex.printStackTrace();
+ assertTrue("The Java Editor couldn't be initialized.", false);
+ }
+
+ CompilationUnitEditor javaEditor = null;
+
+ if (editorPart instanceof CompilationUnitEditor)
+ javaEditor = (CompilationUnitEditor)editorPart;
+
+ // Delay for 3 seconds so that
+ // the Favorites view can be seen.
+ try {
+ EditorTestHelper.joinBackgroundActivities();
+ } catch (Exception e) {
+ e.printStackTrace();
+ assertTrue("Waiting for the jobs to complete has failed.", false);
+ }
+ TestUtil.delay(3000);
+
+ ISourceViewer viewer = javaEditor.getViewer();
+ IDocument document = viewer.getDocument();
+ SourceViewerConfiguration config = TestUtil.getSourceViewerConfiguration(javaEditor);
+ IContentAssistant contentAssistant = (config == null ? null : config.getContentAssistant(viewer));
+
+ assertTrue("Cannot get the Content Assistant instance for the editor for file \"" + JAVA_FILENAME + "\"", (contentAssistant != null));
+
+ String documentContent = document.get();
+ int start = (documentContent == null ? -1 : documentContent.indexOf(EL_START_TEMPLATE));
+ int offsetToTest = start + EL_START_TEMPLATE.length();
+
+ assertTrue("Cannot find the starting point in the test file \"" + JAVA_FILENAME + "\"", (start != -1));
+
+ ICompletionProposal[] result= null;
+ String errorMessage = null;
+
+ IContentAssistProcessor p= TestUtil.getProcessor(viewer, offsetToTest, contentAssistant);
+ if (p != null) {
+ try {
+ result= p.computeCompletionProposals(viewer, offsetToTest);
+ } catch (Throwable x) {
+ x.printStackTrace();
+ }
+ errorMessage= p.getErrorMessage();
+ }
+
+// if (errorMessage != null && errorMessage.trim().length() > 0) {
+// System.out.println("#" + offsetToTest + ": ERROR MESSAGE: " + errorMessage);
+// }
+
+ assertTrue("Content Assistant peturned no proposals", (result != null && result.length > 0));
+
+ // compare SeamELCompletionProposals in the result to the filtered valid proposals
+ Set<String> existingProposals = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER);
+ Set<String> nonExistingProposals = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER);
+ Set<String> filteredValidProposals = getJavaStringValidELProposals();
+
+ for (int j = 0; j < result.length; j++) {
+ // Look only for SeamELProposalProcessor proposals
+ if (result[j] instanceof SeamELProposalProcessor.Proposal) {
+ SeamELProposalProcessor.Proposal proposal = (SeamELProposalProcessor.Proposal)result[j];
+ String proposalString = proposal.getPrefixCompletionText(document, offsetToTest).toString();
+
+ if (filteredValidProposals.contains(proposalString)) {
+ existingProposals.add(proposalString);
+ filteredValidProposals.remove(proposalString);
+ } else {
+ nonExistingProposals.add(proposalString);
+ }
+ }
+ }
+ assertTrue("Some Seam EL proposals werent\'t shown in the Content Assistant", filteredValidProposals.isEmpty());
+ assertTrue("Some Seam EL proposals were shown in the Content Assistant but they shouldn\'t", nonExistingProposals.isEmpty());
+
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
+ .closeEditor(editorPart, false);
+ }
+
+}
Property changes on: trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/ca/SeamELContentAssistJbide1676Test.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
16 years, 11 months
JBoss Tools SVN: r5953 - trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/ca.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2008-01-24 14:10:43 -0500 (Thu, 24 Jan 2008)
New Revision: 5953
Modified:
trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/ca/SeamELContentAssistTest.java
Log:
The TestUtil.getSourceViewerConfiguration is used instead of JSPTextEditor.getSourceViewerConfiguationForTest() method.
Modified: trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/ca/SeamELContentAssistTest.java
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/ca/SeamELContentAssistTest.java 2008-01-24 19:08:11 UTC (rev 5952)
+++ trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/ca/SeamELContentAssistTest.java 2008-01-24 19:10:43 UTC (rev 5953)
@@ -34,6 +34,7 @@
import org.jboss.tools.common.test.util.TestProjectProvider;
import org.jboss.tools.jst.jsp.jspeditor.JSPMultiPageEditor;
import org.jboss.tools.jst.jsp.jspeditor.JSPTextEditor;
+import org.jboss.tools.jst.jsp.test.TestUtil;
import org.jboss.tools.seam.ui.text.java.SeamELProposalProcessor;
import org.jboss.tools.test.util.xpl.EditorTestHelper;
@@ -432,7 +433,7 @@
} catch (PartInitException ex) {
exception = ex;
ex.printStackTrace();
- assertTrue("The JSP Visual Editor couln'd be initialized.", false);
+ assertTrue("The JSP Visual Editor couldn't be initialized.", false);
}
JSPMultiPageEditor jspEditor = null;
@@ -449,13 +450,16 @@
e.printStackTrace();
assertTrue("Waiting for the jobs to complete has failed.", false);
}
- delay(3000);
+ TestUtil.delay(3000);
JSPTextEditor jspTextEditor = jspEditor.getJspEditor();
StructuredTextViewer viewer = jspTextEditor.getTextViewer();
IDocument document = viewer.getDocument();
- IContentAssistant contentAssistant = jspTextEditor.getSourceViewerConfigurationForTest().getContentAssistant(viewer);
-
+ SourceViewerConfiguration config = TestUtil.getSourceViewerConfiguration(jspTextEditor);
+ IContentAssistant contentAssistant = (config == null ? null : config.getContentAssistant(viewer));
+
+ assertTrue("Cannot get the Content Assistant instance for the editor for page \"" + PAGE_NAME + "\"", (contentAssistant != null));
+
List<IRegion> regionsToTest = getELRegionsToTest(document);
if (regionsToTest != null) {
for (IRegion region : regionsToTest) {
@@ -473,7 +477,7 @@
ICompletionProposal[] result= null;
String errorMessage = null;
- IContentAssistProcessor p= getProcessor(viewer, offset, contentAssistant);
+ IContentAssistProcessor p= TestUtil.getProcessor(viewer, offset, contentAssistant);
if (p != null) {
try {
result= p.computeCompletionProposals(viewer, offset);
@@ -571,7 +575,7 @@
ICompletionProposal[] result= null;
String errorMessage = null;
- IContentAssistProcessor p= getProcessor(viewer, offset, contentAssistant);
+ IContentAssistProcessor p= TestUtil.getProcessor(viewer, offset, contentAssistant);
if (p != null) {
try {
result= p.computeCompletionProposals(viewer, offset);
@@ -621,50 +625,4 @@
.closeEditor(editorPart, false);
}
-
- private IContentAssistProcessor getProcessor(ITextViewer viewer, int offset, IContentAssistant ca) {
- try {
-
- IDocument document= viewer.getDocument();
- String type= TextUtilities.getContentType(document, ((IContentAssistantExtension)ca).getDocumentPartitioning(), offset, true);
-
- return ca.getContentAssistProcessor(type);
-
- } catch (BadLocationException x) {
- }
-
- return null;
- }
-
- public SourceViewerConfiguration svConfiguration = null;
-
- /**
- * Process UI input but do not return for the specified time interval.
- *
- * @param waitTimeMillis
- * the number of milliseconds
- */
- protected void delay(long waitTimeMillis) {
- Display display = Display.getCurrent();
-
- // If this is the UI thread,
- // then process input.
- if (display != null) {
- long endTimeMillis = System.currentTimeMillis() + waitTimeMillis;
- while (System.currentTimeMillis() < endTimeMillis) {
- if (!display.readAndDispatch())
- display.sleep();
- }
- display.update();
- }
- // Otherwise, perform a simple sleep.
- else {
- try {
- Thread.sleep(waitTimeMillis);
- } catch (InterruptedException e) {
- // Ignored.
- }
- }
- }
-
}
16 years, 11 months
JBoss Tools SVN: r5952 - in trunk/jst/tests/org.jboss.tools.jst.jsp.test: src/org/jboss/tools/jst/jsp/test and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2008-01-24 14:08:11 -0500 (Thu, 24 Jan 2008)
New Revision: 5952
Added:
trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/TestUtil.java
Removed:
trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/JstJspTestUtil.java
Modified:
trunk/jst/tests/org.jboss.tools.jst.jsp.test/META-INF/MANIFEST.MF
trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/JstJspJbide1585Test.java
trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/StrutsJspJbide1648Test.java
Log:
The JstJspTestUtil is moved to TestUtil.
public static SourceViewerConfiguration getSourceViewerConfiguration(AbstractTextEditor editor) method is added to TestUtil class. Use this method to get the SourceViewerConfiguration object on the given editor.
The TestUtil.getSourceViewerConfiguration is used instead of JSPTextEditor.getSourceViewerConfiguationForTest() method.
Modified: trunk/jst/tests/org.jboss.tools.jst.jsp.test/META-INF/MANIFEST.MF
===================================================================
--- trunk/jst/tests/org.jboss.tools.jst.jsp.test/META-INF/MANIFEST.MF 2008-01-24 19:03:54 UTC (rev 5951)
+++ trunk/jst/tests/org.jboss.tools.jst.jsp.test/META-INF/MANIFEST.MF 2008-01-24 19:08:11 UTC (rev 5952)
@@ -16,3 +16,4 @@
org.jboss.tools.jst.jsp,
org.jboss.tools.common.text.ext,
org.jboss.tools.jst.web
+Export-Package: org.jboss.tools.jst.jsp.test
Deleted: trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/JstJspTestUtil.java
===================================================================
--- trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/JstJspTestUtil.java 2008-01-24 19:03:54 UTC (rev 5951)
+++ trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/JstJspTestUtil.java 2008-01-24 19:08:11 UTC (rev 5952)
@@ -1,64 +0,0 @@
-package org.jboss.tools.jst.jsp.test;
-
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.ITextViewer;
-import org.eclipse.jface.text.TextUtilities;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.jface.text.contentassist.IContentAssistant;
-import org.eclipse.jface.text.contentassist.IContentAssistantExtension;
-import org.eclipse.swt.widgets.Display;
-
-public class JstJspTestUtil {
-
-
- /**
- * Returns the CA Processor from content assistant for the given offset in the document.
- *
- *
- * @param viewer
- * @param offset
- * @param ca
- */
-
- public static IContentAssistProcessor getProcessor(ITextViewer viewer, int offset, IContentAssistant ca) {
- try {
- IDocument document= viewer.getDocument();
- String type= TextUtilities.getContentType(document, ((IContentAssistantExtension)ca).getDocumentPartitioning(), offset, true);
- return ca.getContentAssistProcessor(type);
- } catch (BadLocationException x) {
- }
-
- return null;
- }
-
- /**
- * Process UI input but do not return for the specified time interval.
- *
- * @param waitTimeMillis
- * the number of milliseconds
- */
- public static void delay(long waitTimeMillis) {
- Display display = Display.getCurrent();
-
- // If this is the UI thread,
- // then process input.
- if (display != null) {
- long endTimeMillis = System.currentTimeMillis() + waitTimeMillis;
- while (System.currentTimeMillis() < endTimeMillis) {
- if (!display.readAndDispatch())
- display.sleep();
- }
- display.update();
- }
- // Otherwise, perform a simple sleep.
- else {
- try {
- Thread.sleep(waitTimeMillis);
- } catch (InterruptedException e) {
- // Ignored.
- }
- }
- }
-
-}
Copied: trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/TestUtil.java (from rev 5909, trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/JstJspTestUtil.java)
===================================================================
--- trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/TestUtil.java (rev 0)
+++ trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/TestUtil.java 2008-01-24 19:08:11 UTC (rev 5952)
@@ -0,0 +1,88 @@
+package org.jboss.tools.jst.jsp.test;
+
+import java.lang.reflect.Method;
+
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.ITextViewer;
+import org.eclipse.jface.text.TextUtilities;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.text.contentassist.IContentAssistant;
+import org.eclipse.jface.text.contentassist.IContentAssistantExtension;
+import org.eclipse.jface.text.source.SourceViewerConfiguration;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.texteditor.AbstractTextEditor;
+
+public class TestUtil {
+
+
+ /**
+ * Returns the CA Processor from content assistant for the given offset in the document.
+ *
+ *
+ * @param viewer
+ * @param offset
+ * @param ca
+ */
+
+ public static IContentAssistProcessor getProcessor(ITextViewer viewer, int offset, IContentAssistant ca) {
+ try {
+ IDocument document= viewer.getDocument();
+ String type= TextUtilities.getContentType(document, ((IContentAssistantExtension)ca).getDocumentPartitioning(), offset, true);
+ return ca.getContentAssistProcessor(type);
+ } catch (BadLocationException x) {
+ }
+
+ return null;
+ }
+
+ /**
+ * Process UI input but do not return for the specified time interval.
+ *
+ * @param waitTimeMillis
+ * the number of milliseconds
+ */
+ public static void delay(long waitTimeMillis) {
+ Display display = Display.getCurrent();
+
+ // If this is the UI thread,
+ // then process input.
+ if (display != null) {
+ long endTimeMillis = System.currentTimeMillis() + waitTimeMillis;
+ while (System.currentTimeMillis() < endTimeMillis) {
+ if (!display.readAndDispatch())
+ display.sleep();
+ }
+ display.update();
+ }
+ // Otherwise, perform a simple sleep.
+ else {
+ try {
+ Thread.sleep(waitTimeMillis);
+ } catch (InterruptedException e) {
+ // Ignored.
+ }
+ }
+ }
+
+ public static SourceViewerConfiguration getSourceViewerConfiguration(AbstractTextEditor editor) {
+ Class editorClass = editor.getClass();
+ while (editorClass != null) {
+ try {
+ Method m = editorClass.getDeclaredMethod("getSourceViewerConfiguration", new Class[] {});
+
+ if(m != null) {
+ m.setAccessible(true);
+ Object result = m.invoke(editor, new Object[]{});
+ return (result instanceof SourceViewerConfiguration ? (SourceViewerConfiguration)result : null);
+ }
+ } catch (NoSuchMethodException ne) {
+ } catch (Exception e) {
+ }
+ editorClass = editorClass.getSuperclass();
+ }
+ return null;
+
+ }
+
+}
Modified: trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/JstJspJbide1585Test.java
===================================================================
--- trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/JstJspJbide1585Test.java 2008-01-24 19:03:54 UTC (rev 5951)
+++ trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/JstJspJbide1585Test.java 2008-01-24 19:08:11 UTC (rev 5952)
@@ -16,6 +16,7 @@
import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
import org.eclipse.jface.text.contentassist.IContentAssistant;
import org.eclipse.jface.text.contentassist.IContentAssistantExtension;
+import org.eclipse.jface.text.source.SourceViewerConfiguration;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.PartInitException;
@@ -26,7 +27,7 @@
import org.jboss.tools.jst.jsp.contentassist.RedHatCustomCompletionProposal;
import org.jboss.tools.jst.jsp.jspeditor.JSPMultiPageEditor;
import org.jboss.tools.jst.jsp.jspeditor.JSPTextEditor;
-import org.jboss.tools.jst.jsp.test.JstJspTestUtil;
+import org.jboss.tools.jst.jsp.test.TestUtil;
import org.jboss.tools.test.util.xpl.EditorTestHelper;
import junit.framework.Test;
@@ -87,7 +88,7 @@
} catch (PartInitException ex) {
exception = ex;
ex.printStackTrace();
- assertTrue("The JSP Visual Editor couln'd be initialized.", false);
+ assertTrue("The JSP Visual Editor couldn't be initialized.", false);
}
JSPMultiPageEditor jspEditor = null;
@@ -103,13 +104,16 @@
e.printStackTrace();
assertTrue("Waiting for the jobs to complete has failed.", false);
}
- JstJspTestUtil.delay(3000);
+ TestUtil.delay(3000);
JSPTextEditor jspTextEditor = jspEditor.getJspEditor();
StructuredTextViewer viewer = jspTextEditor.getTextViewer();
IDocument document = viewer.getDocument();
- IContentAssistant contentAssistant = jspTextEditor.getSourceViewerConfigurationForTest().getContentAssistant(viewer);
+ SourceViewerConfiguration config = TestUtil.getSourceViewerConfiguration(jspTextEditor);
+ IContentAssistant contentAssistant = (config == null ? null : config.getContentAssistant(viewer));
+ assertTrue("Cannot get the Content Assistant instance for the editor for page \"" + PAGE_NAME + "\"", (contentAssistant != null));
+
// Find start of <ui:define> tag
String documentContent = document.get();
@@ -126,7 +130,7 @@
ICompletionProposal[] result= null;
String errorMessage = null;
- IContentAssistProcessor p= JstJspTestUtil.getProcessor(viewer, offsetToTest, contentAssistant);
+ IContentAssistProcessor p= TestUtil.getProcessor(viewer, offsetToTest, contentAssistant);
if (p != null) {
try {
result= p.computeCompletionProposals(viewer, offsetToTest);
Modified: trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/StrutsJspJbide1648Test.java
===================================================================
--- trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/StrutsJspJbide1648Test.java 2008-01-24 19:03:54 UTC (rev 5951)
+++ trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/StrutsJspJbide1648Test.java 2008-01-24 19:08:11 UTC (rev 5952)
@@ -7,6 +7,7 @@
import org.eclipse.jface.text.contentassist.ICompletionProposal;
import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
import org.eclipse.jface.text.contentassist.IContentAssistant;
+import org.eclipse.jface.text.source.SourceViewerConfiguration;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
@@ -16,7 +17,7 @@
import org.jboss.tools.jst.jsp.contentassist.RedHatCustomCompletionProposal;
import org.jboss.tools.jst.jsp.jspeditor.JSPMultiPageEditor;
import org.jboss.tools.jst.jsp.jspeditor.JSPTextEditor;
-import org.jboss.tools.jst.jsp.test.JstJspTestUtil;
+import org.jboss.tools.jst.jsp.test.TestUtil;
import org.jboss.tools.test.util.xpl.EditorTestHelper;
import junit.framework.Test;
@@ -84,7 +85,7 @@
} catch (PartInitException ex) {
exception = ex;
ex.printStackTrace();
- assertTrue("The JSP Visual Editor couln'd be initialized.", false);
+ assertTrue("The JSP Visual Editor couldn't be initialized.", false);
}
JSPMultiPageEditor jspEditor = null;
@@ -100,18 +101,21 @@
e.printStackTrace();
assertTrue("Waiting for the jobs to complete has failed.", false);
}
- JstJspTestUtil.delay(3000);
+ TestUtil.delay(3000);
JSPTextEditor jspTextEditor = jspEditor.getJspEditor();
StructuredTextViewer viewer = jspTextEditor.getTextViewer();
IDocument document = viewer.getDocument();
- IContentAssistant contentAssistant = jspTextEditor.getSourceViewerConfigurationForTest().getContentAssistant(viewer);
+ SourceViewerConfiguration config = TestUtil.getSourceViewerConfiguration(jspTextEditor);
+ IContentAssistant contentAssistant = (config == null ? null : config.getContentAssistant(viewer));
+ assertTrue("Cannot get the Content Assistant instance for the editor for page \"" + pageName + "\"", (contentAssistant != null));
+
ICompletionProposal[] result= null;
String errorMessage = null;
try {
- IContentAssistProcessor p= JstJspTestUtil.getProcessor(viewer, 0, contentAssistant);
+ IContentAssistProcessor p= TestUtil.getProcessor(viewer, 0, contentAssistant);
if (p != null) {
result= p.computeCompletionProposals(viewer, 0);
errorMessage= p.getErrorMessage();
16 years, 11 months
JBoss Tools SVN: r5951 - trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2008-01-24 14:03:54 -0500 (Thu, 24 Jan 2008)
New Revision: 5951
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPTextEditor.java
Log:
The getSourceViewerConfiguration() method is removed.
To get the configuration use public static SourceViewerConfiguration getSourceViewerConfiguration(AbstractTextEditor editor) method in org.jboss.tools.jst.jsp.test.
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPTextEditor.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPTextEditor.java 2008-01-24 17:46:40 UTC (rev 5950)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPTextEditor.java 2008-01-24 19:03:54 UTC (rev 5951)
@@ -167,11 +167,6 @@
super.setSourceViewerConfiguration(config);
}
- /** This is *only* for allowing unit tests to access the source configuration. */
- public SourceViewerConfiguration getSourceViewerConfigurationForTest () {
- return getSourceViewerConfiguration();
- }
-
protected void initializeDrop(ITextViewer textViewer) {
Composite c = textViewer.getTextWidget();
16 years, 11 months
JBoss Tools SVN: r5950 - in trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces: src/org/jboss/tools/jsf/vpe/richfaces and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: dmaliarevich
Date: 2008-01-24 12:46:40 -0500 (Thu, 24 Jan 2008)
New Revision: 5950
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/orderingList/orderingList.css
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/HtmlComponentUtil.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesOrderingList.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/templates/vpe-templates-richfaces.xml
Log:
http://jira.jboss.com/jira/browse/JBIDE-1579
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/orderingList/orderingList.css
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/orderingList/orderingList.css 2008-01-24 16:27:11 UTC (rev 5949)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/orderingList/orderingList.css 2008-01-24 17:46:40 UTC (rev 5950)
@@ -1,132 +1,3 @@
-.dr-table {
- border-top: 1px solid;
- border-left: 1px solid;
- border-color: #C4C0B9;
-}
-
-.dr-table-cell {
- border-right: 1px solid;
- border-bottom: 1px solid;
- border-color: #C4C0B9;
- padding: 4px 4px 4px 4px;
- font-size: 11px;
- color: #000000;
- font-family: Arial, Verdana, sans-serif;
-}
-
-.dr-subtable-cell {
- border-right: 1px solid;
- border-bottom: 1px solid;
- border-color: #C4C0B9;
- padding: 4px 4px 4px 4px;
- font-size: 11px;
- color: #000000;
- font-family: Arial, Verdana, sans-serif;
-}
-
-.dr-table-header {
- background-color: #D4CFC7;
- background-position: top left;
- background-repeat: repeat-x;
-}
-
-.dr-table-header-continue {
- background-color: #D4CFC7;
-}
-
-.dr-table-headercell {
- border-right: 1px solid;
- border-bottom: 1px solid;
- border-color: #C4C0B9;
- padding: 4px 4px 4px 4px;
- color: #000000;
- text-align: center;
- font-weight: bold;
- font-size: 11px;
- font-family: Arial, Verdana, sans-serif;
-}
-
-.dr-table-subheader {
- background-color: #F1EEE9;
-}
-
-.dr-table-subheadercell {
- border-right: 1px solid;
- border-bottom: 1px solid;
- border-color: #C4C0B9;
- padding: 4px 4px 4px 4px;
- text-align: center;
- font-size: 11px;
- font-color: #000000;
- font-family: Arial, Verdana, sans-serif;
-}
-
-.dr-table-footercell {
- border-right: 1px solid;
- border-bottom: 1px solid;
- border-color: #C4C0B9;
- padding: 4px 4px 4px 4px;
- color: #000000;
- text-align: center;
- font-weight: bold;
- font-size: 11px;
- font-family: Arial, Verdana, sans-serif;
-}
-
-.dr-table-subfootercell {
- border-right: 1px solid;
- border-bottom: 1px solid;
- border-color: #C4C0B9;
- padding: 4px 4px 4px 4px;
- text-align: center;
- font-size: 11px;
- color: #000000;
- font-family: Arial, Verdana, sans-serif;
-}
-
-.dr-subtable-header {
- background-color: #F1EEE9;
-}
-
-.dr-subtable-headercell {
- border-right: 1px solid;
- border-bottom: 1px solid;
- border-color: #C4C0B9;
- padding: 4px 4px 4px 4px;
- text-align: center;
- font-size: 11px;
- color: #000000;
- font-family: Arial, Verdana, sans-serif;
-}
-
-.dr-subtable-footercell {
- border-right: 1px solid;
- border-bottom: 1px solid;
- border-color: #C4C0B9;
- padding: 4px 4px 4px 4px;
- text-align: center;
-}
-
-.dr-spr {
- display: block;
-}
-
-.dr-table-hidden {
- overflow: hidden;
- border: solid 1px #C4C0C9;
-}
-
-.dr-default-caption-text {
- font-size:14px;
- text-align:center;
- font-weight: bold;
-}
-
-.dr-default-control-button-text {
- font-size:11px;
- text-align:left;
-}
-
.dr-buttons-border {
border:1px solid;
margin-bottom:3px;
@@ -137,7 +8,7 @@
white-space: normal;
word-wrap: break-word;
font-weight: bold;
- font-size:14px;
+ font-size:12px;
}
/* BUTTONS DIV */
@@ -150,41 +21,36 @@
}
.rich-ordering-controls {
- border:0px solid;
- margin-bottom:3px;
+ font-family:Arial,Verdana,sans-serif;
+ margin-bottom:2px;
+ background-repeat: repeat-x;
}
.rich-ordering-control-top {
- border:1px solid;
- margin-bottom:3px;
+
}
.rich-ordering-control-bottom {
- border:1px solid;
- margin-bottom:3px;
+
}
.rich-ordering-control-up {
- border:1px solid;
- margin-bottom:3px;
+
}
.rich-ordering-control-down {
- border:1px solid;
- margin-bottom:3px;
+
}
.rich-ordering-list-button {
- background-attachment: scroll;
- color:#000000;
font-family:Arial,Verdana,sans-serif;
font-size:11px;
cursor: pointer;
- border-width:0px;
}
.rich-ordering-list-button-content {
+ font-family:Arial,Verdana,sans-serif;
padding:0pt 4px 0pt 1px;
font-size:11px;
text-align:left;
white-space:nowrap;
- border-width:0px;
+ /*border-width:0px;*/
}
a.rich-ordering-list-button-selection:visited, a.rich-ordering-list-button-selection:link, a.rich-ordering-list-button-a-disabled:visited, a.rich-ordering-list-button-a-disabled:link {
@@ -196,76 +62,60 @@
margin-right:2px;
vertical-align:middle;
}
+*/
-
/* TABLE CONTENT */
+
.rich-ordering-list-body {
- border:0pt solid;
+ /*border:0pt solid;*/
}
.rich-ordering-list-output {
- background-color:#FFFFFF;
+ font-family:Arial,Verdana,sans-serif;
border-color:#C0C0C0;
border-width:1px;
width: 100%;
}
.rich-ordering-list-content {
+ font-family:Arial,Verdana,sans-serif;
overflow:hidden;
width:100%;
}
.rich-ordering-list-header {
+ font-family:Arial,Verdana,sans-serif;
overflow:hidden;
width:100%;
- font-family:Arial,Verdana,sans-serif;
font-size:11px;
text-align: center;
}
.rich-ordering-list-footer {
+ font-family:Arial,Verdana,sans-serif;
overflow:hidden;
width:100%;
- font-family:Arial,Verdana,sans-serif;
font-size:11px;
text-align: center;
}
.rich-ordering-list-table-header {
-
+ background-repeat: repeat-x;
}
.rich-ordering-list-table-header-cell{
- background-color: #E3DED5;
- background-repeat: repeat-x;
- background-attachment: scroll;
- border-bottom-color:#C4C0C9;
- border-bottom-width:1px;
- border-right-color:#C4C0C9;
- border-right-width:1px;
- color:#000000;
font-family:Arial,Verdana,sans-serif;
font-size:11px;
text-align: center;
-
}
.rich-ordering-list-table-footer {
-
+ background-repeat: repeat-x;
}
.rich-ordering-list-table-footer-cell{
- background-color: #E3DED5;
- background-repeat: repeat-x;
- background-attachment: scroll;
- border-bottom-color:#C4C0C9;
- border-bottom-width:1px;
- border-right-color:#C4C0C9;
- border-right-width:1px;
- color:#000000;
font-family:Arial,Verdana,sans-serif;
font-size:11px;
text-align: center;
-
}
.rich-ordering-list-items {
@@ -273,14 +123,12 @@
}
.rich-ordering-list-row {
-
+ font-size:11px;
}
.rich-ordering-list-cell {
- color:#000000;
font-family:Arial,Verdana,sans-serif;
font-size:11px;
- padding:2px;
white-space:normal;
text-align: center;
width: 100%;
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/HtmlComponentUtil.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/HtmlComponentUtil.java 2008-01-24 16:27:11 UTC (rev 5949)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/HtmlComponentUtil.java 2008-01-24 17:46:40 UTC (rev 5950)
@@ -167,4 +167,7 @@
/** HTML_ATTR_VALIGN_MIDDLE_VALUE */
public static final String HTML_ATTR_VALIGN_MIDDLE_VALUE = "middle";
+
+ /** HTML_ATTR_BACKGROUND */
+ public static final String HTML_ATTR_BACKGROUND = "background";
}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesOrderingList.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesOrderingList.java 2008-01-24 16:27:11 UTC (rev 5949)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesOrderingList.java 2008-01-24 17:46:40 UTC (rev 5950)
@@ -28,10 +28,7 @@
final static String DEFAULT_LIST_HEIGHT = "150px";
final static String DEFAULT_LIST_WIDTH = "300px";
-// final static String DEFAULT_LIST_HEIGHT = "100%";
-// final static String DEFAULT_LIST_WIDTH = "100%";
-// final static String DEFAULT_LIST_HEIGHT = "150px";
-// final static String DEFAULT_LIST_WIDTH = "250px";
+
final static String DEFAULT_HEIGHT = "200px";
final static String DEFAULT_WIDTH = "300px";
@@ -49,7 +46,6 @@
final static String CAPTION_STYLE = "captionStyle";
final static String SPACE = " ";
- private static String STYLE_FOR_CAPTOION_LABEL = "white-space: normal; word-wrap: break-word; font-weight: bold; font-size:14px;";
private static String STYLE_FOR_LOW_SCROLL = "overflow: scroll; width: 100%; height: 17px;";
private static String STYLE_FOR_RIGHT_SCROLL = "overflow: scroll; width: 17px; height: 100%;";
@@ -139,8 +135,6 @@
String listWidth = sourceElement.getAttribute(LIST_WIDTH);
String listHeight = sourceElement.getAttribute(LIST_HEIGHT);
- String controlsClass = sourceElement.getAttribute(CONTROLS_CLASS);
-
String controlsType = sourceElement.getAttribute(CONTROLS_TYPE);
String controlsHorizontalAlign = sourceElement.getAttribute(CONTROLS_HORIZONTAL_ALIGN);
String controlsVerticalAlign = sourceElement.getAttribute(CONTROLS_VERTICAL_ALIGN);
@@ -155,26 +149,18 @@
.createElement(HtmlComponentUtil.HTML_TAG_TABLE);
VpeCreationData creationData = new VpeCreationData(tableCommon);
-/*
- nsIDOMElement captionRow = visualDocument
- .createElement(HtmlComponentUtil.HTML_TAG_TR);
- */
+
nsIDOMElement dataRow = visualDocument
.createElement(HtmlComponentUtil.HTML_TAG_TR);
- tableCommon.setAttribute(HtmlComponentUtil.HTML_ATR_WIDTH, (listWidth == null ? DEFAULT_LIST_WIDTH : width));
- tableCommon.setAttribute(HtmlComponentUtil.HTML_ATR_HEIGHT, (listHeight == null ? DEFAULT_LIST_HEIGHT : height));
+ tableCommon.setAttribute(HtmlComponentUtil.HTML_ATR_WIDTH, (width == null ? DEFAULT_WIDTH : width));
+ tableCommon.setAttribute(HtmlComponentUtil.HTML_ATR_HEIGHT, (height == null ? DEFAULT_HEIGHT : height));
tableCommon.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, CSS_LIST_BODY_CLASS);
- //tableCommon.appendChild(captionRow);
tableCommon.appendChild(dataRow);
- // ---------------------row1------------------------
- /*
- nsIDOMElement captionRow_TD = visualDocument
- .createElement(HtmlComponentUtil.HTML_TAG_TD);
- captionRow.appendChild(captionRow_TD);
-*/
+ // ---------------------caption td------------------------
+
nsIDOMElement captionRow_TD_DIV = visualDocument
.createElement(HtmlComponentUtil.HTML_TAG_DIV);
captionRow_TD_DIV.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, CSS_CAPTION_CLASS);
@@ -185,15 +171,13 @@
Element captionFacet = ComponentUtil.getFacet(sourceElement, CAPTION_FACET);
if (null != captionFacet) {
// Creating table caption with facet content
- nsIDOMElement fecetDiv = encodeFacetsToDiv(captionFacet, false, CSS_CAPTION_CLASS, null, creationData, visualDocument);
+ nsIDOMElement fecetDiv = encodeFacetsToDiv(captionFacet, false, CSS_CAPTION_CLASS, "", creationData, visualDocument);
captionRow_TD_DIV.appendChild(fecetDiv);
} else {
captionRow_TD_DIV.appendChild(visualDocument.createTextNode(captionLabel));
}
- //captionRow_TD.appendChild(captionRow_TD_DIV);
-
- // ---------------------row2 ---- with list table and buttons------------------------
+ // ---------------------row with list table and buttons------------------------
nsIDOMElement dataRow_leftTD = visualDocument
.createElement(HtmlComponentUtil.HTML_TAG_TD);
dataRow.appendChild(dataRow_leftTD);
@@ -217,18 +201,22 @@
// ---------------------buttons------------------------
if (!"none".equalsIgnoreCase(controlsType)) {
nsIDOMElement controlsDiv = createControlsDiv(creationData, visualDocument, sourceElement);
- buttonsTD.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, CSS_CONTROLS_CLASS + CSS_BUTTON_VALIGN_CLASS + controlsClass);
+ buttonsTD.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR,
+ CSS_BUTTON_VALIGN_CLASS);
buttonsTD.setAttribute(HtmlComponentUtil.HTML_ALIGN_ATTR, "center");
- buttonsTD.setAttribute(HtmlComponentUtil.HTML_ATTR_VALIGN, ("center"
- .equalsIgnoreCase(controlsVerticalAlign) ? "middle"
- : controlsVerticalAlign));
+
+ if ((null != controlsVerticalAlign) && ("".equals(controlsVerticalAlign))){
+ buttonsTD.setAttribute(HtmlComponentUtil.HTML_ATTR_VALIGN, ("center"
+ .equalsIgnoreCase(controlsVerticalAlign) ? "middle"
+ : controlsVerticalAlign));
+ }
+
buttonsTD.appendChild(controlsDiv);
}
// --------------------------------------------
// ---------------------listTable------------------------
nsIDOMElement listDiv = createListTableDiv(visualDocument, sourceElement, creationData, pageContext);
- //tableListTD.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, CSS_LIST_OUTPUT_CLASS);
tableListTD.appendChild(captionRow_TD_DIV);
tableListTD.appendChild(listDiv);
// --------------------------------------------
@@ -236,6 +224,16 @@
return creationData;
}
+ /**
+ * Creates the list table div.
+ *
+ * @param visualDocument the visual document
+ * @param sourceElement the source element
+ * @param creationData the creation data
+ * @param pageContext the page context
+ *
+ * @return the element
+ */
private nsIDOMElement createListTableDiv(nsIDOMDocument visualDocument,
Element sourceElement, VpeCreationData creationData, VpePageContext pageContext) {
@@ -249,9 +247,7 @@
nsIDOMElement tr2 = visualDocument
.createElement(HtmlComponentUtil.HTML_TAG_TR);
- //listOutputDiv.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, CSS_LIST_OUTPUT_CLASS);
listOutputDiv.setAttribute(HtmlComponentUtil.HTML_STYLE_ATTR, "overflow:hidden;width:100%;");
- //listTable.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, CSS_LIST_CONTENT_CLASS);
listTable.appendChild(tr1);
listTable.appendChild(tr2);
listOutputDiv.appendChild(listTable);
@@ -290,10 +286,18 @@
sourceElement);
tr1_TD1.appendChild(contentDiv);
- //return listTable;
return listOutputDiv;
}
+ /**
+ * Creates the controls div.
+ *
+ * @param creationData the creation data
+ * @param visualDocument the visual document
+ * @param sourceElement the source element
+ *
+ * @return the element
+ */
private nsIDOMElement createControlsDiv( VpeCreationData creationData, nsIDOMDocument visualDocument,
Element sourceElement) {
@@ -313,9 +317,12 @@
boolean showButtonLabels = ComponentUtil.string2boolean(showButtonLabelsStr);
boolean fastOrderControlsVisible = ComponentUtil.string2boolean(fastOrderControlsVisibleStr);
boolean orderControlsVisible = ComponentUtil.string2boolean(orderControlsVisibleStr);
-
+ String controlsClass = sourceElement.getAttribute(CONTROLS_CLASS);
+
nsIDOMElement buttonsDiv = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_DIV);
- buttonsDiv.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, CSS_CONTROLS_CLASS + " " + CSS_BUTTON_LAYOUT_CLASS);
+ buttonsDiv.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR,
+ CSS_CONTROLS_CLASS + " " + controlsClass + " "
+ + CSS_BUTTON_LAYOUT_CLASS);
Element top_control_facet = ComponentUtil.getFacet(sourceElement, TOP_CONTROL_FACET);
Element up_control_facet = ComponentUtil.getFacet(sourceElement, UP_CONTROL_FACET);
@@ -354,19 +361,20 @@
return buttonsDiv;
}
+
/**
- * Creates control button with image and label.
+ * Creates the single button div.
*
- * @param visualDocument
- * visual document
- * @param btnName
- * the button label
- * @param imgName
- * path to the image
- * @param showButtonLabels
- * show button label flag
+ * @param creationData the creation data
+ * @param visualDocument the visual document
+ * @param btnName the btn name
+ * @param imgName the img name
+ * @param showButtonLabels the show button labels
+ * @param buttonFacet the button facet
+ * @param cssStyleName the css style name
+ * @param customStyleClass the custom style class
*
- * @return the button
+ * @return the ns idom element
*/
private nsIDOMElement createSingleButtonDiv(VpeCreationData creationData,
nsIDOMDocument visualDocument, String btnName, String imgName,
@@ -384,14 +392,12 @@
nsIDOMElement img = visualDocument
.createElement(HtmlComponentUtil.HTML_TAG_IMG);
- div1.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, "dr-buttons-border");
+ div1.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, "dr-buttons-border" + " " + cssStyleName + " " + customStyleClass);
div2.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, CSS_BUTTON_CLASS);
- a.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, CSS_BUTTON_SELECTION_CLASS);
- div3.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, CSS_BUTTON_CONTENT_CLASS + " " + cssStyleName + " " + customStyleClass);
+ String resourceFolder = RichFacesTemplatesActivator.getPluginResourcePath();
+ String divStyle = "width: 100%;background-image: url(file://" + resourceFolder + BUTTON_BG + ");";
- String resourceFolder = RichFacesTemplatesActivator.getPluginResourcePath();
- String divStyle = "background-image: url(file://" + resourceFolder + BUTTON_BG + ");";
div2.setAttribute(HtmlComponentUtil.HTML_STYLE_ATTR, divStyle);
div1.appendChild(div2);
@@ -400,10 +406,12 @@
nsIDOMElement fecetDiv = encodeFacetsToDiv(buttonFacet, true, cssStyleName, customStyleClass, creationData, visualDocument);
div2.appendChild(fecetDiv);
} else {
+ a.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, CSS_BUTTON_SELECTION_CLASS);
+ div3.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, CSS_BUTTON_CONTENT_CLASS);
div2.appendChild(a);
a.appendChild(div3);
- // Creating button with image and label
- img.setAttribute("src", "file://" + resourceFolder + imgName);
+ // Creating button with image and label
+ img.setAttribute("src", "file:///" + ComponentUtil.getAbsoluteResourcePath(imgName));
img.setAttribute(HTML.ATTR_WIDTH, "15");
img.setAttribute(HTML.ATTR_HEIGHT, "15");
div3.appendChild(img);
@@ -415,12 +423,17 @@
}
+ /**
+ * Creates the result list.
+ *
+ * @param creationData the creation data
+ * @param visualDocument the visual document
+ * @param sourceElement the source element
+ *
+ * @return the element
+ */
private nsIDOMElement createResultList(VpeCreationData creationData, nsIDOMDocument visualDocument,
Element sourceElement) {
- /*
- nsIDOMElement outputDiv = visualDocument
- .createElement(HtmlComponentUtil.HTML_TAG_DIV);
- */
nsIDOMElement contentDiv = visualDocument
.createElement(HtmlComponentUtil.HTML_TAG_DIV);
@@ -456,7 +469,7 @@
nsIDOMElement tr = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TR);
thead.appendChild(tr);
String styleClass = encodeStyleClass(null,
- CSS_TABLE_HEADER_CLASS + " " + CSS_TABLE_HEADER_CELL_CLASS, null,
+ CSS_HEADER_CLASS + " " + CSS_TABLE_HEADER_CLASS, null,
headerClass);
if (styleClass != null) {
tr.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR,
@@ -464,7 +477,7 @@
}
encodeHeaderOrFooterFacets(creationData, tr, visualDocument,
columnsHeaders,
- CSS_TABLE_HEADER_CLASS + " " + CSS_TABLE_HEADER_CELL_CLASS,
+ CSS_TABLE_HEADER_CELL_CLASS,
headerClass, HEADER, HtmlComponentUtil.HTML_TAG_TD);
}
}
@@ -521,7 +534,9 @@
contentDiv.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR,
CSS_LIST_OUTPUT_CLASS + " " + CSS_LIST_CONTENT_CLASS);
contentTable.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR,
- CSS_LIST_ITEMS_CLASS + listClass);
+ CSS_LIST_ITEMS_CLASS + " " + (null == listClass ? "" : listClass));
+
+ contentTable.setAttribute(HtmlComponentUtil.HTML_CELLSPACING_ATTR, "1");
ComponentUtil.copyAttributes(sourceElement, contentTable);
contentTable.removeAttribute(HtmlComponentUtil.HTML_ATR_HEIGHT);
@@ -531,7 +546,7 @@
for (int i = 0; i < NUM_ROW; i++) {
List<Node> children = ComponentUtil.getChildren(sourceElement);
nsIDOMElement tr = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_TR);
- tr.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, CSS_LIST_ROW_CLASS + rowClasses);
+ tr.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, CSS_LIST_ROW_CLASS + " " + (null == rowClasses ? "" : rowClasses) );
VpeChildrenInfo trInfo = new VpeChildrenInfo(tr);
tbody.appendChild(tr);
creationData.addChildrenInfo(trInfo);
@@ -572,7 +587,19 @@
//return outputDiv;
}
- protected nsIDOMElement encodeFacetsToDiv(Element facetBody,
+ /**
+ * Encodes facets to div.
+ *
+ * @param facetBody the facet body
+ * @param isControlFacet the is control facet
+ * @param cssStyleName the css style name
+ * @param customStyleClass the custom style class
+ * @param creationData the creation data
+ * @param visualDocument the visual document
+ *
+ * @return the element
+ */
+ private nsIDOMElement encodeFacetsToDiv(Element facetBody,
boolean isControlFacet, String cssStyleName,
String customStyleClass, VpeCreationData creationData,
nsIDOMDocument visualDocument) {
@@ -608,21 +635,32 @@
creationData.addChildrenInfo(child);
if (isControlFacet) {
- tr.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, CSS_BUTTON_CLASS);
- td.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, CSS_BUTTON_CONTENT_CLASS + " " + cssStyleName + " " + customStyleClass);
+
+ tr.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR,
+ CSS_BUTTON_CLASS);
+ td.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR,
+ CSS_BUTTON_CONTENT_CLASS + " " + cssStyleName + " "
+ + customStyleClass);
+
+ fecetDiv.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR,
+ CSS_BUTTON_CLASS + " " + CSS_BUTTON_CONTENT_CLASS + " "
+ + cssStyleName + " " + customStyleClass);
+
}
-
}
if (isControlFacet) {
- table.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, CSS_CONTROLS_CLASS + " " + CSS_BUTTON_CONTENT_CLASS);
+ table.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR,
+ CSS_BUTTON_CONTENT_CLASS);
} else {
- table.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, CSS_CAPTION_CLASS);
+ table.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR,
+ CSS_CAPTION_CLASS);
}
table.appendChild(tbody);
fecetDiv.appendChild(table);
return fecetDiv;
+ //return table;
}
/**
@@ -638,7 +676,7 @@
* @param facetBodyClass
* @param element
*/
- protected void encodeTableHeaderOrFooterFacet(VpeCreationData creationData,
+ private void encodeTableHeaderOrFooterFacet(VpeCreationData creationData,
nsIDOMElement parentTheadOrTfood, int columns,
nsIDOMDocument visualDocument, Element facetBody,
String skinFirstRowClass, String skinCellClass,
@@ -698,7 +736,7 @@
* @param facetName
* @param element
*/
- public static void encodeHeaderOrFooterFacets(VpeCreationData creationData,
+ private static void encodeHeaderOrFooterFacets(VpeCreationData creationData,
nsIDOMElement parentTr, nsIDOMDocument visualDocument,
ArrayList<Element> headersOrFooters, String skinCellClass,
String headerClass, String facetName, String element) {
@@ -707,22 +745,15 @@
String columnHeaderClass = column.getAttribute(classAttribute);
nsIDOMElement td = visualDocument.createElement(element);
parentTr.appendChild(td);
+
+ td.setAttribute(HtmlComponentUtil.HTML_ATTR_BACKGROUND, "file:///"
+ + ComponentUtil.getAbsoluteResourcePath(HEADER_CELL_BG));
+
String styleClass = encodeStyleClass(null, skinCellClass,
headerClass, columnHeaderClass);
td.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, styleClass);
td.setAttribute("scop", "col");
- nsIDOMElement div1 = visualDocument
- .createElement(HtmlComponentUtil.HTML_TAG_DIV);
- String resourceFolder = RichFacesTemplatesActivator
- .getPluginResourcePath();
- String div1Style = "background-image: url(file://" + resourceFolder
- + HEADER_CELL_BG + ");";
- div1.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR,
- styleClass);
- div1.setAttribute(HtmlComponentUtil.HTML_STYLE_ATTR, div1Style);
- td.appendChild(div1);
-
String colspan = column
.getAttribute(HtmlComponentUtil.HTML_TABLE_COLSPAN);
if (colspan != null && colspan.length() > 0) {
@@ -730,8 +761,7 @@
}
Element facetBody = ComponentUtil.getFacet(column, facetName);
-// VpeChildrenInfo child = new VpeChildrenInfo(td);
- VpeChildrenInfo child = new VpeChildrenInfo(div1);
+ VpeChildrenInfo child = new VpeChildrenInfo(td);
child.addSourceChild(facetBody);
creationData.addChildrenInfo(child);
}
@@ -742,7 +772,7 @@
* @param parentSourceElement
* @return list of columns
*/
- public static ArrayList<Element> getColumns(Element parentSourceElement) {
+ private static ArrayList<Element> getColumns(Element parentSourceElement) {
ArrayList<Element> columns = new ArrayList<Element>();
NodeList children = parentSourceElement.getChildNodes();
for (int i = 0; i < children.getLength(); i++) {
@@ -761,7 +791,7 @@
* @param facetName
* @return list of columns with facet
*/
- public static ArrayList<Element> getColumnsWithFacet(
+ private static ArrayList<Element> getColumnsWithFacet(
ArrayList<Element> columns, String facetName) {
ArrayList<Element> columnsWithFacet = new ArrayList<Element>();
for (Element column : columns) {
@@ -781,7 +811,7 @@
* @param custom
* @return
*/
- public static String encodeStyleClass(Object parentPredefined,
+ private static String encodeStyleClass(Object parentPredefined,
Object predefined, Object parent, Object custom) {
StringBuffer styleClass = new StringBuffer();
// Construct predefined classes
@@ -809,7 +839,7 @@
* @param columns
* @return
*/
- protected int getColumnsCount(Element sourceElement,
+ private int getColumnsCount(Element sourceElement,
ArrayList<Element> columns) {
int count = 0;
// check for exact value in component
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/templates/vpe-templates-richfaces.xml
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/templates/vpe-templates-richfaces.xml 2008-01-24 16:27:11 UTC (rev 5949)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/templates/vpe-templates-richfaces.xml 2008-01-24 17:46:40 UTC (rev 5950)
@@ -347,10 +347,6 @@
<vpe:tag name="rich:orderingList" case-sensitive="yes">
<vpe:template children="yes" modify="no" class="org.jboss.tools.jsf.vpe.richfaces.template.RichFacesOrderingList">
- <vpe:resize>
- <vpe:width width-attr="listWidth" />
- <vpe:height height-attr="listHeight" />
- </vpe:resize>
<vpe:dnd>
<vpe:drag start-enable="yes" />
<vpe:drop container="yes">
16 years, 11 months
JBoss Tools SVN: r5949 - trunk/hibernatetools/plugins/org.hibernate.eclipse.mapper/src/org/hibernate/eclipse/mapper/extractor.
by jbosstools-commits@lists.jboss.org
Author: vyemialyanchyk
Date: 2008-01-24 11:27:11 -0500 (Thu, 24 Jan 2008)
New Revision: 5949
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.mapper/src/org/hibernate/eclipse/mapper/extractor/PackageHandler.java
Log:
http://jira.jboss.com/jira/browse/JBIDE-1624
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.mapper/src/org/hibernate/eclipse/mapper/extractor/PackageHandler.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.mapper/src/org/hibernate/eclipse/mapper/extractor/PackageHandler.java 2008-01-24 16:10:48 UTC (rev 5948)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.mapper/src/org/hibernate/eclipse/mapper/extractor/PackageHandler.java 2008-01-24 16:27:11 UTC (rev 5949)
@@ -25,6 +25,7 @@
import org.eclipse.jface.text.contentassist.ICompletionProposal;
import org.hibernate.eclipse.hqleditor.CompletionHelper;
import org.hibernate.eclipse.hqleditor.HibernateResultCollector.Settings;
+import org.hibernate.util.StringHelper;
import org.w3c.dom.Node;
class PackageHandler extends JavaTypeHandler {
@@ -36,6 +37,11 @@
public ICompletionProposal[] attributeCompletionProposals(IJavaProject project, Node node, String attributeName, String start, int offset) {
Settings settings = new Settings();
settings.setAcceptPackages(true);
- return CompletionHelper.completeOnJavaTypes(project, settings,extractor.getPackageName(node), start, offset);
+ String packageName = this.extractor.getPackageName(node);
+ if (StringHelper.isEmpty(start) && StringHelper.isNotEmpty(packageName)) {
+ // In case of an empty string we try and code complete the current package
+ start = packageName;
+ }
+ return CompletionHelper.completeOnJavaTypes(project, settings, packageName, start, offset);
}
}
\ No newline at end of file
16 years, 11 months