JBoss Tools SVN: r36284 - trunk/common/tests/org.jboss.tools.common.mylyn.test/src/org/jboss/tools/common/mylyn/test.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2011-11-10 15:47:37 -0500 (Thu, 10 Nov 2011)
New Revision: 36284
Modified:
trunk/common/tests/org.jboss.tools.common.mylyn.test/src/org/jboss/tools/common/mylyn/test/RepositoryTest.java
Log:
JBIDE-9351 Added tests for JIRA connectors for mylyn
Modified: trunk/common/tests/org.jboss.tools.common.mylyn.test/src/org/jboss/tools/common/mylyn/test/RepositoryTest.java
===================================================================
--- trunk/common/tests/org.jboss.tools.common.mylyn.test/src/org/jboss/tools/common/mylyn/test/RepositoryTest.java 2011-11-10 20:47:26 UTC (rev 36283)
+++ trunk/common/tests/org.jboss.tools.common.mylyn.test/src/org/jboss/tools/common/mylyn/test/RepositoryTest.java 2011-11-10 20:47:37 UTC (rev 36284)
@@ -26,7 +26,7 @@
}
// FIXME Enable this test when JIRA connector plugins are added to TP & Update site
- public void _testJIRA() {
+ public void testJIRA() {
TaskRepository repo = TasksUiPlugin.getRepositoryManager().getRepository("jira", "https://issues.jboss.org");
assertNotNull(repo);
}
13 years, 1 month
JBoss Tools SVN: r36283 - trunk/common/tests/org.jboss.tools.common.mylyn.test/META-INF.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2011-11-10 15:47:26 -0500 (Thu, 10 Nov 2011)
New Revision: 36283
Modified:
trunk/common/tests/org.jboss.tools.common.mylyn.test/META-INF/MANIFEST.MF
Log:
JBIDE-9351 Added tests for JIRA connectors for mylyn
Modified: trunk/common/tests/org.jboss.tools.common.mylyn.test/META-INF/MANIFEST.MF
===================================================================
--- trunk/common/tests/org.jboss.tools.common.mylyn.test/META-INF/MANIFEST.MF 2011-11-10 17:43:28 UTC (rev 36282)
+++ trunk/common/tests/org.jboss.tools.common.mylyn.test/META-INF/MANIFEST.MF 2011-11-10 20:47:26 UTC (rev 36283)
@@ -14,9 +14,9 @@
org.eclipse.mylyn.bugzilla.core;bundle-version="3.6.2",
org.eclipse.mylyn.bugzilla.ide;bundle-version="3.6.0",
org.eclipse.mylyn.bugzilla.ui;bundle-version="3.6.0",
- com.atlassian.connector.eclipse.commons.core;bundle-version="3.0.0";resolution:=optional,
- com.atlassian.connector.eclipse.commons.ui;bundle-version="3.0.0";resolution:=optional,
- com.atlassian.connector.eclipse.jira.core;bundle-version="3.0.0";resolution:=optional,
- com.atlassian.connector.eclipse.jira.ui;bundle-version="3.0.0";resolution:=optional
+ com.atlassian.connector.eclipse.commons.core;bundle-version="3.0.0";resolution:=optional;x-installation:=greedy,
+ com.atlassian.connector.eclipse.commons.ui;bundle-version="3.0.0";resolution:=optional;x-installation:=greedy,
+ com.atlassian.connector.eclipse.jira.core;bundle-version="3.0.0";resolution:=optional;x-installation:=greedy,
+ com.atlassian.connector.eclipse.jira.ui;bundle-version="3.0.0";resolution:=optional;x-installation:=greedy
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-Vendor: %providerName
13 years, 1 month
JBoss Tools SVN: r36282 - workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim/src/org/jboss/tools/browsersim.
by jbosstools-commits@lists.jboss.org
Author: yradtsevich
Date: 2011-11-10 12:43:28 -0500 (Thu, 10 Nov 2011)
New Revision: 36282
Modified:
workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim/src/org/jboss/tools/browsersim/BrowserSim.java
Log:
https://issues.jboss.org/browse/JBIDE-9539 : Browsersim app for testing mobile/desktop web apps
- removed import org.eclipse.swt.internal.win32.DLLVERSIONINFO
Modified: workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim/src/org/jboss/tools/browsersim/BrowserSim.java
===================================================================
--- workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim/src/org/jboss/tools/browsersim/BrowserSim.java 2011-11-10 17:35:00 UTC (rev 36281)
+++ workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim/src/org/jboss/tools/browsersim/BrowserSim.java 2011-11-10 17:43:28 UTC (rev 36282)
@@ -34,7 +34,6 @@
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.internal.win32.DLLVERSIONINFO;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Display;
13 years, 1 month
JBoss Tools SVN: r36281 - in workspace/yradtsevich/browsersim/swt-webkit-browsersim: org.jboss.tools.browsersim/src/org/jboss/tools/browsersim and 3 other directories.
by jbosstools-commits@lists.jboss.org
Author: yradtsevich
Date: 2011-11-10 12:35:00 -0500 (Thu, 10 Nov 2011)
New Revision: 36281
Added:
workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim/src/org/jboss/tools/browsersim/Messages.java
workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim/src/org/jboss/tools/browsersim/NLS.java
workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim/src/org/jboss/tools/browsersim/messages.properties
workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim/src/org/jboss/tools/browsersim/resources/config/
workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim/src/org/jboss/tools/browsersim/resources/config/devices.cfg
Modified:
workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim.eclipse/src/org/jboss/tools/browsersim/eclipse/util/BrowserSimLauncher.java
workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim/META-INF/MANIFEST.MF
workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim/src/org/jboss/tools/browsersim/BrowserSim.java
workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim/src/org/jboss/tools/browsersim/DevicesManager.java
workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim/src/org/jboss/tools/browsersim/EditDeviceDialog.java
workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim/src/org/jboss/tools/browsersim/ManageDevicesDialog.java
Log:
https://issues.jboss.org/browse/JBIDE-9539 : Browsersim app for testing mobile/desktop web apps
- externalized dialogs' messages
- added loading of devices list from config file
- added logging to console
Modified: workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim/META-INF/MANIFEST.MF
===================================================================
--- workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim/META-INF/MANIFEST.MF 2011-11-10 16:24:16 UTC (rev 36280)
+++ workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim/META-INF/MANIFEST.MF 2011-11-10 17:35:00 UTC (rev 36281)
@@ -5,6 +5,5 @@
Bundle-Version: 1.0.0.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Require-Bundle: org.eclipse.swt;bundle-version="3.7.0",
- org.jboss.tools.browsersim.webkit;bundle-version="1.0.0",
- org.eclipse.core.runtime;bundle-version="3.7.0"
+ org.jboss.tools.browsersim.webkit;bundle-version="1.0.0"
Export-Package: org.jboss.tools.browsersim
Modified: workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim/src/org/jboss/tools/browsersim/BrowserSim.java
===================================================================
--- workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim/src/org/jboss/tools/browsersim/BrowserSim.java 2011-11-10 16:24:16 UTC (rev 36280)
+++ workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim/src/org/jboss/tools/browsersim/BrowserSim.java 2011-11-10 17:35:00 UTC (rev 36281)
@@ -10,11 +10,12 @@
******************************************************************************/
package org.jboss.tools.browsersim;
+import java.io.File;
+import java.io.IOException;
import java.io.InputStream;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;
-import java.util.List;
import java.util.Observable;
import java.util.Observer;
@@ -33,6 +34,7 @@
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.internal.win32.DLLVERSIONINFO;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Display;
@@ -53,7 +55,7 @@
* @author Yahor Radtsevich (yradtsevich)
*/
public class BrowserSim implements Runnable {
- private static final String DEFAULT_URL = "http://www.w3schools.com/js/tryit_view.asp?filename=try_nav_useragent";
+ private static final String DEFAULT_URL = "http://www.w3schools.com/js/tryit_view.asp?filename=try_nav_useragent"; //$NON-NLS-1$
private AbstractWebKitBrowser browser;
private Display display;
private Shell shell;
@@ -89,7 +91,7 @@
@Override
public void run() {
shell = new Shell(display);
- shell.setText("BrowserSim");
+ shell.setText(Messages.BrowserSim_BROWSER_SIM);
GridLayout gridLayout = new GridLayout();
gridLayout.numColumns = 3;
shell.setLayout(gridLayout);
@@ -105,7 +107,7 @@
toolbar.setLayoutData(data);
Label labelAddress = new Label(shell, SWT.NONE);
- labelAddress.setText("Address");
+ labelAddress.setText(Messages.BrowserSim_ADDRESS);
locationText = new Text(shell, SWT.BORDER);
data = new GridData();
@@ -118,7 +120,7 @@
try {
browser = WebKitBrowserFactory.createWebKitBrowser(shell, SWT.NONE);
} catch (SWTError e) {
- System.out.println("Could not instantiate Browser: " + e.getMessage());
+ System.out.println(Messages.BrowserSim_COULD_NOT_INSTANTIATE_BROWSER + e.getMessage());
display.dispose();
return;
}
@@ -228,11 +230,11 @@
}
});
- final Image imageBack = new Image(display, getResourceAsStream("/org/jboss/tools/browsersim/resources/icons/nav_backward.gif"));
- final Image imageForward = new Image(display, getResourceAsStream("/org/jboss/tools/browsersim/resources/icons/nav_forward.gif"));
- final Image imageStop = new Image(display, getResourceAsStream("/org/jboss/tools/browsersim/resources/icons/nav_stop.gif"));
- final Image imageRefresh = new Image(display, getResourceAsStream("/org/jboss/tools/browsersim/resources/icons/nav_refresh.gif"));
- final Image imageGo = new Image(display, getResourceAsStream("/org/jboss/tools/browsersim/resources/icons/nav_go.gif"));
+ final Image imageBack = new Image(display, getResourceAsStream("/org/jboss/tools/browsersim/resources/icons/nav_backward.gif")); //$NON-NLS-1$
+ final Image imageForward = new Image(display, getResourceAsStream("/org/jboss/tools/browsersim/resources/icons/nav_forward.gif")); //$NON-NLS-1$
+ final Image imageStop = new Image(display, getResourceAsStream("/org/jboss/tools/browsersim/resources/icons/nav_stop.gif")); //$NON-NLS-1$
+ final Image imageRefresh = new Image(display, getResourceAsStream("/org/jboss/tools/browsersim/resources/icons/nav_refresh.gif")); //$NON-NLS-1$
+ final Image imageGo = new Image(display, getResourceAsStream("/org/jboss/tools/browsersim/resources/icons/nav_go.gif")); //$NON-NLS-1$
itemBack.setImage(imageBack);
itemForward.setImage(imageForward);
@@ -258,18 +260,22 @@
private InputStream getResourceAsStream(String name) {
return this.getClass().getResourceAsStream(name);
}
+
+ private File getResourceAsFile(String name) {
+ return new File(this.getClass().getResource(name).getFile());
+ }
public void fillMenuBar(Menu appMenuBar) {
- Menu file = createDropDownMenu(appMenuBar, "File");
+ Menu file = createDropDownMenu(appMenuBar, Messages.BrowserSim_FILE);
MenuItem exit = new MenuItem(file, SWT.PUSH);
- exit.setText("Exit");
+ exit.setText(Messages.BrowserSim_EXIT);
exit.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
display.dispose();
};
});
- devicesMenu = createDropDownMenu(appMenuBar, "Devices");
+ devicesMenu = createDropDownMenu(appMenuBar, Messages.BrowserSim_DEVICES);
devicesManager = DevicesManager.getInstance();
devicesManager.addObserver(new Observer() {
public void update(Observable o, Object arg) {
@@ -284,12 +290,20 @@
});
}
});
- devicesManager.setDevicesList(DevicesManager.getDefaultDevicesList());
+
+ DevicesList devicesList;
+ try {
+ devicesList = DevicesManager.loadDevicesList(getResourceAsFile(
+ "/org/jboss/tools/browsersim/resources/config/devices.cfg"));
+ } catch (IOException e) {
+ devicesList = new DevicesList(new ArrayList<Device>(), 0);
+ }
+ devicesManager.setDevicesList(devicesList);
devicesManager.notifyObservers();
new MenuItem(devicesMenu, SWT.BAR);
MenuItem manageDevicesMenuItem = new MenuItem(devicesMenu, SWT.PUSH);
- manageDevicesMenuItem.setText("Manage Devices...");
+ manageDevicesMenuItem.setText(Messages.BrowserSim_MORE);
manageDevicesMenuItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
DevicesList newDevicesList = new ManageDevicesDialog(shell, SWT.APPLICATION_MODAL | SWT.SHELL_TRIM,
Modified: workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim/src/org/jboss/tools/browsersim/DevicesManager.java
===================================================================
--- workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim/src/org/jboss/tools/browsersim/DevicesManager.java 2011-11-10 16:24:16 UTC (rev 36280)
+++ workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim/src/org/jboss/tools/browsersim/DevicesManager.java 2011-11-10 17:35:00 UTC (rev 36281)
@@ -52,15 +52,12 @@
}
}
- public static DevicesList getDefaultDevicesList() {
- List<Device> devices = new ArrayList<Device>();
- devices.add(new Device("Apple iPhone 3", 320, 480, IPHONE_OS_4_0_USER_AGENT));
- devices.add(new Device("Apple iPhone 4", 640, 960, IPHONE_OS_4_0_USER_AGENT));
- devices.add(new Device("BlackBerry Bold Touch 9900", 640, 480, "Mozilla/5.0 (BlackBerry; U; BlackBerry 9900; en-US) AppleWebKit/534.1+ (KHTML, like Gecko) Version/6.0.0.246 Mobile Safari/534.1+"));
- devices.add(new Device("Samsung Galaxy S II", 640, 800, "Mozilla/5.0 (Linux; U; Android 2.3; en-us; GT-I9100 Build/GRH78) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1"));
-
- return new DevicesList(devices, 0);
- }
+// List<Device> devices = new ArrayList<Device>();
+// devices.add(new Device("Apple iPhone 3", 320, 480, IPHONE_OS_4_0_USER_AGENT));
+// devices.add(new Device("Apple iPhone 4", 640, 960, IPHONE_OS_4_0_USER_AGENT));
+// devices.add(new Device("BlackBerry Bold Touch 9900", 640, 480, "Mozilla/5.0 (BlackBerry; U; BlackBerry 9900; en-US) AppleWebKit/534.1+ (KHTML, like Gecko) Version/6.0.0.246 Mobile Safari/534.1+"));
+// devices.add(new Device("Samsung Galaxy S II", 640, 800, "Mozilla/5.0 (Linux; U; Android 2.3; en-us; GT-I9100 Build/GRH78) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1"));
+
public static String encode(String string) {
return string.replace("\\", "\\\\").replace("\n", "\\n").replace("\t", "\\t");
@@ -91,6 +88,8 @@
result.append(c0);
break;
}
+ } else {
+ result.append(c0);
}
i++;
}
@@ -130,7 +129,7 @@
if (nextLine != null) {
selectedDeviceIndex = Integer.parseInt(nextLine);
}
- Pattern devicePattern = Pattern.compile("(.*)\\t([0-9]*)\\t([0-9]*)\\t(.*)");
+ Pattern devicePattern = Pattern.compile("^(.*)\\t([0-9]*)\\t([0-9]*)\\t(.*)$");
List<Device> devices = new ArrayList<Device>();
while ((nextLine = reader.readLine()) != null) {
Modified: workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim/src/org/jboss/tools/browsersim/EditDeviceDialog.java
===================================================================
--- workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim/src/org/jboss/tools/browsersim/EditDeviceDialog.java 2011-11-10 16:24:16 UTC (rev 36280)
+++ workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim/src/org/jboss/tools/browsersim/EditDeviceDialog.java 2011-11-10 17:35:00 UTC (rev 36281)
@@ -34,7 +34,7 @@
*/
public EditDeviceDialog(Shell parent, int style, Device initialDevice) {
super(parent, style);
- setText("SWT Dialog");
+ setText(Messages.EditDeviceDialog_MANAGE_DEVICES);
this.initialDevice = initialDevice;
}
@@ -63,12 +63,12 @@
private void createContents() {
shell = new Shell(getParent(), SWT.DIALOG_TRIM | SWT.MIN | SWT.MAX);
shell.setSize(450, 300);
- shell.setText("Edit Device");
+ shell.setText(Messages.EditDeviceDialog_EDIT_DEVICE);
shell.setLayout(new GridLayout(2, false));
Label labelName = new Label(shell, SWT.NONE);
labelName.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
- labelName.setText("Name:");
+ labelName.setText(Messages.EditDeviceDialog_NAME);
textName = new Text(shell, SWT.BORDER);
textName.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
@@ -77,7 +77,7 @@
Label labelWidth = new Label(shell, SWT.NONE);
labelWidth.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
- labelWidth.setText("Width:");
+ labelWidth.setText(Messages.EditDeviceDialog_WIDTH);
textWidth = new Text(shell, SWT.BORDER);
textWidth.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
@@ -89,7 +89,7 @@
Label labelHeight = new Label(shell, SWT.NONE);
labelHeight.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
- labelHeight.setText("Height:");
+ labelHeight.setText(Messages.EditDeviceDialog_HEIGHT);
textHeight = new Text(shell, SWT.BORDER);
textHeight.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
@@ -101,7 +101,7 @@
Label labelUseragent = new Label(shell, SWT.NONE);
labelUseragent.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
- labelUseragent.setText("User-Agent:");
+ labelUseragent.setText(Messages.EditDeviceDialog_USER_AGENT);
textUserAgent = new Text(shell, SWT.BORDER);
textUserAgent.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
@@ -113,7 +113,7 @@
composite.setLayoutData(new GridData(SWT.RIGHT, SWT.BOTTOM, true, true, 2, 1));
Button buttonOk = new Button(composite, SWT.NONE);
- buttonOk.setText("OK");
+ buttonOk.setText(Messages.EditDeviceDialog_OK);
buttonOk.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
resultDevice = new Device(textName.getText(), Integer.valueOf(textWidth.getText()),
@@ -124,7 +124,7 @@
shell.setDefaultButton(buttonOk);
Button buttonCancel = new Button(composite, SWT.NONE);
- buttonCancel.setText("Cancel");
+ buttonCancel.setText(Messages.EditDeviceDialog_CANCEL);
buttonCancel.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
resultDevice = null;
@@ -149,7 +149,7 @@
public void focusLost(FocusEvent e) {
Text text = ((Text) e.widget);
if (text.getText().trim().isEmpty()) {
- text.setText("0");
+ text.setText("0"); //$NON-NLS-1$
}
}
}
Modified: workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim/src/org/jboss/tools/browsersim/ManageDevicesDialog.java
===================================================================
--- workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim/src/org/jboss/tools/browsersim/ManageDevicesDialog.java 2011-11-10 16:24:16 UTC (rev 36280)
+++ workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim/src/org/jboss/tools/browsersim/ManageDevicesDialog.java 2011-11-10 17:35:00 UTC (rev 36281)
@@ -47,7 +47,7 @@
*/
public ManageDevicesDialog(Shell parent, int style, DevicesList oldDevicesList) {
super(parent, style);
- setText("Devices");
+ setText(Messages.ManageDevicesDialog_DEVICES);
this.oldDevicesList = oldDevicesList;
this.devices = new ArrayList<Device>(oldDevicesList.getDevices());
this.selectedDeviceIndex = oldDevicesList.getSelectedDeviceIndex();
@@ -91,30 +91,30 @@
TableColumn tableColumnName = new TableColumn(table, SWT.NONE);
tableColumnName.setWidth(100);
- tableColumnName.setText("Name");
+ tableColumnName.setText(Messages.ManageDevicesDialog_NAME);
TableColumn tableColumnWidth = new TableColumn(table, SWT.NONE);
tableColumnWidth.setWidth(100);
- tableColumnWidth.setText("Width");
+ tableColumnWidth.setText(Messages.ManageDevicesDialog_WIDTH);
TableColumn tableColumnHeight = new TableColumn(table, SWT.NONE);
tableColumnHeight.setWidth(100);
- tableColumnHeight.setText("Height");
+ tableColumnHeight.setText(Messages.ManageDevicesDialog_HEIGHT);
TableColumn tableColumnUseragent = new TableColumn(table, SWT.NONE);
tableColumnUseragent.setWidth(100);
- tableColumnUseragent.setText("User-Agent");
+ tableColumnUseragent.setText(Messages.ManageDevicesDialog_USER_AGENT);
Composite compositeControls = new Composite(shell, SWT.NONE);
compositeControls.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false, 1, 1));
compositeControls.setLayout(new FillLayout(SWT.VERTICAL));
Button buttonAdd = new Button(compositeControls, SWT.NONE);
- buttonAdd.setText("Add");
+ buttonAdd.setText(Messages.ManageDevicesDialog_ADD);
buttonAdd.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
Device newDevice = new EditDeviceDialog(shell, SWT.APPLICATION_MODAL | SWT.SHELL_TRIM,
- new Device("Some Device", 480, 800, "Some User Agent")).open();
+ new Device(Messages.ManageDevicesDialog_NEW_DEVICE, 480, 800, Messages.ManageDevicesDialog_NEW_USER_AGENT)).open();
if (newDevice != null) {
devices.add(newDevice);
selectedDeviceIndex = devices.size() - 1;
@@ -124,7 +124,7 @@
});
Button buttonEdit = new Button(compositeControls, SWT.NONE);
- buttonEdit.setText("Edit");
+ buttonEdit.setText(Messages.ManageDevicesDialog_EDIT);
buttonEdit.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
Device newDevice = new EditDeviceDialog(shell, SWT.APPLICATION_MODAL | SWT.SHELL_TRIM,
@@ -138,7 +138,7 @@
});
Button buttonRemove = new Button(compositeControls, SWT.NONE);
- buttonRemove.setText("Remove");
+ buttonRemove.setText(Messages.ManageDevicesDialog_REMOVE);
buttonRemove.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
System.out.println(devices.size());
@@ -153,7 +153,7 @@
});
Button buttonReset = new Button(compositeControls, SWT.NONE);
- buttonReset.setText("Reset");
+ buttonReset.setText(Messages.ManageDevicesDialog_RESET);
buttonReset.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
devices = new ArrayList<Device>(oldDevicesList.getDevices());
@@ -167,7 +167,7 @@
compositeOkCancel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 2, 1));
Button buttonOk = new Button(compositeOkCancel, SWT.NONE);
- buttonOk.setText("OK");
+ buttonOk.setText(Messages.ManageDevicesDialog_OK);
shell.setDefaultButton(buttonOk);
buttonOk.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
@@ -177,7 +177,7 @@
});
Button buttonCancel = new Button(compositeOkCancel, SWT.NONE);
- buttonCancel.setText("Cancel");
+ buttonCancel.setText(Messages.ManageDevicesDialog_CANCEL);
buttonCancel.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
resultDevicesList = null;
Added: workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim/src/org/jboss/tools/browsersim/Messages.java
===================================================================
--- workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim/src/org/jboss/tools/browsersim/Messages.java (rev 0)
+++ workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim/src/org/jboss/tools/browsersim/Messages.java 2011-11-10 17:35:00 UTC (rev 36281)
@@ -0,0 +1,39 @@
+package org.jboss.tools.browsersim;
+
+public class Messages {
+ private static final String BUNDLE_NAME = "org.jboss.tools.browsersim.messages"; //$NON-NLS-1$
+ public static String BrowserSim_ADDRESS;
+ public static String BrowserSim_BROWSER_SIM;
+ public static String BrowserSim_COULD_NOT_INSTANTIATE_BROWSER;
+ public static String BrowserSim_DEVICES;
+ public static String BrowserSim_EXIT;
+ public static String BrowserSim_FILE;
+ public static String BrowserSim_MORE;
+ public static String EditDeviceDialog_CANCEL;
+ public static String EditDeviceDialog_EDIT_DEVICE;
+ public static String EditDeviceDialog_HEIGHT;
+ public static String EditDeviceDialog_MANAGE_DEVICES;
+ public static String EditDeviceDialog_NAME;
+ public static String EditDeviceDialog_OK;
+ public static String EditDeviceDialog_USER_AGENT;
+ public static String EditDeviceDialog_WIDTH;
+ public static String ManageDevicesDialog_ADD;
+ public static String ManageDevicesDialog_CANCEL;
+ public static String ManageDevicesDialog_DEVICES;
+ public static String ManageDevicesDialog_EDIT;
+ public static String ManageDevicesDialog_HEIGHT;
+ public static String ManageDevicesDialog_NAME;
+ public static String ManageDevicesDialog_NEW_DEVICE;
+ public static String ManageDevicesDialog_NEW_USER_AGENT;
+ public static String ManageDevicesDialog_OK;
+ public static String ManageDevicesDialog_REMOVE;
+ public static String ManageDevicesDialog_RESET;
+ public static String ManageDevicesDialog_USER_AGENT;
+ public static String ManageDevicesDialog_WIDTH;
+ static {
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages() {
+ }
+}
Added: workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim/src/org/jboss/tools/browsersim/NLS.java
===================================================================
--- workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim/src/org/jboss/tools/browsersim/NLS.java (rev 0)
+++ workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim/src/org/jboss/tools/browsersim/NLS.java 2011-11-10 17:35:00 UTC (rev 36281)
@@ -0,0 +1,33 @@
+package org.jboss.tools.browsersim;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+public class NLS {
+ private static final int MOD_EXPECTED = Modifier.PUBLIC | Modifier.STATIC;
+
+ private NLS(){};
+
+ public static void initializeMessages(String bundleName, Class<?> clazz) {
+ ResourceBundle resourceBundle = ResourceBundle.getBundle(bundleName);
+
+ try {
+ for (Field field : clazz.getDeclaredFields()) {
+ // if it is a public static uninitialized String field
+ if ((field.getModifiers() & MOD_EXPECTED) == MOD_EXPECTED
+ && field.getType() == String.class
+ && field.get(null) == null) {
+ try {
+ field.set(null, resourceBundle.getString(field.getName()));
+ } catch (MissingResourceException e) {
+ field.set(null, '!' + field.getName() + '!');
+ }
+ }
+ }
+ } catch (IllegalAccessException e) {
+ e.printStackTrace();
+ }
+ }
+}
Added: workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim/src/org/jboss/tools/browsersim/messages.properties
===================================================================
--- workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim/src/org/jboss/tools/browsersim/messages.properties (rev 0)
+++ workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim/src/org/jboss/tools/browsersim/messages.properties 2011-11-10 17:35:00 UTC (rev 36281)
@@ -0,0 +1,28 @@
+BrowserSim_ADDRESS=Address
+BrowserSim_BROWSER_SIM=BrowserSim
+BrowserSim_COULD_NOT_INSTANTIATE_BROWSER=Could not instantiate Browser:
+BrowserSim_DEVICES=Devices
+BrowserSim_EXIT=Exit
+BrowserSim_FILE=File
+BrowserSim_MORE=More...
+EditDeviceDialog_CANCEL=Cancel
+EditDeviceDialog_EDIT_DEVICE=Edit Device
+EditDeviceDialog_HEIGHT=Height:
+EditDeviceDialog_MANAGE_DEVICES=Manage Devices
+EditDeviceDialog_NAME=Name:
+EditDeviceDialog_OK=OK
+EditDeviceDialog_USER_AGENT=User-Agent:
+EditDeviceDialog_WIDTH=Width:
+ManageDevicesDialog_ADD=Add
+ManageDevicesDialog_CANCEL=Cancel
+ManageDevicesDialog_DEVICES=Devices
+ManageDevicesDialog_EDIT=Edit
+ManageDevicesDialog_HEIGHT=Height
+ManageDevicesDialog_NAME=Name
+ManageDevicesDialog_NEW_DEVICE=New Device
+ManageDevicesDialog_NEW_USER_AGENT=New User-Agent
+ManageDevicesDialog_OK=OK
+ManageDevicesDialog_REMOVE=Remove
+ManageDevicesDialog_RESET=Reset
+ManageDevicesDialog_USER_AGENT=User-Agent
+ManageDevicesDialog_WIDTH=Width
Added: workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim/src/org/jboss/tools/browsersim/resources/config/devices.cfg
===================================================================
--- workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim/src/org/jboss/tools/browsersim/resources/config/devices.cfg (rev 0)
+++ workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim/src/org/jboss/tools/browsersim/resources/config/devices.cfg 2011-11-10 17:35:00 UTC (rev 36281)
@@ -0,0 +1,5 @@
+0
+Apple iPhone 3 320 480 Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_0 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8A293 Safari/6531.22.7
+Apple iPhone 4 640 960 Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_0 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8A293 Safari/6531.22.7
+RIM BlackBerry Bold Touch 9900 640 480 Mozilla/5.0 (BlackBerry; U; BlackBerry 9900; en-US) AppleWebKit/534.1+ (KHTML, like Gecko) Version/6.0.0.246 Mobile Safari/534.1+
+Samsung Galaxy S II 640 800 Mozilla/5.0 (Linux; U; Android 2.3; en-us; GT-I9100 Build/GRH78) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1
Modified: workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim.eclipse/src/org/jboss/tools/browsersim/eclipse/util/BrowserSimLauncher.java
===================================================================
--- workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim.eclipse/src/org/jboss/tools/browsersim/eclipse/util/BrowserSimLauncher.java 2011-11-10 16:24:16 UTC (rev 36280)
+++ workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim.eclipse/src/org/jboss/tools/browsersim/eclipse/util/BrowserSimLauncher.java 2011-11-10 17:35:00 UTC (rev 36281)
@@ -10,7 +10,10 @@
******************************************************************************/
package org.jboss.tools.browsersim.eclipse.util;
+import java.io.BufferedInputStream;
import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;
@@ -51,7 +54,35 @@
}
try {
- Process child = Runtime.getRuntime().exec(commandElements.toArray(new String[0]));
+ ProcessBuilder processBuilder = new ProcessBuilder(commandElements);
+ Process browserSimProcess = processBuilder.start();
+ BufferedInputStream j;
+ final InputStream errorStream = browserSimProcess.getErrorStream();
+ final InputStream inputStream = browserSimProcess.getInputStream();
+ new Thread() {
+ public void run() {
+ int nextByte;
+ try {
+ while ((nextByte = inputStream.read()) >= 0) {
+ System.out.write(nextByte);
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ };
+ }.start();
+ new Thread() {
+ public void run() {
+ int nextByte;
+ try {
+ while ((nextByte = errorStream.read()) >= 0) {
+ System.err.write(nextByte);
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ };
+ }.start();
} catch (IOException e) {
e.printStackTrace();
}
13 years, 1 month
JBoss Tools SVN: r36280 - branches/jbosstools-3.2.x/as/plugins/org.jboss.ide.eclipse.as.core.
by jbosstools-commits@lists.jboss.org
Author: bfitzpat
Date: 2011-11-10 11:24:16 -0500 (Thu, 10 Nov 2011)
New Revision: 36280
Modified:
branches/jbosstools-3.2.x/as/plugins/org.jboss.ide.eclipse.as.core/plugin.xml
Log:
JBDS-1927 - applying as.core fix to add 4.10 as known to the server per rob stryker's fix in trunk
Modified: branches/jbosstools-3.2.x/as/plugins/org.jboss.ide.eclipse.as.core/plugin.xml
===================================================================
--- branches/jbosstools-3.2.x/as/plugins/org.jboss.ide.eclipse.as.core/plugin.xml 2011-11-10 15:45:46 UTC (rev 36279)
+++ branches/jbosstools-3.2.x/as/plugins/org.jboss.ide.eclipse.as.core/plugin.xml 2011-11-10 16:24:16 UTC (rev 36280)
@@ -304,7 +304,7 @@
versions="1.0"/>
<moduleType
types="jst.jboss.esb"
- versions="4.2,4.3,4.4,4.5,4.6,4.7">
+ versions="4.2,4.3,4.4,4.5,4.6,4.7,4.9,4.10">
</moduleType>
<moduleType
types="jbt.bpel.module"
@@ -351,7 +351,7 @@
versions="1.0"/>
<moduleType
types="jst.jboss.esb"
- versions="4.2,4.3,4.4,4.5,4.6,4.7,4.9">
+ versions="4.2,4.3,4.4,4.5,4.6,4.7,4.9,4.10">
</moduleType>
<moduleType
types="jbt.bpel.module"
@@ -398,7 +398,7 @@
versions="1.0"/>
<moduleType
types="jst.jboss.esb"
- versions="4.2,4.3,4.4,4.5,4.6,4.7,4.9">
+ versions="4.2,4.3,4.4,4.5,4.6,4.7,4.9,4.10">
</moduleType>
<moduleType
types="jbt.bpel.module"
@@ -487,7 +487,7 @@
versions="1.0"/>
<moduleType
types="jst.jboss.esb"
- versions="4.2,4.3,4.4,4.5,4.6,4.7,4.9">
+ versions="4.2,4.3,4.4,4.5,4.6,4.7,4.9,4.10">
</moduleType>
<moduleType
types="jbt.bpel.module"
@@ -537,7 +537,7 @@
versions="1.0"/>
<moduleType
types="jst.jboss.esb"
- versions="4.2,4.3,4.4,4.5,4.6,4.7,4.9">
+ versions="4.2,4.3,4.4,4.5,4.6,4.7,4.9,4.10">
</moduleType>
<moduleType
types="jbt.bpel.module"
13 years, 1 month
JBoss Tools SVN: r36279 - trunk/as/plugins/org.jboss.ide.eclipse.as.core.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2011-11-10 10:45:46 -0500 (Thu, 10 Nov 2011)
New Revision: 36279
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/plugin.xml
Log:
JBDS-1927 - support for esb 4.10 in applicable server adapters
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/plugin.xml
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/plugin.xml 2011-11-10 15:14:12 UTC (rev 36278)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/plugin.xml 2011-11-10 15:45:46 UTC (rev 36279)
@@ -270,7 +270,7 @@
<moduleType types="jst.utility" versions="1.0"/>
<moduleType types="jboss.package" versions="1.0"/>
<moduleType types="jboss.singlefile" versions="1.0"/>
- <moduleType types="jst.jboss.esb" versions="4.2,4.3,4.4,4.5,4.6,4.7"/>
+ <moduleType types="jst.jboss.esb" versions="4.2,4.3,4.4,4.5,4.6,4.7,4.8,4.9,4.10"/>
<moduleType types="jst.jboss.sar" versions="1.0"/>
<moduleType types="jbt.bpel.module" versions="1.1, 2.0"/>
<moduleType types="bpel.module" versions="1.1, 2.0"/>
@@ -291,7 +291,7 @@
<moduleType types="jst.utility" versions="1.0"/>
<moduleType types="jboss.package" versions="1.0"/>
<moduleType types="jboss.singlefile" versions="1.0"/>
- <moduleType types="jst.jboss.esb" versions="4.2,4.3,4.4,4.5,4.6,4.7,4.9"/>
+ <moduleType types="jst.jboss.esb" versions="4.2,4.3,4.4,4.5,4.6,4.7,4.8,4.9,4.10"/>
<moduleType types="jst.jboss.sar" versions="1.0"/>
<moduleType types="jbt.bpel.module" versions="1.1, 2.0"/>
<moduleType types="bpel.module" versions="1.1, 2.0"/>
@@ -312,7 +312,7 @@
<moduleType types="jst.utility" versions="1.0"/>
<moduleType types="jboss.package" versions="1.0"/>
<moduleType types="jboss.singlefile" versions="1.0"/>
- <moduleType types="jst.jboss.esb" versions="4.2,4.3,4.4,4.5,4.6,4.7,4.9"/>
+ <moduleType types="jst.jboss.esb" versions="4.2,4.3,4.4,4.5,4.6,4.7,4.9,4.10"/>
<moduleType types="jst.jboss.sar" versions="1.0"/>
<moduleType types="jbt.bpel.module" versions="1.1, 2.0"/>
<moduleType types="bpel.module" versions="1.1, 2.0"/>
@@ -379,7 +379,7 @@
<moduleType types="jst.utility" versions="1.0"/>
<moduleType types="jboss.package" versions="1.0"/>
<moduleType types="jboss.singlefile" versions="1.0"/>
- <moduleType types="jst.jboss.esb" versions="4.2,4.3,4.4,4.5,4.6,4.7,4.9"/>
+ <moduleType types="jst.jboss.esb" versions="4.2,4.3,4.4,4.5,4.6,4.7,4.9,4.10"/>
<moduleType types="jst.jboss.sar" versions="1.0"/>
<moduleType types="jbt.bpel.module" versions="1.1, 2.0"/>
<moduleType types="bpel.module" versions="1.1, 2.0"/>
@@ -406,7 +406,6 @@
<moduleType types="jbt.bpel.module" versions="1.1, 2.0"/>
<moduleType types="bpel.module" versions="1.1, 2.0"/>
<moduleType types="jboss.osgi" versions="1.0"/>
-
</runtimeType>
@@ -426,11 +425,12 @@
<moduleType types="jst.utility" versions="1.0"/>
<moduleType types="jboss.package" versions="1.0"/>
<moduleType types="jboss.singlefile" versions="1.0"/>
- <moduleType types="jst.jboss.esb" versions="4.2,4.3,4.4,4.5,4.6,4.7,4.9"/>
+ <moduleType types="jst.jboss.esb" versions="4.2,4.3,4.4,4.5,4.6,4.7,4.9,4.10"/>
<moduleType types="jst.jboss.sar" versions="1.0"/>
<moduleType types="jbt.bpel.module" versions="1.1, 2.0"/>
<moduleType types="bpel.module" versions="1.1, 2.0"/>
<moduleType types="jbt.egit" versions="1.0"/>
+ <moduleType types="jboss.osgi" versions="1.0"/>
</runtimeType>
</extension>
13 years, 1 month
JBoss Tools SVN: r36278 - in trunk: common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/text and 13 other directories.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2011-11-10 10:14:12 -0500 (Thu, 10 Nov 2011)
New Revision: 36278
Added:
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/util/StringUtil.java
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.seam.core/src/org/jboss/tools/cdi/seam/core/international/el/CDIInternationalMessagesELResolver.java
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/ca/AbstractELCompletionEngine.java
trunk/common/plugins/org.jboss.tools.common.el.ui/src/org/jboss/tools/common/el/ui/ca/ELProposalProcessor.java
trunk/common/plugins/org.jboss.tools.common.el.ui/src/org/jboss/tools/common/el/ui/ca/Messages.java
trunk/common/plugins/org.jboss.tools.common.el.ui/src/org/jboss/tools/common/el/ui/ca/messages.properties
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/HyperlinkPartitionerBuilder.java
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/text/TextProposal.java
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/JSFMessageELCompletionEngine.java
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/jsp/ca/test/CAELInsideTagBodyInJspFileTest.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/META-INF/MANIFEST.MF
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/AutoContentAssistantProposal.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/AutoELContentAssistantProposal.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/computers/XmlELCompletionProposalComputer.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/info/ELInfoHoverMessages.properties
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/info/FaceletTagInfoHoverProcessor.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/info/JavaStringELInfoHover.java
trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/ELHyperlink.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/el/MessagePropertyELSegmentImpl.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/SeamELCompletionEngine.java
Log:
JBIDE-9910 Proposal info for message bundles in code completion for EL
Additional Info is added for Resource Bundles/Properties in Content Assistant
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.seam.core/src/org/jboss/tools/cdi/seam/core/international/el/CDIInternationalMessagesELResolver.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.seam.core/src/org/jboss/tools/cdi/seam/core/international/el/CDIInternationalMessagesELResolver.java 2011-11-10 14:56:30 UTC (rev 36277)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.seam.core/src/org/jboss/tools/cdi/seam/core/international/el/CDIInternationalMessagesELResolver.java 2011-11-10 15:14:12 UTC (rev 36278)
@@ -36,6 +36,7 @@
import org.jboss.tools.cdi.seam.core.international.impl.LocalizedValue;
import org.jboss.tools.cdi.seam.core.international.impl.PropertyImpl;
import org.jboss.tools.common.el.core.ca.AbstractELCompletionEngine;
+import org.jboss.tools.common.el.core.ca.MessagesELTextProposal;
import org.jboss.tools.common.el.core.model.ELArgumentInvocation;
import org.jboss.tools.common.el.core.model.ELExpression;
import org.jboss.tools.common.el.core.model.ELInstance;
@@ -57,6 +58,7 @@
import org.jboss.tools.common.model.XModelObject;
import org.jboss.tools.common.model.util.PositionHolder;
import org.jboss.tools.common.text.TextProposal;
+import org.jboss.tools.common.util.StringUtil;
import org.jboss.tools.jst.web.kb.IResourceBundle;
import org.jboss.tools.jst.web.kb.el.MessagePropertyELSegmentImpl;
import org.jboss.tools.jst.web.kb.internal.ResourceBundle;
@@ -398,94 +400,73 @@
for (Variable mbr : members) {
processSingularMember(mbr, kbProposals);
}
- } else
- if(expr.getType() != ELObjectType.EL_ARGUMENT_INVOCATION) {
- Set<String> proposalsToFilter = new TreeSet<String>();
+ } else if(expr.getType() != ELObjectType.EL_ARGUMENT_INVOCATION) {
+ String filter = (expr.getMemberName() == null ? "" : expr.getMemberName());
+
for (Variable mbr : members) {
- filterSingularMember(mbr, proposalsToFilter);
- }
- for (String proposal : proposalsToFilter) {
- // We do expect nothing but name for method tokens (No round brackets)
- String filter = expr.getMemberName();
- if(filter == null) filter = ""; //$NON-NLS-1$
- if(returnEqualedVariablesOnly) {
- // This is used for validation.
- if (proposal.equals(filter)) {
- TextProposal kbProposal = new TextProposal();
- kbProposal.setReplacementString(proposal);
- kbProposal.setLabel(proposal);
+ Collection<String> keys = mbr.getKeys();
+ for (String key : keys) {
+ if(returnEqualedVariablesOnly) {
+ // This is used for validation.
+ if (key.equals(filter)) {
+ TextProposal kbProposal = createProposal(mbr, key);
+ kbProposals.add(kbProposal);
+ break;
+ }
+ } else if (key.startsWith(filter)) {
+ // This is used for CA.
+ MessagesELTextProposal kbProposal = createProposal(mbr, key);
+ if (key.indexOf('.') == -1) kbProposal.setReplacementString(key.substring(filter.length()));
+ else kbProposal.setReplacementString('[' + kbProposal.getReplacementString());
kbProposal.setImage(getELProposalImageForMember(null));
-
kbProposals.add(kbProposal);
-
- break;
}
- } else if (proposal.startsWith(filter)) {
- // This is used for CA.
- TextProposal kbProposal = new TextProposal();
- kbProposal.setReplacementString(proposal.substring(filter.length()));
- kbProposal.setLabel(proposal);
- kbProposal.setImage(getELProposalImageForMember(null));
-
- kbProposals.add(kbProposal);
}
}
} else if(expr.getType() == ELObjectType.EL_ARGUMENT_INVOCATION) {
- Set<String> proposalsToFilter = new TreeSet<String>();
- boolean isMessages = false;
+// Set<String> proposalsToFilter = new TreeSet<String>();
+// boolean isMessages = false;
+ String filter = expr.getMemberName() == null ? "" : expr.getMemberName();
+ boolean b = filter.startsWith("'") || filter.startsWith("\""); //$NON-NLS-1$ //$NON-NLS-2$
+ filter = StringUtil.trimQuotes(filter);
+
for (Variable mbr : members) {
- isMessages = true;
- filterSingularMember(mbr, proposalsToFilter);
- }
-
- String filter = expr.getMemberName();
- boolean bSurroundWithQuotes = false;
- if(filter == null) {
- filter = ""; //$NON-NLS-1$
- bSurroundWithQuotes = true;
- } else {
- boolean b = filter.startsWith("'") || filter.startsWith("\""); //$NON-NLS-1$ //$NON-NLS-2$
- boolean e = filter.endsWith("'") || filter.endsWith("\""); //$NON-NLS-1$ //$NON-NLS-2$
- if((b) && (e)) {
- filter = filter.length() == 1 ? "" : filter.substring(1, filter.length() - 1); //$NON-NLS-1$
- } else if(b && !returnEqualedVariablesOnly) {
- filter = filter.substring(1);
- } else {
+ if (!b && filter.length() > 0) {
//Value is set as expression itself, we cannot compute it
- if(isMessages) {
- resolution.setMapOrCollectionOrBundleAmoungTheTokens(true);
- }
+ resolution.setMapOrCollectionOrBundleAmoungTheTokens(true);
return;
}
- }
- for (String proposal : proposalsToFilter) {
- if(returnEqualedVariablesOnly) {
- // This is used for validation.
- if (proposal.equals(filter)) {
- TextProposal kbProposal = new TextProposal();
- kbProposal.setReplacementString(proposal);
- kbProposal.setLabel(proposal);
- kbProposal.setImage(getELProposalImageForMember(null));
+// isMessages = true;
+// filterSingularMember(mbr, proposalsToFilter);
+ Collection<String> keys = mbr.getKeys();
+ for (String key : keys) {
+ if(returnEqualedVariablesOnly) {
+ // This is used for validation.
+ if (key.equals(filter)) {
+ MessagesELTextProposal kbProposal = createProposal(mbr, key);
+ kbProposals.add(kbProposal);
+ break;
+ }
+ } else if (key.startsWith(filter)) {
+ // This is used for CA.
+ MessagesELTextProposal kbProposal = createProposal(mbr, key);
- kbProposals.add(kbProposal);
+ String existingString = expr.getMemberName() == null ? "" : expr.getMemberName();
+ // Because we're in argument invocation we should fix the proposal by surrounding it with quotes as needed
+ String replacement = kbProposal.getReplacementString();
+ String label = kbProposal.getLabel();
+ if (!replacement.startsWith("'")) {
+ replacement = '\'' + key + '\'';
+ label = "['" + key + "']";
+ }
+ replacement = replacement.substring(existingString.length());
- break;
- }
- } else if (proposal.startsWith(filter)) {
- // This is used for CA.
- TextProposal kbProposal = new TextProposal();
+ kbProposal.setReplacementString(replacement);
+ kbProposal.setLabel(label);
- String replacementString = proposal.substring(filter.length());
- if (bSurroundWithQuotes) {
- replacementString = "'" + replacementString + "']"; //$NON-NLS-1$ //$NON-NLS-2$
+ kbProposals.add(kbProposal);
}
-
- kbProposal.setReplacementString(replacementString);
- kbProposal.setLabel(proposal);
- kbProposal.setImage(getELProposalImageForMember(null));
-
- kbProposals.add(kbProposal);
}
}
}
@@ -547,7 +528,7 @@
String propertyName = segment.getToken().getText();
- IProperty prop = bundle.getProperty(trimQuotes(propertyName));
+ IProperty prop = bundle.getProperty(StringUtil.trimQuotes(propertyName));
if(prop == null) continue;
Map<String, LocalizedValue> values = ((PropertyImpl)prop).getValues();
for (LocalizedValue value: values.values()) {
@@ -577,6 +558,41 @@
return true;
}
+ private MessagesELTextProposal createProposal(Variable mbr, String proposal) {
+ MessagesELTextProposal kbProposal = new MessagesELTextProposal();
+ if (proposal.indexOf('.') != -1) {
+ kbProposal.setReplacementString('\'' + proposal + '\'');
+ kbProposal.setLabel("['" + proposal + "']");
+ } else {
+ kbProposal.setReplacementString(proposal);
+ kbProposal.setLabel(proposal);
+ }
+ kbProposal.setAlternateMatch(proposal);
+ kbProposal.setImage(getELProposalImageForMember(null));
+
+ List<XModelObject> objects = new ArrayList<XModelObject>();
+ IBundleModel bundleModel = BundleModelFactory.getBundleModel(mbr.f.getProject());
+ if(bundleModel != null) {
+ IBundle bundle = bundleModel.getBundle(mbr.basename);
+ if(bundle != null) {
+ IProperty prop = bundle.getProperty(proposal);
+ if(prop != null) {
+ Map<String, LocalizedValue> values = ((PropertyImpl)prop).getValues();
+ for (LocalizedValue value: values.values()) {
+ XModelObject p = value.getObject();
+ if (p != null) objects.add(p);
+ }
+ }
+ }
+ }
+
+ kbProposal.setBaseName(mbr.basename);
+ kbProposal.setPropertyName(proposal);
+ kbProposal.setObjects(objects);
+
+ return kbProposal;
+ }
+
protected void processSingularMember(Variable mbr, Set<TextProposal> kbProposals) {
// Surround the "long" keys containing the dots with [' ']
TreeSet<String> keys = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER);
@@ -586,31 +602,19 @@
String key = sortedKeys.next();
if (key == null || key.length() == 0)
continue;
+
+ MessagesELTextProposal proposal = createProposal(mbr, key);
if (key.indexOf('.') != -1) {
- TextProposal proposal = new TextProposal();
proposal.setReplacementString("['" + key + "']"); //$NON-NLS-1$ //$NON-NLS-2$
proposal.setLabel("['" + key + "']");
- proposal.setImage(getELProposalImageForMember(null));
-
- kbProposals.add(proposal);
} else {
- TextProposal proposal = new TextProposal();
proposal.setReplacementString(key);
proposal.setLabel(key);
- proposal.setImage(getELProposalImageForMember(null));
-
- kbProposals.add(proposal);
}
+ kbProposals.add(proposal);
}
}
-
- protected void filterSingularMember(Variable mbr, Set<String> proposalsToFilter) {
- Collection<String> keys = mbr.getKeys();
- for (String key : keys) {
- proposalsToFilter.add(key);
- }
- }
-
+
static class Variable implements IVariable {
IFile f;
String name;
Modified: trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/text/TextProposal.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/text/TextProposal.java 2011-11-10 14:56:30 UTC (rev 36277)
+++ trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/text/TextProposal.java 2011-11-10 15:14:12 UTC (rev 36278)
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Red Hat, Inc.
+ * Copyright (c) 2009-2011 Red Hat, Inc.
* Distributed under license by Red Hat, Inc. All rights reserved.
* This program is made available under the terms of the
* Eclipse Public License v1.0 which accompanies this distribution,
@@ -42,6 +42,7 @@
private Image image;
private boolean emptyImage = true;
private String replacementString;
+ private String alternateMatch = null;
private boolean emptyContextInfo = true;
private int relevance = R_NONE;
private int position = -1;
@@ -360,6 +361,14 @@
this.source = source;
}
+ public String getAlternateMatch() {
+ return alternateMatch;
+ }
+
+ public void setAlternateMatch(String alternateMatch) {
+ this.alternateMatch = alternateMatch;
+ }
+
public static final Comparator<TextProposal> KB_PROPOSAL_ORDER = new TextProposalComparator();
private static class TextProposalComparator implements Comparator<TextProposal> {
Added: trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/util/StringUtil.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/util/StringUtil.java (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/util/StringUtil.java 2011-11-10 15:14:12 UTC (rev 36278)
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.common.util;
+
+/**
+ * Miscellaneous String utility functions
+ *
+ * @author Victor V. Rubezhny
+ */
+public class StringUtil {
+/**
+ * Cuts of the starting and ending quotes from a given text value
+ *
+ * @param Quoted text value
+ * @return Non-quoted text value
+ */
+ public static String trimQuotes(String value) {
+ if(value == null)
+ return null;
+
+ if(value.startsWith("'") || value.startsWith("\"")) { //$NON-NLS-1$ //$NON-NLS-2$
+ value = value.substring(1);
+ }
+
+ if(value.endsWith("'") || value.endsWith("\"")) { //$NON-NLS-1$ //$NON-NLS-2$
+ value = value.substring(0, value.length() - 1);
+ }
+ return value;
+ }
+
+}
Property changes on: trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/util/StringUtil.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/ca/AbstractELCompletionEngine.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/ca/AbstractELCompletionEngine.java 2011-11-10 14:56:30 UTC (rev 36277)
+++ trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/ca/AbstractELCompletionEngine.java 2011-11-10 15:14:12 UTC (rev 36278)
@@ -1128,26 +1128,6 @@
return unique;
}
- /**
- * Cuts of the starting and ending quotes from a given text value
- *
- * @param Quoted text value
- * @return Non-quoted text value
- */
- public static String trimQuotes(String value) {
- if(value == null)
- return null;
-
- if(value.startsWith("'") || value.startsWith("\"")) { //$NON-NLS-1$ //$NON-NLS-2$
- value = value.substring(1);
- }
-
- if(value.endsWith("'") || value.endsWith("\"")) { //$NON-NLS-1$ //$NON-NLS-2$
- value = value.substring(0, value.length() - 1);
- }
- return value;
- }
-
public static LexicalToken combineLexicalTokensForExpression(ELInvocationExpression expr) {
// Create a combined lexical token to store all the variable name (not only the name before first dot, but all the name including all the words and dots)
int variableTokenType = expr.getFirstToken().getType();
Modified: trunk/common/plugins/org.jboss.tools.common.el.ui/src/org/jboss/tools/common/el/ui/ca/ELProposalProcessor.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.el.ui/src/org/jboss/tools/common/el/ui/ca/ELProposalProcessor.java 2011-11-10 14:56:30 UTC (rev 36277)
+++ trunk/common/plugins/org.jboss.tools.common.el.ui/src/org/jboss/tools/common/el/ui/ca/ELProposalProcessor.java 2011-11-10 15:14:12 UTC (rev 36278)
@@ -13,12 +13,16 @@
import java.io.Reader;
import java.io.StringReader;
+import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.Path;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IMember;
import org.eclipse.jdt.core.JavaModelException;
@@ -57,11 +61,14 @@
import org.jboss.tools.common.el.core.ELReference;
import org.jboss.tools.common.el.core.ca.AbstractELCompletionEngine;
import org.jboss.tools.common.el.core.ca.ELTextProposal;
+import org.jboss.tools.common.el.core.ca.MessagesELTextProposal;
import org.jboss.tools.common.el.core.model.ELInvocationExpression;
import org.jboss.tools.common.el.core.resolver.ELContext;
import org.jboss.tools.common.el.core.resolver.ELResolver;
import org.jboss.tools.common.el.core.resolver.ELResolverFactoryManager;
import org.jboss.tools.common.el.ui.ElUiPlugin;
+import org.jboss.tools.common.model.XModelObject;
+import org.jboss.tools.common.model.filesystems.impl.JarSystemImpl;
import org.jboss.tools.common.text.TextProposal;
import org.jboss.tools.common.text.ext.util.Utils;
import org.jboss.tools.common.util.EclipseUIUtil;
@@ -91,6 +98,7 @@
private String fDisplayString;
private String fAdditionalProposalInfo;
private IJavaElement[] fJavaElements;
+ private MessagesELTextProposal fPropertySource;
private Image fImage;
@@ -99,18 +107,18 @@
}
public Proposal(String string, String prefix, int offset, int newPosition) {
- this(string, prefix, prefix, offset, offset + string.length(), null, null, null, null);
+ this(string, prefix, prefix, offset, offset + string.length(), null, null, null, null, null);
}
- public Proposal(String string, String prefix, int offset, int newPosition, Image image, String displayString, String additionalProposalInfo, IJavaElement[] javaElements) {
- this(string, prefix, prefix, offset, offset + string.length(), image, displayString, additionalProposalInfo, javaElements);
+ public Proposal(String string, String prefix, int offset, int newPosition, Image image, String displayString, String additionalProposalInfo, IJavaElement[] javaElements, MessagesELTextProposal propertySource) {
+ this(string, prefix, prefix, offset, offset + string.length(), image, displayString, additionalProposalInfo, javaElements, propertySource);
}
public Proposal(String string, String prefix, String newPrefix, int offset, int newPosition) {
- this(string, prefix, newPrefix, offset, newPosition, null, null, null, null);
+ this(string, prefix, newPrefix, offset, newPosition, null, null, null, null, null);
}
- public Proposal(String string, String prefix, String newPrefix, int offset, int newPosition, Image image, String displayString, String additionalProposalInfo, IJavaElement[] javaElements) {
+ public Proposal(String string, String prefix, String newPrefix, int offset, int newPosition, Image image, String displayString, String additionalProposalInfo, IJavaElement[] javaElements, MessagesELTextProposal propertySource) {
fString = string;
fPrefix = prefix;
fNewPrefix = newPrefix;
@@ -122,6 +130,7 @@
fJavaElements = javaElements;
if (fJavaElements != null && fJavaElements.length > 0)
fAdditionalProposalInfo = null; // Drop it due to valculate it later based on java elements
+ fPropertySource = propertySource;
}
/*
@@ -145,6 +154,8 @@
if (fAdditionalProposalInfo == null) {
if (this.fJavaElements != null && this.fJavaElements.length > 0) {
this.fAdditionalProposalInfo = extractProposalContextInfo(fJavaElements);
+ } else if (fPropertySource != null) {
+ this.fAdditionalProposalInfo = extractProposalContextInfo(fPropertySource);
}
}
if (fAdditionalProposalInfo == null)
@@ -206,6 +217,23 @@
return null;
}
+ /*
+ * Extracts the additional proposal information based on Javadoc for the stored IJavaElement objects
+ */
+ private String extractProposalContextInfo(MessagesELTextProposal propertySource) {
+ String propertyName = propertySource.getPropertyName();
+ String baseName = propertySource.getBaseName();
+ List<XModelObject> objects = (List<XModelObject>)propertySource.getAllObjects();
+
+ String info = getELMessagesHoverInternal(baseName, propertyName, objects);
+ if (info == null) return null;
+
+ StringBuffer buffer= new StringBuffer(info);
+ HTMLPrinter.insertPageProlog(buffer, 0, (String)null);
+ HTMLPrinter.addPageEpilog(buffer);
+ return buffer.toString();
+ }
+
private static final long LABEL_FLAGS= JavaElementLabels.ALL_FULLY_QUALIFIED
| JavaElementLabels.M_PRE_RETURNTYPE | JavaElementLabels.M_PARAMETER_TYPES | JavaElementLabels.M_PARAMETER_NAMES | JavaElementLabels.M_EXCEPTIONS
| JavaElementLabels.F_PRE_TYPE_SIGNATURE | JavaElementLabels.M_PRE_TYPE_PARAMETERS | JavaElementLabels.T_TYPE_PARAMETERS
@@ -554,19 +582,23 @@
if (string.length() > 0 && ('#' == string.charAt(0) || '$' == string.charAt(0)))
string = elStartChar + string.substring(1);
- String additionalProposalInfo = (kbProposal.getContextInfo() == null ? "" : kbProposal.getContextInfo()); //$NON-NLS-1$
+ String additionalProposalInfo = kbProposal.getContextInfo();
IJavaElement[] javaElements = null;
+ MessagesELTextProposal source = null;
+
if (kbProposal instanceof ELTextProposal) {
javaElements = ((ELTextProposal)kbProposal).getAllJavaElements();
+ } else if (kbProposal instanceof MessagesELTextProposal) {
+ source = (MessagesELTextProposal)kbProposal;
}
if (string.startsWith("['") && string.endsWith("']") && prefix != null && prefix.endsWith(".")) { //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
String newPrefix = prefix.substring(0, prefix.length() - 1);
resultList.add(new Proposal(string, prefix, newPrefix, offset, offset - 1 + string.length() - proposalSufix.length(), image,
- kbProposal.getLabel(), additionalProposalInfo, javaElements));
+ kbProposal.getLabel(), additionalProposalInfo, javaElements, source));
} else {
resultList.add(new Proposal(string, prefix, offset, offset + string.length() - proposalSufix.length(), image,
- kbProposal.getLabel(), additionalProposalInfo, javaElements));
+ kbProposal.getLabel(), additionalProposalInfo, javaElements, source));
}
}
}
@@ -760,4 +792,78 @@
public String getErrorMessage() {
return null; // no custom error message
}
+
+ public static String getELMessagesHoverInternal(String baseName, String propertyName, List<XModelObject> objects) {
+ StringBuffer buffer= new StringBuffer();
+
+ if (propertyName != null && propertyName.length() > 0)
+ buffer.append(MessageFormat.format(Messages.ELInfoHover_propertyName,
+ propertyName));
+
+ if (baseName != null && baseName.length() > 0)
+ buffer.append(MessageFormat.format(Messages.ELInfoHover_baseName,
+ baseName));
+
+ if (objects != null) {
+ boolean firstValue = true;
+ for (XModelObject o : objects) {
+ IFile propFile = (IFile)o.getAdapter(IFile.class);
+ String propFilePath = null;
+ if (propFile != null) {
+ propFilePath = propFile.getFullPath().toString();
+ } else {
+ XModelObject parent = o.getFileType() == XModelObject.FILE ? o : o.getParent();
+ String path = parent.getPath();
+ while (parent != null && parent.getFileType() != XModelObject.SYSTEM) {
+ parent = parent.getParent();
+ }
+ if (parent instanceof JarSystemImpl) {
+ String sysPath = parent.getPath();
+ path = path.substring(sysPath.length());
+
+ String jarPath = ((JarSystemImpl) parent).getLocation();
+
+ IResource jar = ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(new Path(jarPath));
+
+ if (jar != null) {
+ jarPath = jar.getFullPath().toString();
+ }
+
+ propFilePath = jarPath + "!" + path; //$NON-NLS-1$
+ }
+ }
+ buffer.append(Messages.ELInfoHover_newLine);
+ if (!firstValue) buffer.append(Messages.ELInfoHover_newLine);
+ else firstValue = false;
+
+ buffer.append(MessageFormat.format(Messages.ELInfoHover_resourceBundle,
+ propFilePath != null ? propFilePath : Messages.ELInfoHover_resourceBundleNotDefined));
+
+ if (propertyName != null) {
+ String value = o.get("VALUE"); //$NON-NLS-1$
+ boolean addCut = false;
+ if (value != null) {
+ if (value.length() > 100) {
+ // Get first words of value
+ int lastSpace = value.lastIndexOf(' ', 99);
+ if (lastSpace != -1) {
+ value = value.substring(0, lastSpace);
+ } else { // cut as is
+ value = value.substring(0, 100);
+ }
+ addCut = true;
+ }
+ }
+ buffer.append(Messages.ELInfoHover_newLine);
+ buffer.append(MessageFormat.format(Messages.ELInfoHover_resourceBundlePropertyValue,
+ value != null ? value : Messages.ELInfoHover_resourceBundlePropertyValueNotDefined,
+ addCut ? Messages.ELInfoHover_treeDots : "")); //$NON-NLS-1$
+// sb.append(Messages.ELInfoHover_newLine);
+ }
+ }
+ }
+
+ return buffer.length() == 0 ? null : buffer.toString();
+ }
+
}
\ No newline at end of file
Modified: trunk/common/plugins/org.jboss.tools.common.el.ui/src/org/jboss/tools/common/el/ui/ca/Messages.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.el.ui/src/org/jboss/tools/common/el/ui/ca/Messages.java 2011-11-10 14:56:30 UTC (rev 36277)
+++ trunk/common/plugins/org.jboss.tools.common.el.ui/src/org/jboss/tools/common/el/ui/ca/Messages.java 2011-11-10 15:14:12 UTC (rev 36278)
@@ -30,4 +30,14 @@
}
public static String NO_JAVADOC;
+
+ public static String ELInfoHover_baseName;
+ public static String ELInfoHover_propertyName;
+ public static String ELInfoHover_resourceBundle;
+ public static String ELInfoHover_resourceBundlePropertyValue;
+ public static String ELInfoHover_resourceBundlePropertyValueNotDefined;
+ public static String ELInfoHover_resourceBundleNotDefined;
+ public static String ELInfoHover_newLine;
+ public static String ELInfoHover_treeDots;
+
}
\ No newline at end of file
Modified: trunk/common/plugins/org.jboss.tools.common.el.ui/src/org/jboss/tools/common/el/ui/ca/messages.properties
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.el.ui/src/org/jboss/tools/common/el/ui/ca/messages.properties 2011-11-10 14:56:30 UTC (rev 36277)
+++ trunk/common/plugins/org.jboss.tools.common.el.ui/src/org/jboss/tools/common/el/ui/ca/messages.properties 2011-11-10 15:14:12 UTC (rev 36278)
@@ -1 +1,10 @@
-NO_JAVADOC=No Javadoc could be found<br>
\ No newline at end of file
+NO_JAVADOC=No Javadoc could be found<br>
+
+ELInfoHover_baseName=<b>Base Name:</b> {0}<br>
+ELInfoHover_propertyName=<b>Property:</b> {0}<br>
+ELInfoHover_resourceBundle=<b>Resource Bundle:</b> {0}
+ELInfoHover_resourceBundlePropertyValue=<b>Value:</b> {0}{1}
+ELInfoHover_resourceBundlePropertyValueNotDefined=[Value not defined]
+ELInfoHover_resourceBundleNotDefined=[Resource Bundle not defined]
+ELInfoHover_newLine=<br>
+ELInfoHover_treeDots=...
Modified: trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/HyperlinkPartitionerBuilder.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/HyperlinkPartitionerBuilder.java 2011-11-10 14:56:30 UTC (rev 36277)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/HyperlinkPartitionerBuilder.java 2011-11-10 15:14:12 UTC (rev 36278)
@@ -302,7 +302,8 @@
return (HyperlinkPartitionerDefinition[])fPartitionerDefs.toArray(new HyperlinkPartitionerDefinition[fPartitionerDefs.size()]);
}
- private String getBaseContentType(String contentType) {
+ public String getBaseContentType(String contentType) {
+ initCache();
if (contentType == null)
return null;
Modified: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/JSFMessageELCompletionEngine.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/JSFMessageELCompletionEngine.java 2011-11-10 14:56:30 UTC (rev 36277)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/JSFMessageELCompletionEngine.java 2011-11-10 15:14:12 UTC (rev 36278)
@@ -24,6 +24,7 @@
import org.eclipse.jface.text.IDocument;
import org.eclipse.swt.graphics.Image;
import org.jboss.tools.common.el.core.ca.AbstractELCompletionEngine;
+import org.jboss.tools.common.el.core.ca.MessagesELTextProposal;
import org.jboss.tools.common.el.core.model.ELArgumentInvocation;
import org.jboss.tools.common.el.core.model.ELExpression;
import org.jboss.tools.common.el.core.model.ELInstance;
@@ -49,6 +50,7 @@
import org.jboss.tools.common.text.TextProposal;
import org.jboss.tools.common.text.ext.util.StructuredModelWrapper;
import org.jboss.tools.common.text.ext.util.Utils;
+import org.jboss.tools.common.util.StringUtil;
import org.jboss.tools.jsf.JSFModelPlugin;
import org.jboss.tools.jsf.model.helpers.converter.OpenKeyHelper;
import org.jboss.tools.jst.web.kb.IPageContext;
@@ -258,9 +260,32 @@
for (Variable var : resolvedVariables) {
String varName = var.getName();
if(varName.startsWith(operand.getText())) {
- TextProposal proposal = new TextProposal();
+ MessagesELTextProposal proposal = new MessagesELTextProposal();
proposal.setReplacementString(varName.substring(operand.getLength()));
proposal.setImage(getELProposalImageForMember(null));
+
+ List<XModelObject> objects = new ArrayList<XModelObject>();
+
+ IModelNature n = EclipseResourceUtil.getModelNature(var.f.getProject());
+ XModel model = n != null ? n.getModel() : null;
+ if(model != null) {
+ OpenKeyHelper keyHelper = new OpenKeyHelper();
+ XModelObject[] properties = keyHelper.findBundles(model, var.basename, null);
+ if(properties == null) continue;
+ for (XModelObject p : properties) {
+ objects.add(p);
+ // IFile propFile = (IFile)p.getAdapter(IFile.class);
+ // if(propFile == null)
+ // continue;
+ }
+ }
+
+ proposal.setBaseName(var.basename);
+ proposal.setObjects(objects);
+// if (!lastSegment.isBundle()) {
+// proposal.setPropertyName(lastSegment.getToken().getText());
+// }
+
proposals.add(proposal);
}
}
@@ -279,10 +304,32 @@
for (Variable var : resolvedVariables) {
String varName = var.getName();
if(operand.getLength()<=varName.length()) {
- TextProposal proposal = new TextProposal();
+ MessagesELTextProposal proposal = new MessagesELTextProposal();
proposal.setReplacementString(varName.substring(operand.getLength()));
proposal.setLabel(varName);
proposal.setImage(getELProposalImageForMember(null));
+ List<XModelObject> objects = new ArrayList<XModelObject>();
+ IModelNature n = EclipseResourceUtil.getModelNature(var.f.getProject());
+ XModel model = n != null ? n.getModel() : null;
+ if(model != null) {
+ OpenKeyHelper keyHelper = new OpenKeyHelper();
+ XModelObject[] properties = keyHelper.findBundles(model, var.basename, null);
+ if(properties == null) continue;
+ for (XModelObject p : properties) {
+ objects.add(p);
+// IFile propFile = (IFile)p.getAdapter(IFile.class);
+// if(propFile == null)
+// continue;
+ }
+ }
+
+ proposal.setBaseName(var.basename);
+ proposal.setObjects(objects);
+
+// if (!lastSegment.isBundle()) {
+// proposal.setPropertyName(lastSegment.getToken().getText());
+// }
+
proposals.add(proposal);
} else if(returnEqualedVariablesOnly) {
TextProposal proposal = new TextProposal();
@@ -381,94 +428,69 @@
for (Variable mbr : members) {
processSingularMember(mbr, kbProposals);
}
- } else
- if(expr.getType() != ELObjectType.EL_ARGUMENT_INVOCATION) {
- Set<String> proposalsToFilter = new TreeSet<String>();
+ } else if(expr.getType() != ELObjectType.EL_ARGUMENT_INVOCATION) {
+ String filter = (expr.getMemberName() == null ? "" : expr.getMemberName());
+
for (Variable mbr : members) {
- filterSingularMember(mbr, proposalsToFilter);
- }
- for (String proposal : proposalsToFilter) {
- // We do expect nothing but name for method tokens (No round brackets)
- String filter = expr.getMemberName();
- if(filter == null) filter = ""; //$NON-NLS-1$
- if(returnEqualedVariablesOnly) {
- // This is used for validation.
- if (proposal.equals(filter)) {
- TextProposal kbProposal = new TextProposal();
- kbProposal.setReplacementString(proposal);
- kbProposal.setLabel(proposal);
- kbProposal.setImage(getELProposalImageForMember(null));
-
+ Collection<String> keys = mbr.getKeys();
+ for (String key : keys) {
+ // We do expect nothing but name for method tokens (No round brackets)
+ if(returnEqualedVariablesOnly) {
+ // This is used for validation.
+ if (key.equals(filter)) {
+ MessagesELTextProposal kbProposal = createProposal(mbr, key);
+ kbProposals.add(kbProposal);
+ break;
+ }
+ } else if (key.startsWith(filter)) {
+ // This is used for CA.
+ MessagesELTextProposal kbProposal = createProposal(mbr, key);
+ if (key.indexOf('.') == -1) kbProposal.setReplacementString(key.substring(filter.length()));
+ else kbProposal.setReplacementString('[' + kbProposal.getReplacementString());
kbProposals.add(kbProposal);
-
- break;
}
- } else if (proposal.startsWith(filter)) {
- // This is used for CA.
- TextProposal kbProposal = new TextProposal();
- kbProposal.setReplacementString(proposal.substring(filter.length()));
- kbProposal.setLabel(proposal);
- kbProposal.setImage(getELProposalImageForMember(null));
-
- kbProposals.add(kbProposal);
}
}
} else if(expr.getType() == ELObjectType.EL_ARGUMENT_INVOCATION) {
- Set<String> proposalsToFilter = new TreeSet<String>();
- boolean isMessages = false;
+ String filter = expr.getMemberName() == null ? "" : expr.getMemberName();
+ boolean b = filter.startsWith("'") || filter.startsWith("\""); //$NON-NLS-1$ //$NON-NLS-2$
+ filter = StringUtil.trimQuotes(filter);
+
for (Variable mbr : members) {
- isMessages = true;
- filterSingularMember(mbr, proposalsToFilter);
- }
-
- String filter = expr.getMemberName();
- boolean bSurroundWithQuotes = false;
- if(filter == null) {
- filter = ""; //$NON-NLS-1$
- bSurroundWithQuotes = true;
- } else {
- boolean b = filter.startsWith("'") || filter.startsWith("\""); //$NON-NLS-1$ //$NON-NLS-2$
- boolean e = filter.endsWith("'") || filter.endsWith("\""); //$NON-NLS-1$ //$NON-NLS-2$
- if((b) && (e)) {
- filter = filter.length() == 1 ? "" : filter.substring(1, filter.length() - 1); //$NON-NLS-1$
- } else if(b && !returnEqualedVariablesOnly) {
- filter = filter.substring(1);
- } else {
+ if (!b && filter.length() > 0) {
//Value is set as expression itself, we cannot compute it
- if(isMessages) {
- resolution.setMapOrCollectionOrBundleAmoungTheTokens(true);
- }
+ resolution.setMapOrCollectionOrBundleAmoungTheTokens(true);
return;
}
- }
- for (String proposal : proposalsToFilter) {
- if(returnEqualedVariablesOnly) {
- // This is used for validation.
- if (proposal.equals(filter)) {
- TextProposal kbProposal = new TextProposal();
- kbProposal.setReplacementString(proposal);
- kbProposal.setLabel(proposal);
- kbProposal.setImage(getELProposalImageForMember(null));
+ Collection<String> keys = mbr.getKeys();
+ for (String key : keys) {
+ if(returnEqualedVariablesOnly) {
+ // This is used for validation.
+ if (key.equals(filter)) {
+ MessagesELTextProposal kbProposal = createProposal(mbr, key);
+ kbProposals.add(kbProposal);
+ break;
+ }
+ } else if (key.startsWith(filter)) {
+ // This is used for CA.
+ MessagesELTextProposal kbProposal = createProposal(mbr, key);
+
+ String existingString = expr.getMemberName() == null ? "" : expr.getMemberName();
+ // Because we're in argument invocation we should fix the proposal by surrounding it with quotes as needed
+ String replacement = kbProposal.getReplacementString();
+ String label = kbProposal.getLabel();
+ if (!replacement.startsWith("'")) {
+ replacement = '\'' + key + '\'';
+ label = "['" + key + "']";
+ }
+ replacement = replacement.substring(existingString.length());
+
+ kbProposal.setReplacementString(replacement);
+ kbProposal.setLabel(label);
kbProposals.add(kbProposal);
-
- break;
}
- } else if (proposal.startsWith(filter)) {
- // This is used for CA.
- TextProposal kbProposal = new TextProposal();
-
- String replacementString = proposal.substring(filter.length());
- if (bSurroundWithQuotes) {
- replacementString = "'" + replacementString + "']"; //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- kbProposal.setReplacementString(replacementString);
- kbProposal.setLabel(proposal);
- kbProposal.setImage(getELProposalImageForMember(null));
-
- kbProposals.add(kbProposal);
}
}
}
@@ -533,7 +555,7 @@
for (XModelObject p : properties) {
String name = segment.getToken().getText();
- XModelObject property = p.getChildByPath(trimQuotes(name));
+ XModelObject property = p.getChildByPath(StringUtil.trimQuotes(name));
if(property == null) continue;
segment.addObject(property);
@@ -604,6 +626,41 @@
return true;
}
+ private MessagesELTextProposal createProposal(Variable mbr, String proposal) {
+ MessagesELTextProposal kbProposal = new MessagesELTextProposal();
+ if (proposal.indexOf('.') != -1) {
+ kbProposal.setReplacementString('\'' + proposal + '\'');
+ kbProposal.setLabel("['" + proposal + "']");
+ } else {
+ kbProposal.setReplacementString(proposal);
+ kbProposal.setLabel(proposal);
+ }
+ kbProposal.setAlternateMatch(proposal);
+ kbProposal.setImage(getELProposalImageForMember(null));
+
+ List<XModelObject> objects = new ArrayList<XModelObject>();
+ String locale = getPageLocale(mbr.f, currentOffset);
+ IModelNature n = EclipseResourceUtil.getModelNature(mbr.f.getProject());
+ XModel model = n != null ? n.getModel() : null;
+ if(model != null) {
+ OpenKeyHelper keyHelper = new OpenKeyHelper();
+ XModelObject[] properties = keyHelper.findBundles(model, mbr.basename, locale);
+
+ if(properties != null) {
+ for (XModelObject p : properties) {
+ XModelObject property = p.getChildByPath(proposal);
+ if(property != null) objects.add(property);
+ }
+ }
+ }
+
+ kbProposal.setBaseName(mbr.basename);
+ kbProposal.setPropertyName(proposal);
+ kbProposal.setObjects(objects);
+
+ return kbProposal;
+ }
+
protected void processSingularMember(Variable mbr, Set<TextProposal> kbProposals) {
// Surround the "long" keys containing the dots with [' ']
TreeSet<String> keys = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER);
@@ -613,31 +670,19 @@
String key = sortedKeys.next();
if (key == null || key.length() == 0)
continue;
+
+ MessagesELTextProposal proposal = createProposal(mbr, key);
if (key.indexOf('.') != -1) {
- TextProposal proposal = new TextProposal();
proposal.setReplacementString("['" + key + "']"); //$NON-NLS-1$ //$NON-NLS-2$
proposal.setLabel("['" + key + "']");
- proposal.setImage(getELProposalImageForMember(null));
-
- kbProposals.add(proposal);
} else {
- TextProposal proposal = new TextProposal();
proposal.setReplacementString(key);
proposal.setLabel(key);
- proposal.setImage(getELProposalImageForMember(null));
-
- kbProposals.add(proposal);
}
+ kbProposals.add(proposal);
}
}
- protected void filterSingularMember(Variable mbr, Set<String> proposalsToFilter) {
- Collection<String> keys = mbr.getKeys();
- for (String key : keys) {
- proposalsToFilter.add(key);
- }
- }
-
static class Variable implements IVariable {
IFile f;
String name;
Modified: trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/jsp/ca/test/CAELInsideTagBodyInJspFileTest.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/jsp/ca/test/CAELInsideTagBodyInJspFileTest.java 2011-11-10 14:56:30 UTC (rev 36277)
+++ trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/jsp/ca/test/CAELInsideTagBodyInJspFileTest.java 2011-11-10 15:14:12 UTC (rev 36278)
@@ -69,7 +69,12 @@
continue;
AutoContentAssistantProposal existingProposal = (AutoContentAssistantProposal)p;
String proposalString = existingProposal.getReplacementString();
-
+
+ // We have to compare full proposalString if proposal is not a name (f.e. EL like "#{}"),
+ // but we have to compare only name in case of proposal is name (f.e. EL like "user").
+ if (proposal.indexOf('}') == -1 && proposalString.indexOf('}') != -1)
+ proposalString = proposalString.substring(0, proposalString.indexOf('}'));
+
if (proposal.equals(proposalString)) {
return true;
}
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/META-INF/MANIFEST.MF
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/META-INF/MANIFEST.MF 2011-11-10 14:56:30 UTC (rev 36277)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/META-INF/MANIFEST.MF 2011-11-10 15:14:12 UTC (rev 36278)
@@ -55,7 +55,8 @@
org.eclipse.wst.validation;bundle-version="1.2.300",
org.eclipse.ui;bundle-version="3.7.0",
org.eclipse.jst.standard.schemas;bundle-version="1.2.0",
- org.eclipse.wst.standard.schemas;bundle-version="1.0.300"
+ org.eclipse.wst.standard.schemas;bundle-version="1.0.300",
+ org.jboss.tools.common.el.ui
Bundle-Version: 3.3.0.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ClassPath: .
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/AutoContentAssistantProposal.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/AutoContentAssistantProposal.java 2011-11-10 14:56:30 UTC (rev 36277)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/AutoContentAssistantProposal.java 2011-11-10 15:14:12 UTC (rev 36278)
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Copyright (c) 2007-2011 Red Hat, Inc.
* Distributed under license by Red Hat, Inc. All rights reserved.
* This program is made available under the terms of the
* Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ * Red Hat, Inc. - initial API and implementation
******************************************************************************/
package org.jboss.tools.jst.jsp.contentassist;
@@ -40,6 +40,11 @@
this.fOriginalReplacementLength = replacementLength;
}
+ public AutoContentAssistantProposal(String replacementString, int replacementOffset, int replacementLength, int cursorPosition, Image image, String displayString, String alternateMatch, IContextInformation contextInformation, String additionalProposalInfo, int relevance) {
+ super(replacementString, replacementOffset, replacementLength, cursorPosition, image, displayString, alternateMatch, contextInformation, additionalProposalInfo, relevance, true);
+ this.fOriginalReplacementLength = replacementLength;
+ }
+
public AutoContentAssistantProposal(String replacementString, int replacementOffset, int replacementLength, int cursorPosition, Image image, String displayString, IContextInformation contextInformation, String additionalProposalInfo, int relevance) {
super(replacementString, replacementOffset, replacementLength, cursorPosition, image, displayString, contextInformation, additionalProposalInfo, relevance);
this.fOriginalReplacementLength = replacementLength;
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/AutoELContentAssistantProposal.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/AutoELContentAssistantProposal.java 2011-11-10 14:56:30 UTC (rev 36277)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/AutoELContentAssistantProposal.java 2011-11-10 15:14:12 UTC (rev 36278)
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 Red Hat, Inc.
+ * Copyright (c) 2010-2011 Red Hat, Inc.
* Distributed under license by Red Hat, Inc. All rights reserved.
* This program is made available under the terms of the
* Eclipse Public License v1.0 which accompanies this distribution,
@@ -12,6 +12,7 @@
import java.io.Reader;
import java.io.StringReader;
+import java.util.List;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IMember;
@@ -23,6 +24,9 @@
import org.eclipse.jface.internal.text.html.HTMLPrinter;
import org.eclipse.jface.text.contentassist.IContextInformation;
import org.eclipse.swt.graphics.Image;
+import org.jboss.tools.common.el.core.ca.MessagesELTextProposal;
+import org.jboss.tools.common.el.ui.ca.ELProposalProcessor;
+import org.jboss.tools.common.model.XModelObject;
/**
* Class to provide EL proposals to Content Assistant.
@@ -34,6 +38,7 @@
@SuppressWarnings("restriction")
public class AutoELContentAssistantProposal extends AutoContentAssistantProposal {
private IJavaElement[] fJavaElements;
+ private MessagesELTextProposal fProperySource;
private String fAdditionalProposalInfo;
/**
@@ -49,11 +54,31 @@
* @param elements
* @param relevance
*/
- public AutoELContentAssistantProposal(String replacementString, int replacementOffset, int replacementLength, int cursorPosition, Image image, String displayString, IContextInformation contextInformation, IJavaElement[] elements, int relevance) {
- super(replacementString, replacementOffset, replacementLength, cursorPosition, image, displayString, contextInformation, null, relevance);
+ public AutoELContentAssistantProposal(String replacementString, int replacementOffset, int replacementLength, int cursorPosition, Image image, String displayString, String alternateMatch, IContextInformation contextInformation, IJavaElement[] elements, int relevance) {
+ super(replacementString, replacementOffset, replacementLength, cursorPosition, image, displayString, alternateMatch, contextInformation, null, relevance);
this.fJavaElements = elements;
+ this.fProperySource = null;
}
+ /**
+ * Constructs the proposal object
+ *
+ * @param replacementString
+ * @param replacementOffset
+ * @param replacementLength
+ * @param cursorPosition
+ * @param image
+ * @param displayString
+ * @param contextInformation
+ * @param properySource
+ * @param relevance
+ */
+ public AutoELContentAssistantProposal(String replacementString, int replacementOffset, int replacementLength, int cursorPosition, Image image, String displayString, String alternateMatch, IContextInformation contextInformation, MessagesELTextProposal propertySource, int relevance) {
+ super(replacementString, replacementOffset, replacementLength, cursorPosition, image, displayString, alternateMatch, contextInformation, null, relevance);
+ this.fJavaElements = null;
+ this.fProperySource = propertySource;
+ }
+
/*
* (non-Javadoc)
* @see org.eclipse.wst.sse.ui.internal.contentassist.CustomCompletionProposal#getAdditionalProposalInfo()
@@ -62,6 +87,8 @@
if (fAdditionalProposalInfo == null) {
if (this.fJavaElements != null && this.fJavaElements.length > 0) {
this.fAdditionalProposalInfo = extractProposalContextInfo(fJavaElements);
+ } else if (fProperySource != null) {
+ this.fAdditionalProposalInfo = extractProposalContextInfo(fProperySource);
}
}
return fAdditionalProposalInfo;
@@ -109,18 +136,31 @@
}
}
- if (!hasContents)
+ if (!hasContents || buffer.length() == 0)
return null;
+
+ HTMLPrinter.insertPageProlog(buffer, 0, (String)null);
+ HTMLPrinter.addPageEpilog(buffer);
+ return buffer.toString();
+ }
- if (buffer.length() > 0) {
- HTMLPrinter.insertPageProlog(buffer, 0, (String)null);
- HTMLPrinter.addPageEpilog(buffer);
- return buffer.toString();
- }
+ /*
+ * Extracts the additional proposal information based on Javadoc for the stored IJavaElement objects
+ */
+ private String extractProposalContextInfo(MessagesELTextProposal propertySource) {
+ StringBuffer buffer= new StringBuffer();
+ buffer.append(ELProposalProcessor.getELMessagesHoverInternal(propertySource.getBaseName(),
+ propertySource.getPropertyName(), (List<XModelObject>)propertySource.getAllObjects()));
- return null;
+ if (buffer.length() == 0)
+ return null;
+
+ HTMLPrinter.insertPageProlog(buffer, 0, (String)null);
+ HTMLPrinter.addPageEpilog(buffer);
+ return buffer.toString();
}
+
private static final long LABEL_FLAGS= JavaElementLabels.ALL_FULLY_QUALIFIED
| JavaElementLabels.M_PRE_RETURNTYPE | JavaElementLabels.M_PARAMETER_TYPES | JavaElementLabels.M_PARAMETER_NAMES | JavaElementLabels.M_EXCEPTIONS
| JavaElementLabels.F_PRE_TYPE_SIGNATURE | JavaElementLabels.M_PRE_TYPE_PARAMETERS | JavaElementLabels.T_TYPE_PARAMETERS
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/computers/XmlELCompletionProposalComputer.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/computers/XmlELCompletionProposalComputer.java 2011-11-10 14:56:30 UTC (rev 36277)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/computers/XmlELCompletionProposalComputer.java 2011-11-10 15:14:12 UTC (rev 36278)
@@ -42,6 +42,7 @@
import org.eclipse.wst.xml.ui.internal.contentassist.ContentAssistRequest;
import org.eclipse.wst.xml.ui.internal.contentassist.XMLContentModelGenerator;
import org.jboss.tools.common.el.core.ca.ELTextProposal;
+import org.jboss.tools.common.el.core.ca.MessagesELTextProposal;
import org.jboss.tools.common.el.core.model.ELInstance;
import org.jboss.tools.common.el.core.model.ELInvocationExpression;
import org.jboss.tools.common.el.core.model.ELModel;
@@ -164,14 +165,12 @@
@Override
protected void addAttributeValueELProposals(ContentAssistRequest contentAssistRequest,
CompletionProposalInvocationContext context) {
-
if (!isELCAToBeShown())
return;
TextRegion prefix = getELPrefix(contentAssistRequest);
- if (prefix == null) {
- return;
- }
+ if (prefix == null)
+ return; // Do not return any proposals here (predicate proposals may be created instead)
if(!prefix.isELStarted()) {
AutoContentAssistantProposal proposal = new AutoContentAssistantProposal(true,
@@ -182,27 +181,27 @@
contentAssistRequest.addProposal(proposal);
return;
}
- String matchString = EL_NUMBER_PREFIX + prefix.getText(); //$NON-NLS-1$
+ String matchString = EL_NUMBER_PREFIX + prefix.getText();
String query = matchString;
- if (query == null)
- query = ""; //$NON-NLS-1$
String stringQuery = matchString;
int beginChangeOffset = prefix.getStartOffset() + prefix.getOffset();
KbQuery kbQuery = createKbQuery(Type.ATTRIBUTE_VALUE, query, stringQuery);
TextProposal[] proposals = PageProcessor.getInstance().getProposals(kbQuery, getContext());
-
if (proposals == null || proposals.length == 0)
return;
+ String restOfValue = getRestOfEL(context.getDocument(), context.getInvocationOffset());
for (TextProposal textProposal : proposals) {
int replacementOffset = beginChangeOffset;
int replacementLength = prefix.getLength();
String replacementString = prefix.getText().substring(0, replacementLength);
- if (textProposal.getReplacementString().trim().startsWith("[") && replacementString.endsWith(".")) { //$NON-NLS-1$ //$NON-NLS-2$
+ String alternateMatch = null;
+ if (textProposal.getReplacementString().trim().startsWith("[") && replacementString.indexOf('.') != -1) { //$NON-NLS-1$
// Need to include last '.' (dot) char into the string to replace
- replacementString = replacementString.substring(0, replacementString.length() - 1);
+ replacementString = replacementString.substring(0, replacementString.lastIndexOf('.'));
+ alternateMatch = replacementString + '.' + textProposal.getAlternateMatch();
}
replacementString += textProposal.getReplacementString();
@@ -216,27 +215,6 @@
if (replacementString.indexOf('[') != -1) {
// That's it - The long message property
- // Need to get the rest of line from context.getInvocationOffset()
- IDocument doc = context.getDocument();
-
- String restOfLine = ""; //$NON-NLS-1$
- String restOfValue = ""; //$NON-NLS-1$
- int endPosition = -1;
- try {
- int line = doc.getLineOfOffset(context.getInvocationOffset());
- int lineStart = doc.getLineOffset(line);
- int lineLength = doc.getLineLength(line);
- String sDoc = doc.get();
- restOfValue = restOfLine = sDoc.substring(context.getInvocationOffset(), lineStart + lineLength);
- endPosition = restOfValue.indexOf(quoteChar);
- if (endPosition != -1) {
- // Use end of line
- restOfValue = restOfValue.substring(0, endPosition);
- }
- } catch (BadLocationException e) {
- // Ignore it
- }
-
// Check if the replacementString is already configured
if (replacementString.indexOf(']') == -1) {
// Is closing ']' is in it?
@@ -244,8 +222,12 @@
// Is the quotation is in it?
int quoteIndex = restOfValue.indexOf('\'');
if (quoteIndex == -1 || paraIndex == -1 || (paraIndex != -1 && quoteIndex > paraIndex)) {
- // Need to insert closing single-quote
- replacementString += '\'';
+ // Need to insert closing single-quote if there is no quote inserted
+ if (!replacementString.endsWith("\'")) //$NON-NLS-1$
+ replacementString += '\'';
+ } else {
+ if (quoteIndex != -1 && replacementString.endsWith("\'")) //$NON-NLS-1$
+ replacementString = replacementString.substring(0, replacementString.length() - 1);
}
if (paraIndex == -1) {
// Closing ']' is to be added
@@ -254,17 +236,22 @@
} else {
if (replacementString.endsWith("]") && restOfValue.indexOf(']') != -1) { //$NON-NLS-1$
replacementString = replacementString.substring(0, replacementString.length() -1);
- cursorPosition = replacementString.length(); // Cursor will be put right after the replacement (not after the closing square bracket in this case)
}
}
-
- if (restOfLine.indexOf('}') == -1) {
+ cursorPosition = replacementString.length(); // Cursor will be put right after the replacement
+ if (replacementString.indexOf(']') == -1) { // Find closing square bracket in restOfValue
+ if (restOfValue.indexOf(']') != -1) {
+ cursorPosition += restOfValue.indexOf(']') + 1;
+ }
+ }
+
+ if (restOfValue.indexOf('}') == -1) {
// Add closing }-char
replacementString += '}';
}
} else {
- if (!prefix.isELClosed()) {
- replacementString += '}';
+ if (restOfValue.indexOf('}') == -1) {
+ replacementString += "}"; //$NON-NLS-1$
}
}
@@ -291,13 +278,17 @@
IJavaElement[] javaElements = ((ELTextProposal)textProposal).getAllJavaElements();
proposal = new AutoELContentAssistantProposal(replacementString,
- replacementOffset, replacementLength, cursorPosition, image, displayString,
+ replacementOffset, replacementLength, cursorPosition, image, displayString, null,
null, javaElements, relevance);
+ } else if (textProposal instanceof MessagesELTextProposal) {
+ proposal = new AutoELContentAssistantProposal(replacementString,
+ replacementOffset, replacementLength, cursorPosition, image, displayString, alternateMatch,
+ null, (MessagesELTextProposal)textProposal, relevance);
} else {
String additionalProposalInfo = (textProposal.getContextInfo() == null ? "" : textProposal.getContextInfo()); //$NON-NLS-1$
proposal = new AutoContentAssistantProposal(replacementString,
- replacementOffset, replacementLength, cursorPosition, image, displayString,
+ replacementOffset, replacementLength, cursorPosition, image, displayString, null,
null, additionalProposalInfo, relevance);
}
contentAssistRequest.addProposal(proposal);
@@ -329,7 +320,7 @@
return;
}
String matchString = EL_NUMBER_PREFIX + prefix.getText();
- String query = matchString;
+ String query = (matchString == null ? "" : matchString); //$NON-NLS-1$
String stringQuery = matchString;
int beginChangeOffset = prefix.getStartOffset() + prefix.getOffset();
@@ -338,43 +329,26 @@
TextProposal[] proposals = PageProcessor.getInstance().getProposals(kbQuery, getContext());
if (proposals == null || proposals.length == 0)
return;
-
+
+ String restOfValue = getRestOfEL(context.getDocument(), context.getInvocationOffset());
for (TextProposal textProposal : proposals) {
int replacementOffset = beginChangeOffset;
int replacementLength = prefix.getLength();
String replacementString = prefix.getText().substring(0, replacementLength);
- if (textProposal.getReplacementString().trim().startsWith("[") && replacementString.endsWith(".")) { //$NON-NLS-1$ //$NON-NLS-2$
+ String alternateMatch = null;
+ if (textProposal.getReplacementString().trim().startsWith("[") && replacementString.indexOf('.') != -1) { //$NON-NLS-1$
// Need to include last '.' (dot) char into the string to replace
- replacementString = replacementString.substring(0, replacementString.length() - 1);
+ replacementString = replacementString.substring(0, replacementString.lastIndexOf('.'));
+ alternateMatch = replacementString + '.' + textProposal.getAlternateMatch();
}
replacementString += textProposal.getReplacementString();
int cursorPosition = replacementString.length();
-
+
// Check if it is a long named property to be inserted
if (replacementString.indexOf('[') != -1) {
// That's it - The long message property
- // Need to get the rest of line from context.getInvocationOffset()
- IDocument doc = context.getDocument();
-
- String restOfLine = "";
- String restOfValue = "";
- int endPosition = -1;
- try {
- int line = doc.getLineOfOffset(context.getInvocationOffset());
- int lineStart = doc.getLineOffset(line);
- int lineLength = doc.getLineLength(line);
- String sDoc = doc.get();
- restOfValue = restOfLine = sDoc.substring(context.getInvocationOffset(), lineStart + lineLength);
- if (endPosition != -1) {
- // Use end of line
- restOfValue = restOfValue.substring(0, endPosition);
- }
- } catch (BadLocationException e) {
- // Ignore it
- }
-
// Check if the replacementString is already configured
if (replacementString.indexOf(']') == -1) {
// Is closing ']' is in it?
@@ -382,8 +356,12 @@
// Is the quotation is in it?
int quoteIndex = restOfValue.indexOf('\'');
if (quoteIndex == -1 || paraIndex == -1 || (paraIndex != -1 && quoteIndex > paraIndex)) {
- // Need to insert closing single-quote
- replacementString += '\'';
+ // Need to insert closing single-quote if there is no quote inserted
+ if (!replacementString.endsWith("\'"))
+ replacementString += '\'';
+ } else {
+ if (quoteIndex != -1 && replacementString.endsWith("\'"))
+ replacementString = replacementString.substring(0, replacementString.length() - 1);
}
if (paraIndex == -1) {
// Closing ']' is to be added
@@ -392,16 +370,21 @@
} else {
if (replacementString.endsWith("]") && restOfValue.indexOf(']') != -1) {
replacementString = replacementString.substring(0, replacementString.length() -1);
- cursorPosition = replacementString.length(); // Cursor will be put right after the replacement (not after the closing square bracket in this case)
}
}
+ cursorPosition = replacementString.length(); // Cursor will be put right after the replacement
+ if (replacementString.indexOf(']') == -1) { // Find closing square bracket in restOfValue
+ if (restOfValue.indexOf(']') != -1) {
+ cursorPosition += restOfValue.indexOf(']') + 1;
+ }
+ }
- if (restOfLine.indexOf('}') == -1) {
+ if (restOfValue.indexOf('}') == -1) {
// Add closing }-char
replacementString += '}';
}
} else {
- if (!prefix.isELClosed()) {
+ if (restOfValue.indexOf('}') == -1) {
replacementString += "}"; //$NON-NLS-1$
}
}
@@ -425,13 +408,17 @@
IJavaElement[] javaElements = ((ELTextProposal)textProposal).getAllJavaElements();
proposal = new AutoELContentAssistantProposal(replacementString,
- replacementOffset, replacementLength, cursorPosition, image, displayString,
+ replacementOffset, replacementLength, cursorPosition, image, displayString, null,
null, javaElements, relevance);
+ } else if (textProposal instanceof MessagesELTextProposal) {
+ proposal = new AutoELContentAssistantProposal(replacementString,
+ replacementOffset, replacementLength, cursorPosition, image, displayString, alternateMatch,
+ null, (MessagesELTextProposal)textProposal, relevance);
} else {
String additionalProposalInfo = (textProposal.getContextInfo() == null ? "" : textProposal.getContextInfo()); //$NON-NLS-1$
proposal = new AutoContentAssistantProposal(replacementString,
- replacementOffset, replacementLength, cursorPosition, image, displayString,
+ replacementOffset, replacementLength, cursorPosition, image, displayString, null,
null, additionalProposalInfo, relevance);
}
@@ -440,7 +427,7 @@
if (prefix.isELStarted() && !prefix.isELClosed()) {
AutoContentAssistantProposal proposal = new AutoContentAssistantProposal("}", //$NON-NLS-1$
- getOffset(), 0, 1, JSF_EL_PROPOSAL_IMAGE, JstUIMessages.JspContentAssistProcessor_CloseELExpression,
+ getOffset(), 0, 1, JSF_EL_PROPOSAL_IMAGE, JstUIMessages.JspContentAssistProcessor_CloseELExpression, null,
null, JstUIMessages.JspContentAssistProcessor_CloseELExpressionInfo, TextProposal.R_XML_ATTRIBUTE_VALUE_TEMPLATE);
contentAssistRequest.addProposal(proposal);
@@ -465,10 +452,9 @@
return;
}
String matchString = EL_NUMBER_PREFIX + prefix.getText();
- String query = matchString;
- if (query == null)
- query = ""; //$NON-NLS-1$
+ String query = (matchString == null ? "" : matchString); //$NON-NLS-1$
String stringQuery = matchString;
+
int relevanceShift = -2; // Fix for JBIDE-5987: Relevance for predicate proposals is shifted down by default to show EL proposals lower than attr-value proposals
if (shiftRelevanceAgainstTagNameProposals) {
relevanceShift += prefix.getText() != null && prefix.getText().trim().length() > 0 ? 0 : -2;
@@ -518,13 +504,13 @@
IJavaElement[] javaElements = ((ELTextProposal)textProposal).getAllJavaElements();
proposal = new AutoELContentAssistantProposal(replacementString,
- replacementOffset, replacementLength, cursorPosition, image, displayString,
+ replacementOffset, replacementLength, cursorPosition, image, displayString, null,
null, javaElements, relevance);
} else {
String additionalProposalInfo = (textProposal.getContextInfo() == null ? "" : textProposal.getContextInfo()); //$NON-NLS-1$
proposal = new AutoContentAssistantProposal(replacementString,
- replacementOffset, replacementLength, cursorPosition, image, displayString,
+ replacementOffset, replacementLength, cursorPosition, image, displayString, null,
null, additionalProposalInfo, relevance);
}
contentAssistRequest.addProposal(proposal);
@@ -783,7 +769,35 @@
}
}
}
+
+ protected String getRestOfEL(IDocument doc, int invokationOffset) {
+ int endPosition = -1;
+ try {
+ int line = doc.getLineOfOffset(invokationOffset);
+ int lineStart = doc.getLineOffset(line);
+ int lineLength = doc.getLineLength(line);
+ String sDoc = doc.get();
+ String restOfValue = sDoc.substring(invokationOffset, lineStart + lineLength);
+
+ int boel = restOfValue.indexOf("#{"); //$NON-NLS-1$
+ boel = (boel == -1 ? restOfValue.indexOf("${") : boel); //$NON-NLS-1$
+ int eoel = restOfValue.indexOf('}');
+ eoel = (eoel == -1 ? -1 : eoel + 1);
+
+ endPosition = boel;
+ if (endPosition == -1 || endPosition > eoel)
+ endPosition = eoel;
+ if (endPosition != -1)
+ restOfValue = restOfValue.substring(0, endPosition);
+
+ return restOfValue;
+ } catch (BadLocationException e) {
+ // Ignore it
+ return ""; //$NON-NLS-1$
+ }
+ }
+
/**
* Returns URI for the current/parent tag
* @return
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/info/ELInfoHoverMessages.properties
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/info/ELInfoHoverMessages.properties 2011-11-10 14:56:30 UTC (rev 36277)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/info/ELInfoHoverMessages.properties 2011-11-10 15:14:12 UTC (rev 36278)
@@ -3,11 +3,3 @@
ELInfoHover_noAttachedJavadoc= <em>Note: This element has no attached Javadoc and the Javadoc could not be found in the attached source.</em>
ELInfoHover_noInformation= <em>Note: The Javadoc for this element could neither be found in the attached source nor the attached Javadoc.</em>
ELInfoHover_error_gettingJavadoc= <em>Note: An exception occurred while getting the Javadoc. See log for details.</em>
-ELInfoHover_baseName=<b>Base Name:</b> {0}<br>
-ELInfoHover_propertyName=<b>Property:</b> {0}<br>
-ELInfoHover_resourceBundle=<b>Resource Bundle:</b> {0}<br>
-ELInfoHover_resourceBundlePropertyValue=<b>Value:</b> {0}{1}<br>
-ELInfoHover_resourceBundlePropertyValueNotDefined=[Value not defined]
-ELInfoHover_resourceBundleNotDefined=[Resource Bundle not defined]
-ELInfoHover_newLine=<br>
-ELInfoHover_treeDots=...
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/info/FaceletTagInfoHoverProcessor.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/info/FaceletTagInfoHoverProcessor.java 2011-11-10 14:56:30 UTC (rev 36277)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/info/FaceletTagInfoHoverProcessor.java 2011-11-10 15:14:12 UTC (rev 36278)
@@ -13,14 +13,11 @@
import java.io.IOException;
import java.io.Reader;
import java.io.StringReader;
-import java.text.MessageFormat;
import java.util.List;
import java.util.Map;
import org.eclipse.core.filebuffers.FileBuffers;
import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.jdt.core.IJavaElement;
@@ -56,10 +53,10 @@
import org.jboss.tools.common.el.core.resolver.ELResolver;
import org.jboss.tools.common.el.core.resolver.ELSegment;
import org.jboss.tools.common.el.core.resolver.JavaMemberELSegmentImpl;
-import org.jboss.tools.common.el.core.resolver.MessagePropertyELSegment;
+import org.jboss.tools.common.el.ui.ca.ELProposalProcessor;
import org.jboss.tools.common.model.XModelObject;
-import org.jboss.tools.common.model.filesystems.impl.JarSystemImpl;
import org.jboss.tools.common.text.TextProposal;
+import org.jboss.tools.common.util.StringUtil;
import org.jboss.tools.jst.jsp.contentassist.Utils;
import org.jboss.tools.jst.jsp.contentassist.computers.AbstractXmlCompletionProposalComputer.TextRegion;
import org.jboss.tools.jst.web.kb.IPageContext;
@@ -224,73 +221,10 @@
return (hover == null ? null : hover.getHtml());
} else if (segment instanceof MessagePropertyELSegmentImpl) {
MessagePropertyELSegmentImpl mpSegment = (MessagePropertyELSegmentImpl)segment;
-
String baseName = mpSegment.getBaseName();
- String propertyName = ((MessagePropertyELSegment)segment).isBundle() ? null : trimQuotes(segment.getToken().getText());
+ String propertyName = mpSegment.isBundle() ? null : StringUtil.trimQuotes(segment.getToken().getText());
- StringBuilder sb = new StringBuilder();
- if (propertyName != null && propertyName.length() > 0)
- sb.append(MessageFormat.format(ELInfoHoverMessages.ELInfoHover_propertyName,
- propertyName));
-
- if (baseName != null && baseName.length() > 0)
- sb.append(MessageFormat.format(ELInfoHoverMessages.ELInfoHover_baseName,
- baseName));
- sb.append(ELInfoHoverMessages.ELInfoHover_newLine);
-
- List<XModelObject> objects = (List<XModelObject>)mpSegment.getObjects();
- for (XModelObject o : objects) {
- IFile propFile = (IFile)o.getAdapter(IFile.class);
- String propFilePath = null;
- if (propFile != null) {
- propFilePath = propFile.getFullPath().toString();
- } else {
- XModelObject parent = o.getFileType() == XModelObject.FILE ? o : o.getParent();
- String path = parent.getPath();
- while (parent != null && parent.getFileType() != XModelObject.SYSTEM) {
- parent = parent.getParent();
- }
- if (parent instanceof JarSystemImpl) {
- String sysPath = parent.getPath();
- path = path.substring(sysPath.length());
-
- String jarPath = ((JarSystemImpl) parent).getLocation();
-
- IResource jar = ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(new Path(jarPath));
-
- if (jar != null) {
- jarPath = jar.getFullPath().toString();
- }
-
- propFilePath = jarPath + "!" + path; //$NON-NLS-1$
- }
- }
- sb.append(MessageFormat.format(ELInfoHoverMessages.ELInfoHover_resourceBundle,
- propFilePath != null ? propFilePath : ELInfoHoverMessages.ELInfoHover_resourceBundleNotDefined));
-
- if (propertyName != null) {
- String value = o.get("VALUE"); //$NON-NLS-1$
- boolean addCut = false;
- if (value != null) {
- if (value.length() > 100) {
- // Get first words of value
- int lastSpace = value.lastIndexOf(' ', 99);
- if (lastSpace != -1) {
- value = value.substring(0, lastSpace);
- } else { // cut as is
- value = value.substring(0, 100);
- }
- addCut = true;
- }
- }
- sb.append(MessageFormat.format(ELInfoHoverMessages.ELInfoHover_resourceBundlePropertyValue,
- value != null ? value : ELInfoHoverMessages.ELInfoHover_resourceBundlePropertyValueNotDefined,
- addCut ? ELInfoHoverMessages.ELInfoHover_treeDots : "")); //$NON-NLS-1$
- sb.append(ELInfoHoverMessages.ELInfoHover_newLine);
- }
- }
-
- return sb.toString();
+ return ELProposalProcessor.getELMessagesHoverInternal(baseName, propertyName, (List<XModelObject>)mpSegment.getObjects());
}
}
@@ -511,19 +445,4 @@
}
};
}
-
- private String trimQuotes(String value) {
- if(value == null)
- return null;
-
- if(value.startsWith("'") || value.startsWith("\"")) { //$NON-NLS-1$ //$NON-NLS-2$
- value = value.substring(1);
- }
-
- if(value.endsWith("'") || value.endsWith("\"")) { //$NON-NLS-1$ //$NON-NLS-2$
- value = value.substring(0, value.length() - 1);
- }
- return value;
- }
-
}
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/info/JavaStringELInfoHover.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/info/JavaStringELInfoHover.java 2011-11-10 14:56:30 UTC (rev 36277)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/info/JavaStringELInfoHover.java 2011-11-10 15:14:12 UTC (rev 36278)
@@ -16,6 +16,7 @@
import java.io.Reader;
import java.io.StringReader;
import java.net.URL;
+import java.util.List;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
@@ -57,13 +58,17 @@
import org.jboss.tools.common.el.core.resolver.ELResolver;
import org.jboss.tools.common.el.core.resolver.ELSegment;
import org.jboss.tools.common.el.core.resolver.JavaMemberELSegmentImpl;
+import org.jboss.tools.common.el.ui.ca.ELProposalProcessor;
+import org.jboss.tools.common.model.XModelObject;
import org.jboss.tools.common.text.TextProposal;
+import org.jboss.tools.common.util.StringUtil;
import org.jboss.tools.jst.jsp.JspEditorPlugin;
import org.jboss.tools.jst.jsp.contentassist.Utils;
import org.jboss.tools.jst.web.kb.KbQuery;
import org.jboss.tools.jst.web.kb.PageContextFactory;
import org.jboss.tools.jst.web.kb.PageProcessor;
import org.jboss.tools.jst.web.kb.KbQuery.Type;
+import org.jboss.tools.jst.web.kb.el.MessagePropertyELSegmentImpl;
import org.osgi.framework.Bundle;
/**
@@ -253,6 +258,8 @@
continue;
ELSegment segment = resolution.getLastSegment();
+ if (!segment.isResolved()) continue;
+
if(segment instanceof JavaMemberELSegmentImpl) {
JavaMemberELSegmentImpl jmSegment = (JavaMemberELSegmentImpl)segment;
@@ -267,6 +274,17 @@
continue;
return JavaStringELInfoHover.getHoverInfo2Internal(javaElements, true);
+ } else if (segment instanceof MessagePropertyELSegmentImpl) {
+ MessagePropertyELSegmentImpl mpSegment = (MessagePropertyELSegmentImpl)segment;
+ String baseName = mpSegment.getBaseName();
+ String propertyName = mpSegment.isBundle() ? null : StringUtil.trimQuotes(segment.getToken().getText());
+ String hoverText = ELProposalProcessor.getELMessagesHoverInternal(baseName, propertyName, (List<XModelObject>)mpSegment.getObjects());
+ StringBuffer buffer = new StringBuffer(hoverText);
+
+ HTMLPrinter.insertPageProlog(buffer, 0, getStyleSheet());
+ HTMLPrinter.addPageEpilog(buffer);
+
+ return new ELInfoHoverBrowserInformationControlInput(null, new IJavaElement[0], buffer.toString(), 0);
}
}
Modified: trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/ELHyperlink.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/ELHyperlink.java 2011-11-10 14:56:30 UTC (rev 36277)
+++ trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/ELHyperlink.java 2011-11-10 15:14:12 UTC (rev 36278)
@@ -27,6 +27,7 @@
import org.jboss.tools.common.text.ext.hyperlink.AbstractHyperlink;
import org.jboss.tools.common.text.ext.hyperlink.xpl.Messages;
import org.jboss.tools.common.text.ext.util.StructuredSelectionHelper;
+import org.jboss.tools.common.util.StringUtil;
import org.jboss.tools.jst.text.ext.JSTExtensionsPlugin;
public class ELHyperlink extends AbstractHyperlink{
@@ -80,20 +81,6 @@
}
}
- private String trimQuotes(String value) {
- if(value == null)
- return null;
-
- if(value.startsWith("'") || value.startsWith("\"")) { //$NON-NLS-1$ //$NON-NLS-2$
- value = value.substring(1);
- }
-
- if(value.endsWith("'") || value.endsWith("\"")) { //$NON-NLS-1$ //$NON-NLS-2$
- value = value.substring(0, value.length() - 1);
- }
- return value;
- }
-
// private String getRequestMethod(Properties prop) {
// return prop != null && prop.getProperty(WebPromptingProvider.KEY) == null ?
// WebPromptingProvider.JSF_OPEN_BUNDLE : WebPromptingProvider.JSF_OPEN_KEY;
@@ -110,7 +97,7 @@
}else if(segment instanceof MessagePropertyELSegment){
//TODO move to getLabel() in openable in MessagePropertyELSegmentImpl
String baseName = ((MessagePropertyELSegment)segment).getBaseName();
- String propertyName = ((MessagePropertyELSegment)segment).isBundle() ? null : trimQuotes(((MessagePropertyELSegment)segment).getToken().getText());
+ String propertyName = ((MessagePropertyELSegment)segment).isBundle() ? null : StringUtil.trimQuotes(((MessagePropertyELSegment)segment).getToken().getText());
if (propertyName == null)
return MessageFormat.format(Messages.Open, baseName);
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/el/MessagePropertyELSegmentImpl.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/el/MessagePropertyELSegmentImpl.java 2011-11-10 14:56:30 UTC (rev 36277)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/el/MessagePropertyELSegmentImpl.java 2011-11-10 15:14:12 UTC (rev 36278)
@@ -18,7 +18,6 @@
import org.eclipse.core.resources.IResource;
import org.eclipse.swt.graphics.Image;
import org.jboss.tools.common.el.core.ElCoreMessages;
-import org.jboss.tools.common.el.core.ca.AbstractELCompletionEngine;
import org.jboss.tools.common.el.core.parser.LexicalToken;
import org.jboss.tools.common.el.core.resolver.ELSegmentImpl;
import org.jboss.tools.common.el.core.resolver.IOpenableReference;
@@ -26,6 +25,7 @@
import org.jboss.tools.common.model.XModelObject;
import org.jboss.tools.common.model.util.FindObjectHelper;
import org.jboss.tools.common.text.ITextSourceReference;
+import org.jboss.tools.common.util.StringUtil;
/**
* @author Daniel Azarov
@@ -123,7 +123,7 @@
// Improve label - add a locale for a resource bundle
String baseName = getBaseName();
- String propertyName = isBundle() ? null : AbstractELCompletionEngine.trimQuotes(getToken().getText());
+ String propertyName = isBundle() ? null : StringUtil.trimQuotes(getToken().getText());
if (propertyName == null)
return MessageFormat.format(ElCoreMessages.OpenBundle, baseName);
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/SeamELCompletionEngine.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/SeamELCompletionEngine.java 2011-11-10 14:56:30 UTC (rev 36277)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/SeamELCompletionEngine.java 2011-11-10 15:14:12 UTC (rev 36278)
@@ -49,6 +49,7 @@
import org.jboss.tools.common.model.XModelObjectConstants;
import org.jboss.tools.common.model.filesystems.FileSystemsHelper;
import org.jboss.tools.common.text.TextProposal;
+import org.jboss.tools.common.util.StringUtil;
import org.jboss.tools.jst.web.kb.el.MessagePropertyELSegmentImpl;
import org.jboss.tools.seam.core.IBijectedAttribute;
import org.jboss.tools.seam.core.ISeamComponent;
@@ -217,26 +218,26 @@
} else if (expr instanceof ELArgumentInvocation) {
segment = new MessagePropertyELSegmentImpl(((ELArgumentInvocation)expr).getArgument().getOpenArgumentToken().getNextToken());
}
- if(segment.getToken() == null) {
- return false;
- }
Set<TextProposal> kbProposals = new TreeSet<TextProposal>(TextProposal.KB_PROPOSAL_ORDER);
- String propertyName = segment.getToken().getText();
- Map<String, List<XModelObject>> properties = messagesInfo.getPropertiesMap();
- List<XModelObject> os = properties.get(trimQuotes(propertyName));
- if(os != null) {
- for(XModelObject o: os) {
- segment.addObject(o);
+ if (segment.getToken() != null) {
+ String propertyName = segment.getToken().getText();
+ Map<String, List<XModelObject>> properties = messagesInfo.getPropertiesMap();
+ List<XModelObject> os = properties.get(StringUtil.trimQuotes(propertyName));
+ if(os != null) {
+ for(XModelObject o: os) {
+ segment.addObject(o);
+ }
+
+ // Using 'base name' in seam is not a good idea.
+ // if(!os.isEmpty()) {
+ // segment.setBaseName(getBundle(os.get(0)));
+ // } else {
+ // segment.setBaseName("messages");
+ // }
}
- if(!os.isEmpty()) {
- segment.setBaseName(getBundle(os.get(0)));
- } else {
- segment.setBaseName("messages");
- }
- }
-
+ }
if(segment.getToken()!=null) {
resolution.addSegment(segment);
}
@@ -248,73 +249,66 @@
}
} else
if(expr.getType() != ELObjectType.EL_ARGUMENT_INVOCATION) {
- Set<String> proposalsToFilter = new TreeSet<String>();
+ String filter = (expr.getMemberName() == null ? "" : expr.getMemberName());
+
for (TypeInfoCollector.MemberInfo mbr : members) {
- filterSingularMember((MessagesInfo)mbr, proposalsToFilter);
- }
- for (String proposal : proposalsToFilter) {
- // We do expect nothing but name for method tokens (No round brackets)
- String filter = expr.getMemberName();
- if(filter == null) filter = ""; //$NON-NLS-1$
- if(returnEqualedVariablesOnly) {
- // This is used for validation.
- if (proposal.equals(filter)) {
- MessagesELTextProposal kbProposal = createProposal(messagesInfo, proposal);
+ Collection<String> keys = ((MessagesInfo)mbr).getKeys();
+ for (String key : keys) {
+ if(returnEqualedVariablesOnly) {
+ // This is used for validation.
+ if (key.equals(filter)) {
+ MessagesELTextProposal kbProposal = createProposal(messagesInfo, key);
+ kbProposals.add(kbProposal);
+ break;
+ }
+ } else if (key.startsWith(filter)) {
+ // This is used for CA.
+ MessagesELTextProposal kbProposal = createProposal(messagesInfo, key);
+ if (key.indexOf('.') == -1) kbProposal.setReplacementString(key.substring(filter.length()));
+ else kbProposal.setReplacementString('[' + kbProposal.getReplacementString());
kbProposals.add(kbProposal);
- break;
}
- } else if (proposal.startsWith(filter)) {
- // This is used for CA.
- MessagesELTextProposal kbProposal = createProposal(messagesInfo, proposal);
- kbProposal.setReplacementString(proposal.substring(filter.length()));
- kbProposals.add(kbProposal);
}
}
} else if(expr.getType() == ELObjectType.EL_ARGUMENT_INVOCATION) {
- Set<String> proposalsToFilter = new TreeSet<String>();
- boolean isMessages = false;
+ String filter = expr.getMemberName() == null ? "" : expr.getMemberName();
+ boolean b = filter.startsWith("'") || filter.startsWith("\""); //$NON-NLS-1$ //$NON-NLS-2$
+ filter = StringUtil.trimQuotes(filter);
+
for (TypeInfoCollector.MemberInfo mbr : members) {
- isMessages = true;
- filterSingularMember((MessagesInfo)mbr, proposalsToFilter);
- }
- String filter = expr.getMemberName();
- boolean bSurroundWithQuotes = false;
- if(filter == null) {
- filter = ""; //$NON-NLS-1$
- bSurroundWithQuotes = true;
- } else {
- boolean b = filter.startsWith("'") || filter.startsWith("\""); //$NON-NLS-1$ //$NON-NLS-2$
- boolean e = filter.endsWith("'") || filter.endsWith("\""); //$NON-NLS-1$ //$NON-NLS-2$
- if((b) && (e)) {
- filter = filter.length() == 1 ? "" : filter.substring(1, filter.length() - 1); //$NON-NLS-1$
- } else if(b && !returnEqualedVariablesOnly) {
- filter = filter.substring(1);
- } else {
+ if (!b && filter.length() > 0) {
//Value is set as expression itself, we cannot compute it
- if(isMessages) {
- resolution.setMapOrCollectionOrBundleAmoungTheTokens(true);
- }
+ resolution.setMapOrCollectionOrBundleAmoungTheTokens(true);
return true;
}
- }
- for (String proposal : proposalsToFilter) {
- if(returnEqualedVariablesOnly) {
- // This is used for validation.
- if (proposal.equals(filter)) {
- MessagesELTextProposal kbProposal = createProposal(messagesInfo, proposal);
+ Collection<String> keys = ((MessagesInfo)mbr).getKeys();
+ for (String key : keys) {
+ if(returnEqualedVariablesOnly) {
+ // This is used for validation.
+ if (key.equals(filter)) {
+ MessagesELTextProposal kbProposal = createProposal(messagesInfo, key);
+ kbProposals.add(kbProposal);
+ break;
+ }
+ } else if (key.startsWith(filter)) {
+ // This is used for CA.
+ MessagesELTextProposal kbProposal = createProposal(messagesInfo, key);
+ String existingString = expr.getMemberName() == null ? "" : expr.getMemberName();
+ // Because we're in argument invocation we should fix the proposal by surrounding it with quotes as needed
+ String replacement = kbProposal.getReplacementString();
+ String label = kbProposal.getLabel();
+ if (!replacement.startsWith("'")) {
+ replacement = '\'' + key + '\'';
+ label = "['" + key + "']";
+ }
+ replacement = replacement.substring(existingString.length());
+
+ kbProposal.setReplacementString(replacement);
+ kbProposal.setLabel(label);
+
kbProposals.add(kbProposal);
- break;
}
- } else if (proposal.startsWith(filter)) {
- // This is used for CA.
- MessagesELTextProposal kbProposal = createProposal(messagesInfo, proposal);
- String replacementString = proposal.substring(filter.length());
- if (bSurroundWithQuotes) {
- replacementString = "'" + replacementString + "']"; //$NON-NLS-1$ //$NON-NLS-2$
- }
- kbProposal.setReplacementString(replacementString);
- kbProposals.add(kbProposal);
}
}
}
@@ -336,29 +330,40 @@
String key = sortedKeys.next();
if (key == null || key.length() == 0)
continue;
+
MessagesELTextProposal proposal = createProposal((MessagesInfo)mbr, key);
+ if (key.indexOf('.') != -1) {
+ proposal.setReplacementString("['" + key + "']"); //$NON-NLS-1$ //$NON-NLS-2$
+ proposal.setLabel("['" + key + "']");
+ } else {
+ proposal.setReplacementString(key);
+ proposal.setLabel(key);
+ }
kbProposals.add(proposal);
}
}
}
private MessagesELTextProposal createProposal(MessagesInfo mbr, String proposal) {
- Map<String, List<XModelObject>> properties = mbr.getPropertiesMap();
- List<XModelObject> ps = properties.get(proposal);
- String bundle = ps.isEmpty() ? "messages" : getBundle(ps.get(0));
-
MessagesELTextProposal kbProposal = new MessagesELTextProposal();
- kbProposal.setBaseName(bundle);
- kbProposal.setObjects(ps);
-
if (proposal.indexOf('.') != -1) {
- kbProposal.setReplacementString("['" + proposal + "']");
+ kbProposal.setReplacementString('\'' + proposal + '\'');
kbProposal.setLabel("['" + proposal + "']");
} else {
kbProposal.setReplacementString(proposal);
kbProposal.setLabel(proposal);
}
+ kbProposal.setAlternateMatch(proposal);
kbProposal.setImage(SEAM_MESSAGES_PROPOSAL_IMAGE);
+
+ Map<String, List<XModelObject>> properties = mbr.getPropertiesMap();
+ List<XModelObject> ps = properties.get(proposal);
+// String bundle = ps.isEmpty() ? "messages" : getBundle(ps.get(0)); // Using 'base name' in seam is not a good idea.
+
+// kbProposal.setBaseName(bundle); // Using 'base name' in seam is not a good idea.
+ kbProposal.setPropertyName(proposal);
+ kbProposal.setObjects(ps);
+
return kbProposal;
}
@@ -383,13 +388,6 @@
}
}
- protected void filterSingularMember(MessagesInfo mbr, Set<String> proposalsToFilter) {
- Collection<String> keys = ((MessagesInfo)mbr).getKeys();
- for (String key : keys) {
- proposalsToFilter.add(key);
- }
- }
-
/**
* Returns scope for the resource
* @param project
13 years, 1 month
JBoss Tools SVN: r36277 - trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors.
by jbosstools-commits@lists.jboss.org
Author: snjeza
Date: 2011-11-10 09:56:30 -0500 (Thu, 10 Nov 2011)
New Revision: 36277
Modified:
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/RefreshIndicator.java
Log:
JBIDE-10153 org.eclipse.swt.SWTException when closing JBoss Central editor
Modified: trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/RefreshIndicator.java
===================================================================
--- trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/RefreshIndicator.java 2011-11-10 13:30:08 UTC (rev 36276)
+++ trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/RefreshIndicator.java 2011-11-10 14:56:30 UTC (rev 36277)
@@ -108,6 +108,10 @@
while (!stop) {
Display.getDefault().syncExec(new Runnable() {
public void run() {
+ if (isDisposed() || getParent() == null || getParent().isDisposed()) {
+ setBusy(false);
+ return;
+ }
if (!getParent().isVisible()) {
return;
}
13 years, 1 month
JBoss Tools SVN: r36276 - in branches/dead/hibernatetools-multiversion2/plugins: org.hibernate.eclipse/src/org/hibernate/console/ext and 3 other directories.
by jbosstools-commits@lists.jboss.org
Author: dgeraskov
Date: 2011-11-10 08:30:08 -0500 (Thu, 10 Nov 2011)
New Revision: 36276
Added:
branches/dead/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/ext/CompletionProposalsResult.java
Removed:
branches/dead/hibernatetools-multiversion2/plugins/org.hibernate.eclipse/src/org/hibernate/console/ext/CompletionProposalsResult.java
Modified:
branches/dead/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/ext/ConsoleExtension.java
branches/dead/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/hqleditor/HQLCompletionProcessor2.java
branches/dead/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/HQLJavaCompletionProposalComputer.java
branches/dead/hibernatetools-multiversion2/plugins/org.hibernate.eclipse/META-INF/MANIFEST.MF
Log:
Moved CompletionResult to console plugin
Modified: branches/dead/hibernatetools-multiversion2/plugins/org.hibernate.eclipse/META-INF/MANIFEST.MF
===================================================================
--- branches/dead/hibernatetools-multiversion2/plugins/org.hibernate.eclipse/META-INF/MANIFEST.MF 2011-11-10 13:29:59 UTC (rev 36275)
+++ branches/dead/hibernatetools-multiversion2/plugins/org.hibernate.eclipse/META-INF/MANIFEST.MF 2011-11-10 13:30:08 UTC (rev 36276)
@@ -21,8 +21,7 @@
org.eclipse.ui.console,
org.eclipse.jface,
org.eclipse.jdt.apt.core,
- org.eclipse.datatools.connectivity,
- org.eclipse.jface.text;bundle-version="3.7.0"
+ org.eclipse.datatools.connectivity
Bundle-ActivationPolicy: lazy
Eclipse-BuddyPolicy: registered
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Deleted: branches/dead/hibernatetools-multiversion2/plugins/org.hibernate.eclipse/src/org/hibernate/console/ext/CompletionProposalsResult.java
===================================================================
--- branches/dead/hibernatetools-multiversion2/plugins/org.hibernate.eclipse/src/org/hibernate/console/ext/CompletionProposalsResult.java 2011-11-10 13:29:59 UTC (rev 36275)
+++ branches/dead/hibernatetools-multiversion2/plugins/org.hibernate.eclipse/src/org/hibernate/console/ext/CompletionProposalsResult.java 2011-11-10 13:30:08 UTC (rev 36276)
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributor:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.hibernate.console.ext;
-
-import java.util.List;
-
-import org.eclipse.jface.text.contentassist.ICompletionProposal;
-
-/**
- * @author Dmitry Geraskov
- *
- */
-public class CompletionProposalsResult {
-
- private final List<ICompletionProposal> result;
-
- private final String errorMessage;
-
- public CompletionProposalsResult(List<ICompletionProposal> result, String errorMessage){
- this.result = result;
- this.errorMessage = errorMessage;
- }
-
- public List<ICompletionProposal> getCompletionProposals() {
- return result;
- }
-
- public String getErrorMessage() {
- return errorMessage;
- }
-
-}
Copied: branches/dead/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/ext/CompletionProposalsResult.java (from rev 36160, branches/dead/hibernatetools-multiversion2/plugins/org.hibernate.eclipse/src/org/hibernate/console/ext/CompletionProposalsResult.java)
===================================================================
--- branches/dead/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/ext/CompletionProposalsResult.java (rev 0)
+++ branches/dead/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/ext/CompletionProposalsResult.java 2011-11-10 13:30:08 UTC (rev 36276)
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.hibernate.eclipse.console.ext;
+
+import java.util.List;
+
+import org.eclipse.jface.text.contentassist.ICompletionProposal;
+
+/**
+ * @author Dmitry Geraskov
+ *
+ */
+public class CompletionProposalsResult {
+
+ private final List<ICompletionProposal> result;
+
+ private final String errorMessage;
+
+ public CompletionProposalsResult(List<ICompletionProposal> result, String errorMessage){
+ this.result = result;
+ this.errorMessage = errorMessage;
+ }
+
+ public List<ICompletionProposal> getCompletionProposals() {
+ return result;
+ }
+
+ public String getErrorMessage() {
+ return errorMessage;
+ }
+
+}
Modified: branches/dead/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/ext/ConsoleExtension.java
===================================================================
--- branches/dead/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/ext/ConsoleExtension.java 2011-11-10 13:29:59 UTC (rev 36275)
+++ branches/dead/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/ext/ConsoleExtension.java 2011-11-10 13:30:08 UTC (rev 36276)
@@ -10,7 +10,6 @@
******************************************************************************/
package org.hibernate.eclipse.console.ext;
-import org.hibernate.console.ext.CompletionProposalsResult;
import org.hibernate.console.ext.HibernateExtension;
/**
Modified: branches/dead/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/hqleditor/HQLCompletionProcessor2.java
===================================================================
--- branches/dead/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/hqleditor/HQLCompletionProcessor2.java 2011-11-10 13:29:59 UTC (rev 36275)
+++ branches/dead/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/hqleditor/HQLCompletionProcessor2.java 2011-11-10 13:30:08 UTC (rev 36276)
@@ -35,10 +35,10 @@
import org.eclipse.jface.text.contentassist.IContextInformation;
import org.eclipse.jface.text.contentassist.IContextInformationValidator;
import org.hibernate.console.ConsoleConfiguration;
-import org.hibernate.console.ext.CompletionProposalsResult;
import org.hibernate.eclipse.console.HibernateConsoleMessages;
import org.hibernate.eclipse.console.HibernateConsolePlugin;
import org.hibernate.eclipse.console.QueryEditor;
+import org.hibernate.eclipse.console.ext.CompletionProposalsResult;
import org.hibernate.eclipse.console.ext.ConsoleExtension;
import org.hibernate.eclipse.console.ext.ConsoleExtensionManager;
Modified: branches/dead/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/HQLJavaCompletionProposalComputer.java
===================================================================
--- branches/dead/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/HQLJavaCompletionProposalComputer.java 2011-11-10 13:29:59 UTC (rev 36275)
+++ branches/dead/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/HQLJavaCompletionProposalComputer.java 2011-11-10 13:30:08 UTC (rev 36276)
@@ -36,8 +36,8 @@
import org.eclipse.jface.text.contentassist.IContextInformation;
import org.hibernate.cfg.Configuration;
import org.hibernate.console.ConsoleConfiguration;
-import org.hibernate.console.ext.CompletionProposalsResult;
import org.hibernate.eclipse.console.HibernateConsolePlugin;
+import org.hibernate.eclipse.console.ext.CompletionProposalsResult;
import org.hibernate.eclipse.console.ext.ConsoleExtension;
import org.hibernate.eclipse.console.ext.ConsoleExtensionManager;
import org.hibernate.eclipse.hqleditor.HQLCompletionProcessor2;
13 years, 1 month
JBoss Tools SVN: r36275 - in branches/dead/hibernatetools-multiversion2/plugins: org.jboss.tools.hibernate4_0/src/org/jboss/tools/hibernate4_0 and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: dgeraskov
Date: 2011-11-10 08:29:59 -0500 (Thu, 10 Nov 2011)
New Revision: 36275
Modified:
branches/dead/hibernatetools-multiversion2/plugins/org.jboss.tools.hibernate3_5/src/org/jboss/tools/hibernate3_5/ConsoleExtension3_5.java
branches/dead/hibernatetools-multiversion2/plugins/org.jboss.tools.hibernate3_5/src/org/jboss/tools/hibernate3_5/HibernateExtension3_5.java
branches/dead/hibernatetools-multiversion2/plugins/org.jboss.tools.hibernate4_0/src/org/jboss/tools/hibernate4_0/ConsoleExtension4_0.java
branches/dead/hibernatetools-multiversion2/plugins/org.jboss.tools.hibernate4_0/src/org/jboss/tools/hibernate4_0/HibernateExtension4_0.java
Log:
Moved CompletionResult to console plugin
Modified: branches/dead/hibernatetools-multiversion2/plugins/org.jboss.tools.hibernate3_5/src/org/jboss/tools/hibernate3_5/ConsoleExtension3_5.java
===================================================================
--- branches/dead/hibernatetools-multiversion2/plugins/org.jboss.tools.hibernate3_5/src/org/jboss/tools/hibernate3_5/ConsoleExtension3_5.java 2011-11-10 12:58:33 UTC (rev 36274)
+++ branches/dead/hibernatetools-multiversion2/plugins/org.jboss.tools.hibernate3_5/src/org/jboss/tools/hibernate3_5/ConsoleExtension3_5.java 2011-11-10 13:29:59 UTC (rev 36275)
@@ -11,9 +11,9 @@
package org.jboss.tools.hibernate3_5;
import org.hibernate.console.execution.ExecutionContext;
-import org.hibernate.console.ext.CompletionProposalsResult;
import org.hibernate.console.ext.HibernateException;
import org.hibernate.console.ext.HibernateExtension;
+import org.hibernate.eclipse.console.ext.CompletionProposalsResult;
import org.hibernate.eclipse.console.ext.ConsoleExtension;
import org.hibernate.tool.ide.completion.HQLCodeAssist;
import org.hibernate.tool.ide.completion.IHQLCodeAssist;
Modified: branches/dead/hibernatetools-multiversion2/plugins/org.jboss.tools.hibernate3_5/src/org/jboss/tools/hibernate3_5/HibernateExtension3_5.java
===================================================================
--- branches/dead/hibernatetools-multiversion2/plugins/org.jboss.tools.hibernate3_5/src/org/jboss/tools/hibernate3_5/HibernateExtension3_5.java 2011-11-10 12:58:33 UTC (rev 36274)
+++ branches/dead/hibernatetools-multiversion2/plugins/org.jboss.tools.hibernate3_5/src/org/jboss/tools/hibernate3_5/HibernateExtension3_5.java 2011-11-10 13:29:59 UTC (rev 36275)
@@ -26,13 +26,13 @@
import org.hibernate.console.execution.DefaultExecutionContext;
import org.hibernate.console.execution.ExecutionContext;
import org.hibernate.console.execution.ExecutionContext.Command;
-import org.hibernate.console.ext.CompletionProposalsResult;
import org.hibernate.console.ext.HibernateException;
import org.hibernate.console.ext.HibernateExtension;
import org.hibernate.console.ext.QueryResult;
import org.hibernate.console.ext.QueryResultImpl;
import org.hibernate.console.preferences.ConsoleConfigurationPreferences;
import org.hibernate.console.preferences.PreferencesClassPathUtils;
+import org.hibernate.eclipse.console.ext.CompletionProposalsResult;
import org.hibernate.eclipse.libs.FakeDelegatingDriver;
import org.hibernate.tool.ide.completion.HQLCodeAssist;
import org.hibernate.tool.ide.completion.IHQLCodeAssist;
Modified: branches/dead/hibernatetools-multiversion2/plugins/org.jboss.tools.hibernate4_0/src/org/jboss/tools/hibernate4_0/ConsoleExtension4_0.java
===================================================================
--- branches/dead/hibernatetools-multiversion2/plugins/org.jboss.tools.hibernate4_0/src/org/jboss/tools/hibernate4_0/ConsoleExtension4_0.java 2011-11-10 12:58:33 UTC (rev 36274)
+++ branches/dead/hibernatetools-multiversion2/plugins/org.jboss.tools.hibernate4_0/src/org/jboss/tools/hibernate4_0/ConsoleExtension4_0.java 2011-11-10 13:29:59 UTC (rev 36275)
@@ -11,9 +11,9 @@
package org.jboss.tools.hibernate4_0;
import org.hibernate.console.execution.ExecutionContext;
-import org.hibernate.console.ext.CompletionProposalsResult;
import org.hibernate.console.ext.HibernateException;
import org.hibernate.console.ext.HibernateExtension;
+import org.hibernate.eclipse.console.ext.CompletionProposalsResult;
import org.hibernate.eclipse.console.ext.ConsoleExtension;
import org.hibernate.tool.ide.completion.HQLCodeAssist;
import org.hibernate.tool.ide.completion.IHQLCodeAssist;
Modified: branches/dead/hibernatetools-multiversion2/plugins/org.jboss.tools.hibernate4_0/src/org/jboss/tools/hibernate4_0/HibernateExtension4_0.java
===================================================================
--- branches/dead/hibernatetools-multiversion2/plugins/org.jboss.tools.hibernate4_0/src/org/jboss/tools/hibernate4_0/HibernateExtension4_0.java 2011-11-10 12:58:33 UTC (rev 36274)
+++ branches/dead/hibernatetools-multiversion2/plugins/org.jboss.tools.hibernate4_0/src/org/jboss/tools/hibernate4_0/HibernateExtension4_0.java 2011-11-10 13:29:59 UTC (rev 36275)
@@ -29,13 +29,13 @@
import org.hibernate.console.execution.DefaultExecutionContext;
import org.hibernate.console.execution.ExecutionContext;
import org.hibernate.console.execution.ExecutionContext.Command;
-import org.hibernate.console.ext.CompletionProposalsResult;
import org.hibernate.console.ext.HibernateException;
import org.hibernate.console.ext.HibernateExtension;
import org.hibernate.console.ext.QueryResult;
import org.hibernate.console.ext.QueryResultImpl;
import org.hibernate.console.preferences.ConsoleConfigurationPreferences;
import org.hibernate.console.preferences.PreferencesClassPathUtils;
+import org.hibernate.eclipse.console.ext.CompletionProposalsResult;
import org.hibernate.service.BasicServiceRegistry;
import org.hibernate.service.ServiceRegistryBuilder;
import org.hibernate.service.internal.BasicServiceRegistryImpl;
13 years, 1 month