JBoss Tools SVN: r36223 - in trunk/common/plugins: org.jboss.tools.common.jdt.ui/src/org/jboss/tools/common/jdt/ui/buildpath/dialog and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: fbricon
Date: 2011-11-08 13:29:20 -0500 (Tue, 08 Nov 2011)
New Revision: 36223
Modified:
trunk/common/plugins/org.jboss.tools.common.jdt.ui/src/org/jboss/tools/common/jdt/ui/buildpath/dialog/MaterializeLibraryDialog.java
trunk/common/plugins/org.jboss.tools.common.jdt.ui/src/org/jboss/tools/common/jdt/ui/buildpath/handlers/MaterializeLibraryHandler.java
trunk/common/plugins/org.jboss.tools.common.jdt/src/org/jboss/tools/common/jdt/core/buildpath/MaterializeLibraryJob.java
Log:
…
[View More]JBIDE-9879 : add an option to keep source attachments (or not)
Modified: trunk/common/plugins/org.jboss.tools.common.jdt/src/org/jboss/tools/common/jdt/core/buildpath/MaterializeLibraryJob.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.jdt/src/org/jboss/tools/common/jdt/core/buildpath/MaterializeLibraryJob.java 2011-11-08 18:27:51 UTC (rev 36222)
+++ trunk/common/plugins/org.jboss.tools.common.jdt/src/org/jboss/tools/common/jdt/core/buildpath/MaterializeLibraryJob.java 2011-11-08 18:29:20 UTC (rev 36223)
@@ -43,11 +43,13 @@
private final IJavaProject javaProject;
private final Map<IPath, String> jars;
private final IClasspathContainer containerToRemove;
+ private final boolean keepSourceAttachments;
public MaterializeLibraryJob(IJavaProject javaProject,
IClasspathContainer containerToMaterialize,
Map<IPath, String> jars,
- IFolder libFolder) {
+ IFolder libFolder,
+ boolean keepSourceAttachments) {
super(Messages.Materialize_Library);
if (javaProject == null || javaProject.getProject() == null) {
throw new IllegalArgumentException("Project must not be null");
@@ -62,6 +64,7 @@
this.libFolder = libFolder;
this.containerToRemove = containerToMaterialize;
this.jars = jars;
+ this.keepSourceAttachments = keepSourceAttachments;
}
@Override
@@ -167,8 +170,8 @@
IPath destinationFilePath) throws CoreException {
try {
return JavaCore.newLibraryEntry(destinationFilePath,
- entry.getSourceAttachmentPath(),
- entry.getSourceAttachmentRootPath(),
+ (keepSourceAttachments)?entry.getSourceAttachmentPath():null,
+ (keepSourceAttachments)?entry.getSourceAttachmentRootPath():null,
entry.getAccessRules(), entry.getExtraAttributes(),
entry.isExported());
} catch (Exception e) {
Modified: trunk/common/plugins/org.jboss.tools.common.jdt.ui/src/org/jboss/tools/common/jdt/ui/buildpath/dialog/MaterializeLibraryDialog.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.jdt.ui/src/org/jboss/tools/common/jdt/ui/buildpath/dialog/MaterializeLibraryDialog.java 2011-11-08 18:27:51 UTC (rev 36222)
+++ trunk/common/plugins/org.jboss.tools.common.jdt.ui/src/org/jboss/tools/common/jdt/ui/buildpath/dialog/MaterializeLibraryDialog.java 2011-11-08 18:29:20 UTC (rev 36223)
@@ -80,6 +80,11 @@
private CheckboxTableViewer classpathEntriesViewer;
+ private Button keepSourceBtn;
+
+ private boolean keepSources;
+
+
public MaterializeLibraryDialog(Shell shell, IProject project, IClasspathContainer containerToMaterialize, String defaultLib) {
super(shell);
setShellStyle(super.getShellStyle() | SWT.RESIZE | SWT.MODELESS);
@@ -234,10 +239,21 @@
addSelectionButton(container, "Select All", true);
addSelectionButton(container, "Deselect All", false);
+ keepSourceBtn = addCheckButton(container, "Keep source attachments", keepSources);
+ keepSourceBtn.setToolTipText("Source attachment paths may contain absolute paths");
addTableListeners();
}
+ private Button addCheckButton(Composite container, String label, boolean selected) {
+ Button checkBtn = new Button(container, SWT.CHECK);
+ checkBtn.setText(label);
+ checkBtn.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER,
+ true, false, 2, 1));
+ checkBtn.setSelection(selected);
+ return checkBtn;
+ }
+
private void addTableListeners() {
addCellEditors();
}
@@ -247,18 +263,7 @@
"EMPTY", SOURCE_PROPERTY, FILENAME_PROPERTY });
TextCellEditor ce = new TextCellEditor(classpathEntriesViewer.getTable());
-// ce.setValidator(new ICellEditorValidator() {
-// @Override
-// public String isValid(Object arg0) {
-// String name = arg0.toString();
-// return (checkValidName(name))?null:name;
-// }
-// });
-
- CellEditor[] editors = new CellEditor[] {
- null,
- new TextCellEditor(classpathEntriesViewer.getTable()),
- ce };
+ CellEditor[] editors = new CellEditor[] {null, ce, ce };
classpathEntriesViewer.setCellEditors(editors);
classpathEntriesViewer.setCellModifier(new FileNameCellModifier());
@@ -272,6 +277,10 @@
return libFolder;
}
+ public boolean isKeepSources() {
+ return keepSources;
+ }
+
private static IFolder getLibFolderFromText(String text) {
String portablePath = text.replaceAll("\\\\", "/");
IPath path = new Path(portablePath);
@@ -284,6 +293,7 @@
return;
}
libFolder = getLibFolderFromText(libfolderText.getText());
+ keepSources = keepSourceBtn.getSelection();
super.okPressed();
}
@@ -445,4 +455,5 @@
(name.endsWith(".jar") || name.endsWith(".zip"));
}
+
}
Modified: trunk/common/plugins/org.jboss.tools.common.jdt.ui/src/org/jboss/tools/common/jdt/ui/buildpath/handlers/MaterializeLibraryHandler.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.jdt.ui/src/org/jboss/tools/common/jdt/ui/buildpath/handlers/MaterializeLibraryHandler.java 2011-11-08 18:27:51 UTC (rev 36222)
+++ trunk/common/plugins/org.jboss.tools.common.jdt.ui/src/org/jboss/tools/common/jdt/ui/buildpath/handlers/MaterializeLibraryHandler.java 2011-11-08 18:29:20 UTC (rev 36223)
@@ -86,7 +86,8 @@
Job job = new MaterializeLibraryJob(javaProject,
containerToMaterialize,
jarsToMaterialize,
- libFolder);
+ libFolder,
+ dialog.isKeepSources());
job.setRule(getRule(project));
job.addJobChangeListener(new IJobChangeListener() {
[View Less]
13 years, 2 months
JBoss Tools SVN: r36222 - trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2011-11-08 13:27:51 -0500 (Tue, 08 Nov 2011)
New Revision: 36222
Modified:
trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/plugin.properties
Log:
"Project archives" View title is updated to "Project Archives" to be the same as other views
Modified: trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/plugin.properties
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/plugin.…
[View More]properties 2011-11-08 18:25:36 UTC (rev 36221)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/plugin.properties 2011-11-08 18:27:51 UTC (rev 36222)
@@ -1,6 +1,6 @@
PreferencePage_ProjectArchives=Project Archives
ProjectPropertiesPage_ProjectArchives=Project Archives
-ViewName_ProjectArchives=Project archives
+ViewName_ProjectArchives=Project Archives
ViewCategory_JBossTools=JBoss Tools
Bundle-Vendor.0 = JBoss by Red Hat
Bundle-Name.0 = JBoss Archives Tools
[View Less]
13 years, 2 months
JBoss Tools SVN: r36221 - trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2011-11-08 13:25:36 -0500 (Tue, 08 Nov 2011)
New Revision: 36221
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/Messages.properties
Log:
ReferenceWizard_rootFolder was removed to fix warning
NLS unused message: ReferenceWizard_rootFolder in: org.jboss.ide.eclipse.archives.webtools.Messages
Modified: trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/…
[View More]Messages.properties
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/Messages.properties 2011-11-08 17:50:15 UTC (rev 36220)
+++ trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/Messages.properties 2011-11-08 18:25:36 UTC (rev 36221)
@@ -54,4 +54,3 @@
# fileset references (modulecore)
ReferenceWizard_title=Add a fileset reference
ReferenceWizard_description=A fileset reference can copy resources from a folder inside the workspace. Use the include and exclude fields to specify which resources should be copied.
-ReferenceWizard_rootFolder=Root Folder
[View Less]
13 years, 2 months
JBoss Tools SVN: r36220 - trunk/freemarker/plugins/org.jboss.ide.eclipse.freemarker/META-INF.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2011-11-08 12:50:15 -0500 (Tue, 08 Nov 2011)
New Revision: 36220
Modified:
trunk/freemarker/plugins/org.jboss.ide.eclipse.freemarker/META-INF/MANIFEST.MF
Log:
https://issues.jboss.org/browse/JBIDE-9679 - CLONE - Manifest cleanup
fixed in trunk for freemarker
Modified: trunk/freemarker/plugins/org.jboss.ide.eclipse.freemarker/META-INF/MANIFEST.MF
===================================================================
--- trunk/freemarker/plugins/org.jboss.ide.eclipse.…
[View More]freemarker/META-INF/MANIFEST.MF 2011-11-08 16:52:07 UTC (rev 36219)
+++ trunk/freemarker/plugins/org.jboss.ide.eclipse.freemarker/META-INF/MANIFEST.MF 2011-11-08 17:50:15 UTC (rev 36220)
@@ -6,7 +6,7 @@
Bundle-Activator: org.jboss.ide.eclipse.freemarker.Plugin
Bundle-Localization: plugin
Require-Bundle: org.eclipse.ui,
- org.eclipse.core.runtime,
+ org.eclipse.core.runtime;bundle-version="3.7.0",
org.eclipse.jface.text,
org.eclipse.ui.editors,
org.eclipse.ui.workbench.texteditor,
[View Less]
13 years, 2 months
JBoss Tools SVN: r36219 - in trunk/ws/plugins: org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/wizards and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: bfitzpat
Date: 2011-11-08 11:52:07 -0500 (Tue, 08 Nov 2011)
New Revision: 36219
Modified:
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/utils/RestEasyLibUtils.java
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/wizards/JBossRSGenerateWizardPage.java
Log:
JBIDE-10088 - Fixes issues with the RE wizard web.xml detection and RE jar detection in AS7
Modified: trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/…
[View More]tools/ws/creation/core/utils/RestEasyLibUtils.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/utils/RestEasyLibUtils.java 2011-11-08 16:38:44 UTC (rev 36218)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/utils/RestEasyLibUtils.java 2011-11-08 16:52:07 UTC (rev 36219)
@@ -1,6 +1,6 @@
/**
* JBoss by Red Hat
- * Copyright 2010, Red Hat Middleware, LLC, and individual contributors as indicated
+ * Copyright 2011, Red Hat Middleware, LLC, and individual contributors as indicated
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
@@ -38,9 +38,10 @@
public class RestEasyLibUtils {
private static final String REST_EASY = "RestEasy"; //$NON-NLS-1$
- private static final String JAXRS_API_PREFIX = "jaxrs-api"; //$NON-NLS-1$
private static final String JAXRS_API_POSTFIX = ".jar"; //$NON-NLS-1$
private static final String LIB = "lib"; //$NON-NLS-1$
+ private static final String MODULES = "modules"; //$NON-NLS-1$
+
/**
* Simple check to see if the JBoss WS runtime associated with a project
@@ -96,6 +97,9 @@
if (dir.isDirectory() && name.equals(LIB)) {
return true;
}
+ else if (dir.isDirectory() && name.equals(MODULES)) {
+ return true;
+ }
return false;
}
});
@@ -103,21 +107,42 @@
for (int i = 0; i < children.length; i++) {
File libDir = (File) children[i];
if (libDir.exists() && libDir.isDirectory()) {
- File[] jars = libDir.listFiles(new FilenameFilter() {
- public boolean accept(File dir, String name) {
- if (name.startsWith(JAXRS_API_PREFIX) && name.endsWith(JAXRS_API_POSTFIX)) {
- return true;
- }
- return false;
- }
- });
- if (jars != null && jars.length > 0) {
+ File temp = recursiveRESearch(libDir);
+ if (temp != null)
return libDir;
- }
}
}
}
return null;
}
+
+ /*
+ * Recursive file search
+ * @param input (file)
+ * @return RestEasy jar indicating RE is installed
+ */
+ private static File recursiveRESearch(File input) {
+ if( input.isDirectory() == true ){
+ for(int i=0; i<input.list().length; i++){
+ File temp = new File( input + "\\" + input.list()[i]); //$NON-NLS-1$
+ File temp2 = recursiveRESearch(temp);
+ if (temp2 != null)
+ return temp2;
+ }
+ }
+ else{
+ if (input.getName().length() > 0) {
+ String name = input.getName().toUpperCase();
+ boolean starts = name.startsWith(REST_EASY.toUpperCase());
+ boolean ends = name.endsWith(JAXRS_API_POSTFIX.toUpperCase());
+ if (starts && ends) {
+ return input;
+ }
+ }
+ }
+
+ return null;
+ }
+
}
Modified: trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/wizards/JBossRSGenerateWizardPage.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/wizards/JBossRSGenerateWizardPage.java 2011-11-08 16:38:44 UTC (rev 36218)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/wizards/JBossRSGenerateWizardPage.java 2011-11-08 16:52:07 UTC (rev 36219)
@@ -342,8 +342,10 @@
// project not a dynamic web project
IFile web = ((JBossRSGenerateWizard) this.getWizard()).getWebFile();
if (web == null || !web.exists()) {
- setErrorMessage(JBossWSUIMessages.Error_JBossWS_GenerateWizard_NotDynamicWebProject);
- return false;
+ if (updateWebXML.getSelection()) {
+ setErrorMessage(JBossWSUIMessages.Error_JBossWS_GenerateWizard_NotDynamicWebProject);
+ return false;
+ }
}
IStatus reInstalledStatus =
[View Less]
13 years, 2 months
JBoss Tools SVN: r36218 - in trunk/maven/plugins: org.jboss.tools.maven.project.examples/src/org/jboss/tools/maven/project/examples/wizard and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: xcoulon
Date: 2011-11-08 11:38:44 -0500 (Tue, 08 Nov 2011)
New Revision: 36218
Modified:
trunk/maven/plugins/org.jboss.tools.maven.jaxrs/src/org/jboss/tools/maven/jaxrs/configurators/JaxrsProjectConfigurator.java
trunk/maven/plugins/org.jboss.tools.maven.project.examples/src/org/jboss/tools/maven/project/examples/wizard/ArchetypeExamplesWizard.java
Log:
FIXED - issue JBIDE-10037: EE6 EAR Archetype fails to close after completion
https://issues.jboss.org/browse/JBIDE-10037
…
[View More]Modified: trunk/maven/plugins/org.jboss.tools.maven.jaxrs/src/org/jboss/tools/maven/jaxrs/configurators/JaxrsProjectConfigurator.java
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.jaxrs/src/org/jboss/tools/maven/jaxrs/configurators/JaxrsProjectConfigurator.java 2011-11-08 14:10:32 UTC (rev 36217)
+++ trunk/maven/plugins/org.jboss.tools.maven.jaxrs/src/org/jboss/tools/maven/jaxrs/configurators/JaxrsProjectConfigurator.java 2011-11-08 16:38:44 UTC (rev 36218)
@@ -10,12 +10,17 @@
************************************************************************************/
package org.jboss.tools.maven.jaxrs.configurators;
+import java.io.File;
+
import org.apache.maven.project.MavenProject;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaCore;
@@ -71,13 +76,53 @@
}
@Override
- public void configure(ProjectConfigurationRequest request,
- IProgressMonitor monitor) throws CoreException {
+ public void configure(ProjectConfigurationRequest request, IProgressMonitor monitor) throws CoreException {
MavenProject mavenProject = request.getMavenProject();
+ refreshHierarchy(mavenProject, new SubProgressMonitor(monitor, 1));
IProject project = request.getProject();
- configureInternal(mavenProject,project, monitor);
+ configureInternal(mavenProject, project, monitor);
}
+
+ /**
+ * Refreshes the Maven projects hierarchy. For example, if the project on
+ * which the JAX-RS facet should be installed is 'Parent1/Parent2/Child',
+ * then both Parent1, Parent2 and Child are refreshed.
+ *
+ * @param mavenProject
+ * @throws CoreException
+ * in case of problem during refresh
+ */
+ private void refreshHierarchy(MavenProject mavenProject, IProgressMonitor monitor) throws CoreException {
+ try {
+ File basedir = mavenProject.getBasedir();
+ IProject project = getProjectAt(basedir);
+ while (project != null) {
+ project.refreshLocal(IResource.DEPTH_INFINITE, monitor);
+ basedir = basedir.getParentFile();
+ project = getProjectAt(basedir);
+ }
+ } finally {
+ monitor.done();
+ }
+ }
+ /**
+ * Returns the project given its absolute location on the filesystem
+ * @param basedir
+ * @return the project or null if no project exists at the given location
+ */
+ private IProject getProjectAt(File basedir) {
+ IProject[] projects = ResourcesPlugin.getWorkspace().getRoot()
+ .getProjects();
+ for (IProject project : projects) {
+ if (project.getLocation().toFile().equals(basedir)) {
+ return project;
+ }
+ }
+ return null;
+ }
+
+
private void configureInternal(MavenProject mavenProject,IProject project,
IProgressMonitor monitor) throws CoreException {
Modified: trunk/maven/plugins/org.jboss.tools.maven.project.examples/src/org/jboss/tools/maven/project/examples/wizard/ArchetypeExamplesWizard.java
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.project.examples/src/org/jboss/tools/maven/project/examples/wizard/ArchetypeExamplesWizard.java 2011-11-08 14:10:32 UTC (rev 36217)
+++ trunk/maven/plugins/org.jboss.tools.maven.project.examples/src/org/jboss/tools/maven/project/examples/wizard/ArchetypeExamplesWizard.java 2011-11-08 16:38:44 UTC (rev 36218)
@@ -31,6 +31,7 @@
import org.eclipse.m2e.core.ui.internal.MavenImages;
import org.eclipse.ui.INewWizard;
import org.eclipse.ui.IWorkbench;
+import org.jboss.tools.maven.project.examples.MavenProjectExamplesActivator;
import org.jboss.tools.project.examples.model.Project;
/**
@@ -87,6 +88,7 @@
final IWorkspace ws = ResourcesPlugin.getWorkspace();
ws.run(wr, ws.getRoot(), IWorkspace.AVOID_UPDATE, monitor);
} catch (CoreException e) {
+ MavenProjectExamplesActivator.log(e);
throw new InvocationTargetException(e);
}
}
[View Less]
13 years, 2 months
JBoss Tools SVN: r36217 - 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-08 09:10:32 -0500 (Tue, 08 Nov 2011)
New Revision: 36217
Added:
workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim/src/org/jboss/tools/browsersim/EditDeviceDialog.java
Removed:
workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim/src/org/jboss/tools/browsersim/EditDevicesDialog.java
Modified:
workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim/src/org/jboss/tools/…
[View More]browsersim/BrowserSim.java
workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim/src/org/jboss/tools/browsersim/DevicesList.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/ManageDevicesDialog.java
Log:
https://issues.jboss.org/browse/JBIDE-9539 : Browsersim app for testing mobile/desktop web apps
- wired model and dialogs
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-08 10:11:07 UTC (rev 36216)
+++ workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim/src/org/jboss/tools/browsersim/BrowserSim.java 2011-11-08 14:10:32 UTC (rev 36217)
@@ -15,6 +15,8 @@
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.List;
+import java.util.Observable;
+import java.util.Observer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.SWTError;
@@ -58,8 +60,9 @@
private Text locationText;
private Label statusLabel;
private ProgressBar progressBar;
- private List<MenuItem> deviceMenuItems = new ArrayList<MenuItem>();
private String initialUrl;
+ private Menu devicesMenu;
+ private DevicesManager devicesManager;
public static void main(String[] args) {
String initialUrl;
@@ -266,36 +269,68 @@
};
});
- Menu devicesMenu = createDropDownMenu(appMenuBar, "Devices");
- for (Device device : DevicesManager.getInstance().getDevicesList().getDevices()) {
- MenuItem deviceMenuItem = new MenuItem(devicesMenu, SWT.RADIO);
+ devicesMenu = createDropDownMenu(appMenuBar, "Devices");
+ devicesManager = DevicesManager.getInstance();
+ devicesManager.addObserver(new Observer() {
+ public void update(Observable o, Object arg) {
+ DevicesManager devicesManager = (DevicesManager) o;
+ DevicesList devicesList = devicesManager.getDevicesList();
+ setDevicesListForMenu(devicesList);
+ setDevice(devicesList.getDevices().get(devicesList.getSelectedDeviceIndex()));
+ devicesList.addObserver(new Observer() {
+ public void update(Observable o, Object arg) {
+ setDevice(((DevicesList)o).getDevices().get(((DevicesList)o).getSelectedDeviceIndex()));
+ }
+ });
+ }
+ });
+ devicesManager.setDevicesList(DevicesManager.getDefaultDevicesList());
+ devicesManager.notifyObservers();
+
+ new MenuItem(devicesMenu, SWT.BAR);
+ MenuItem manageDevicesMenuItem = new MenuItem(devicesMenu, SWT.PUSH);
+ manageDevicesMenuItem.setText("Manage Devices...");
+ manageDevicesMenuItem.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ DevicesList newDevicesList = new ManageDevicesDialog(shell, SWT.APPLICATION_MODAL | SWT.SHELL_TRIM,
+ devicesManager.getDevicesList()).open();
+ if (newDevicesList != null) {
+ devicesManager.setDevicesList(newDevicesList);
+ devicesManager.notifyObservers();
+ }
+ }
+ });
+ }
+
+ private void setDevicesListForMenu(DevicesList devicesList) {
+ for (MenuItem item : devicesMenu.getItems()) {
+ if (item.getData() instanceof Device) {
+ item.dispose();
+ }
+ }
+
+ int currentIndex = 0;
+ for (Device device : devicesList.getDevices()) {
+ MenuItem deviceMenuItem = new MenuItem(devicesMenu, SWT.RADIO, currentIndex);
deviceMenuItem.setText(device.getName());
deviceMenuItem.setData(device);
deviceMenuItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
MenuItem menuItem = (MenuItem)e.widget;
if (menuItem.getSelection()) {
- setDevice((Device) menuItem.getData());
+ DevicesList devicesList = devicesManager.getDevicesList();
+ int selectedDeviceIndex = devicesList.getDevices().indexOf(menuItem.getData());
+ if (selectedDeviceIndex < 0) {
+ selectedDeviceIndex = 0;
+ }
+ devicesList.setCurrentDeviceIndex(selectedDeviceIndex);
+ devicesList.notifyObservers();
}
};
});
- deviceMenuItems.add(deviceMenuItem);
- deviceMenuItem.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- deviceMenuItems.remove(e.widget);
- }
- });
+ currentIndex++;
}
-
- new MenuItem(devicesMenu, SWT.BAR);
- MenuItem manageDevicesMenuItem = new MenuItem(devicesMenu, SWT.PUSH);
- manageDevicesMenuItem.setText("Manage Devices...");
- manageDevicesMenuItem.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- new ManageDevicesDialog(shell, SWT.APPLICATION_MODAL | SWT.SHELL_TRIM).open();
- }
- });
}
private Menu createDropDownMenu(Menu menuBar, String name) {
@@ -307,10 +342,12 @@
}
public void setDevice(final Device device) {
- for (MenuItem deviceMenuItem : deviceMenuItems) {
- deviceMenuItem.setSelection(deviceMenuItem.getData() == device);
+ for (MenuItem menuItem : devicesMenu.getItems()) {
+ if (menuItem.getData() instanceof Device) {
+ menuItem.setSelection(menuItem.getData() == device);
+ }
}
-
+
browser.setDefaultUserAgent(device.getUserAgent());
GridData data = (GridData) browser.getLayoutData();
data.widthHint = device.getWidth();
Modified: workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim/src/org/jboss/tools/browsersim/DevicesList.java
===================================================================
--- workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim/src/org/jboss/tools/browsersim/DevicesList.java 2011-11-08 10:11:07 UTC (rev 36216)
+++ workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim/src/org/jboss/tools/browsersim/DevicesList.java 2011-11-08 14:10:32 UTC (rev 36217)
@@ -31,7 +31,7 @@
return devices;
}
- public int getCurrentDeviceIndex() {
+ public int getSelectedDeviceIndex() {
return currentDeviceIndex;
}
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-08 10:11:07 UTC (rev 36216)
+++ workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim/src/org/jboss/tools/browsersim/DevicesManager.java 2011-11-08 14:10:32 UTC (rev 36217)
@@ -34,16 +34,6 @@
}
public DevicesList getDevicesList() {
- if (devicesList == null) {
- 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"));
-
- devicesList = new DevicesList(devices, 0);
- }
-
return devicesList;
}
@@ -53,4 +43,14 @@
setChanged();
}
}
+
+ 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);
+ }
}
Copied: workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim/src/org/jboss/tools/browsersim/EditDeviceDialog.java (from rev 36170, workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim/src/org/jboss/tools/browsersim/EditDevicesDialog.java)
===================================================================
--- workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim/src/org/jboss/tools/browsersim/EditDeviceDialog.java (rev 0)
+++ workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim/src/org/jboss/tools/browsersim/EditDeviceDialog.java 2011-11-08 14:10:32 UTC (rev 36217)
@@ -0,0 +1,162 @@
+package org.jboss.tools.browsersim;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.FocusAdapter;
+import org.eclipse.swt.events.FocusEvent;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.VerifyEvent;
+import org.eclipse.swt.events.VerifyListener;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Dialog;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+
+public class EditDeviceDialog extends Dialog {
+ protected Device resultDevice;
+ protected Device initialDevice;
+ protected Shell shell;
+ private Text textName;
+ private Text textWidth;
+ private Text textHeight;
+ private Text textUserAgent;
+
+ /**
+ * Create the dialog.
+ * @param parent
+ * @param style
+ */
+ public EditDeviceDialog(Shell parent, int style, Device initialDevice) {
+ super(parent, style);
+ setText("SWT Dialog");
+ this.initialDevice = initialDevice;
+ }
+
+ /**
+ * Open the dialog.
+ * @return the newDevicesList
+ */
+ public Device open() {
+ createContents();
+ shell.open();
+ shell.layout();
+ shell.setSize(shell.computeSize(300, SWT.DEFAULT));
+ Display display = getParent().getDisplay();
+ while (!shell.isDisposed()) {
+ if (!display.readAndDispatch()) {
+ display.sleep();
+ }
+ }
+
+ return resultDevice;
+ }
+
+ /**
+ * Create contents of the dialog.
+ */
+ private void createContents() {
+ shell = new Shell(getParent(), SWT.DIALOG_TRIM | SWT.MIN | SWT.MAX);
+ shell.setSize(450, 300);
+ shell.setText("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:");
+
+ textName = new Text(shell, SWT.BORDER);
+ textName.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
+ textName.addFocusListener(new FocusGainedTextListener());
+ textName.setText(initialDevice.getName());
+
+ Label labelWidth = new Label(shell, SWT.NONE);
+ labelWidth.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
+ labelWidth.setText("Width:");
+
+ textWidth = new Text(shell, SWT.BORDER);
+ textWidth.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
+ textWidth.setTextLimit(4);
+ textWidth.addVerifyListener(new VerifyDigitsListener());
+ textWidth.addFocusListener(new FocusLostDigitsListener());
+ textWidth.addFocusListener(new FocusGainedTextListener());
+ textWidth.setText(String.valueOf(initialDevice.getWidth()));
+
+ Label labelHeight = new Label(shell, SWT.NONE);
+ labelHeight.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
+ labelHeight.setText("Height:");
+
+ textHeight = new Text(shell, SWT.BORDER);
+ textHeight.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
+ textHeight.setTextLimit(4);
+ textHeight.addVerifyListener(new VerifyDigitsListener());
+ textHeight.addFocusListener(new FocusLostDigitsListener());
+ textHeight.addFocusListener(new FocusGainedTextListener());
+ textHeight.setText(String.valueOf(initialDevice.getHeight()));
+
+ Label labelUseragent = new Label(shell, SWT.NONE);
+ labelUseragent.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
+ labelUseragent.setText("User-Agent:");
+
+ textUserAgent = new Text(shell, SWT.BORDER);
+ textUserAgent.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
+ textUserAgent.addFocusListener(new FocusGainedTextListener());
+ textUserAgent.setText(initialDevice.getUserAgent());
+
+ Composite composite = new Composite(shell, SWT.NONE);
+ composite.setLayout(new FillLayout(SWT.HORIZONTAL));
+ composite.setLayoutData(new GridData(SWT.RIGHT, SWT.BOTTOM, true, true, 2, 1));
+
+ Button buttonOk = new Button(composite, SWT.NONE);
+ buttonOk.setText("OK");
+ buttonOk.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ resultDevice = new Device(textName.getText(), Integer.valueOf(textWidth.getText()),
+ Integer.valueOf(textHeight.getText()), textUserAgent.getText());
+ shell.close();
+ }
+ });
+ shell.setDefaultButton(buttonOk);
+
+ Button buttonCancel = new Button(composite, SWT.NONE);
+ buttonCancel.setText("Cancel");
+ buttonCancel.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ resultDevice = null;
+ shell.close();
+ }
+ });
+ }
+}
+
+final class VerifyDigitsListener implements VerifyListener {
+ public void verifyText(VerifyEvent e) {
+ for (char c : e.text.toCharArray()) {
+ if (!('0' <= c && c <= '9')) {
+ e.doit = false;
+ return;
+ }
+ }
+ }
+}
+
+final class FocusLostDigitsListener extends FocusAdapter {
+ public void focusLost(FocusEvent e) {
+ Text text = ((Text) e.widget);
+ if (text.getText().trim().isEmpty()) {
+ text.setText("0");
+ }
+ }
+}
+
+final class FocusGainedTextListener extends FocusAdapter {
+ public void focusGained(FocusEvent e) {
+ Text text = ((Text) e.widget);
+ text.setSelection(0, text.getText().length());
+ }
+}
Deleted: workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim/src/org/jboss/tools/browsersim/EditDevicesDialog.java
===================================================================
--- workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim/src/org/jboss/tools/browsersim/EditDevicesDialog.java 2011-11-08 10:11:07 UTC (rev 36216)
+++ workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim/src/org/jboss/tools/browsersim/EditDevicesDialog.java 2011-11-08 14:10:32 UTC (rev 36217)
@@ -1,156 +0,0 @@
-package org.jboss.tools.browsersim;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.FocusAdapter;
-import org.eclipse.swt.events.FocusEvent;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.VerifyEvent;
-import org.eclipse.swt.events.VerifyListener;
-import org.eclipse.swt.layout.FillLayout;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Dialog;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
-
-public class EditDevicesDialog extends Dialog {
- protected Object result;
- protected Shell shell;
- private Text textName;
- private Text textWidth;
- private Text textHeight;
- private Text textUserAgent;
-
- /**
- * Create the dialog.
- * @param parent
- * @param style
- */
- public EditDevicesDialog(Shell parent, int style) {
- super(parent, style);
- setText("SWT Dialog");
- }
-
- /**
- * Open the dialog.
- * @return the result
- */
- public Object open() {
- createContents();
- shell.open();
- shell.layout();
- shell.setSize(shell.computeSize(300, SWT.DEFAULT));
- Display display = getParent().getDisplay();
- while (!shell.isDisposed()) {
- if (!display.readAndDispatch()) {
- display.sleep();
- }
- }
-
- return result;
- }
-
- /**
- * Create contents of the dialog.
- */
- private void createContents() {
- shell = new Shell(getParent(), SWT.DIALOG_TRIM | SWT.MIN | SWT.MAX);
- shell.setSize(450, 300);
- shell.setText("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:");
-
- textName = new Text(shell, SWT.BORDER);
- textName.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
- textName.addFocusListener(new FocusGainedTextListener());
-
- Label labelWidth = new Label(shell, SWT.NONE);
- labelWidth.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
- labelWidth.setText("Width:");
-
- textWidth = new Text(shell, SWT.BORDER);
- textWidth.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
- textWidth.setTextLimit(4);
- textWidth.addVerifyListener(new VerifyDigitsListener());
- textWidth.addFocusListener(new FocusLostDigitsListener());
- textWidth.addFocusListener(new FocusGainedTextListener());
-
- Label labelHeight = new Label(shell, SWT.NONE);
- labelHeight.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
- labelHeight.setText("Height:");
-
- textHeight = new Text(shell, SWT.BORDER);
- textHeight.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
- textHeight.setTextLimit(4);
- textHeight.addVerifyListener(new VerifyDigitsListener());
- textHeight.addFocusListener(new FocusLostDigitsListener());
- textHeight.addFocusListener(new FocusGainedTextListener());
-
- Label labelUseragent = new Label(shell, SWT.NONE);
- labelUseragent.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
- labelUseragent.setText("User-Agent:");
-
- textUserAgent = new Text(shell, SWT.BORDER);
- textUserAgent.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
- textUserAgent.addFocusListener(new FocusGainedTextListener());
-
- Composite composite = new Composite(shell, SWT.NONE);
- composite.setLayout(new FillLayout(SWT.HORIZONTAL));
- composite.setLayoutData(new GridData(SWT.RIGHT, SWT.BOTTOM, true, true, 2, 1));
-
- Button buttonOk = new Button(composite, SWT.NONE);
- buttonOk.setText("OK");
- buttonOk.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- result = new Device(textName.getText(), Integer.valueOf(textWidth.getText()),
- Integer.valueOf(textHeight.getText()), textUserAgent.getText());
- shell.close();
- }
- });
- shell.setDefaultButton(buttonOk);
-
- Button buttonCancel = new Button(composite, SWT.NONE);
- buttonCancel.setText("Cancel");
- buttonCancel.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- result = null;
- shell.close();
- }
- });
- }
-}
-
-final class VerifyDigitsListener implements VerifyListener {
- public void verifyText(VerifyEvent e) {
- for (char c : e.text.toCharArray()) {
- if (!('0' <= c && c <= '9')) {
- e.doit = false;
- return;
- }
- }
- }
-}
-
-final class FocusLostDigitsListener extends FocusAdapter {
- public void focusLost(FocusEvent e) {
- Text text = ((Text) e.widget);
- if (text.getText().trim().isEmpty()) {
- text.setText("0");
- }
- }
-}
-
-final class FocusGainedTextListener extends FocusAdapter {
- public void focusGained(FocusEvent e) {
- Text text = ((Text) e.widget);
- text.setSelection(0, text.getText().length());
- }
-}
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-08 10:11:07 UTC (rev 36216)
+++ workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim/src/org/jboss/tools/browsersim/ManageDevicesDialog.java 2011-11-08 14:10:32 UTC (rev 36217)
@@ -9,10 +9,12 @@
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
package org.jboss.tools.browsersim;
+import java.util.ArrayList;
+import java.util.List;
+
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
@@ -30,25 +32,32 @@
*/
public class ManageDevicesDialog extends Dialog {
- protected Object result;
+ protected DevicesList oldDevicesList;
+ protected List<Device> devices;
+ protected int selectedDeviceIndex;
protected Shell shell;
private Table table;
+ private DevicesList resultDevicesList;
/**
* Create the dialog.
* @param parent
* @param style
+ * @param oldDevicesList
*/
- public ManageDevicesDialog(Shell parent, int style) {
+ public ManageDevicesDialog(Shell parent, int style, DevicesList oldDevicesList) {
super(parent, style);
setText("Devices");
- }
+ this.oldDevicesList = oldDevicesList;
+ this.devices = new ArrayList<Device>(oldDevicesList.getDevices());
+ this.selectedDeviceIndex = oldDevicesList.getSelectedDeviceIndex();
+ }
/**
* Open the dialog.
- * @return the result
+ * @return the newDevicesList
*/
- public Object open() {
+ public DevicesList open() {
createContents();
shell.open();
shell.layout();
@@ -58,7 +67,7 @@
display.sleep();
}
}
- return result;
+ return resultDevicesList;
}
/**
@@ -74,6 +83,11 @@
table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
table.setHeaderVisible(true);
table.setLinesVisible(true);
+ table.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ selectedDeviceIndex = ((Table)e.widget).getSelectionIndex();
+ }
+ });
TableColumn tableColumnName = new TableColumn(table, SWT.NONE);
tableColumnName.setWidth(100);
@@ -98,11 +112,12 @@
Button buttonAdd = new Button(compositeControls, SWT.NONE);
buttonAdd.setText("Add");
buttonAdd.addSelectionListener(new SelectionAdapter() {
- @Override
public void widgetSelected(SelectionEvent e) {
- Device newDevice = (Device) new EditDevicesDialog(shell, SWT.APPLICATION_MODAL | SWT.SHELL_TRIM).open();
+ Device newDevice = new EditDeviceDialog(shell, SWT.APPLICATION_MODAL | SWT.SHELL_TRIM,
+ new Device("Some Device", 480, 800, "Some User Agent")).open();
if (newDevice != null) {
- DevicesManager.getInstance().getDevicesList().getDevices().add(newDevice);
+ devices.add(newDevice);
+ selectedDeviceIndex = devices.size() - 1;
updateDevices();
}
}
@@ -110,12 +125,42 @@
Button buttonEdit = new Button(compositeControls, SWT.NONE);
buttonEdit.setText("Edit");
+ buttonEdit.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ Device newDevice = new EditDeviceDialog(shell, SWT.APPLICATION_MODAL | SWT.SHELL_TRIM,
+ devices.get(selectedDeviceIndex)).open();
+ if (newDevice != null) {
+ devices.remove(selectedDeviceIndex);
+ devices.add(selectedDeviceIndex, newDevice);
+ updateDevices();
+ }
+ }
+ });
Button buttonRemove = new Button(compositeControls, SWT.NONE);
buttonRemove.setText("Remove");
+ buttonRemove.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ System.out.println(devices.size());
+ if (devices.size() > 1) {
+ devices.remove(selectedDeviceIndex);
+ if (selectedDeviceIndex >= devices.size()) {
+ selectedDeviceIndex = devices.size() - 1;
+ }
+ updateDevices();
+ }
+ }
+ });
Button buttonReset = new Button(compositeControls, SWT.NONE);
buttonReset.setText("Reset");
+ buttonReset.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ devices = new ArrayList<Device>(oldDevicesList.getDevices());
+ selectedDeviceIndex = oldDevicesList.getSelectedDeviceIndex();
+ updateDevices();
+ }
+ });
Composite compositeOkCancel = new Composite(shell, SWT.NONE);
compositeOkCancel.setLayout(new FillLayout(SWT.HORIZONTAL));
@@ -124,24 +169,32 @@
Button buttonOk = new Button(compositeOkCancel, SWT.NONE);
buttonOk.setText("OK");
shell.setDefaultButton(buttonOk);
+ buttonOk.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ resultDevicesList = new DevicesList(devices, selectedDeviceIndex);
+ shell.close();
+ }
+ });
Button buttonCancel = new Button(compositeOkCancel, SWT.NONE);
buttonCancel.setText("Cancel");
buttonCancel.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
+ resultDevicesList = null;
shell.close();
}
});
+
updateDevices();
- updateDevices();
}
public void updateDevices() {
table.removeAll();
- for (Device device : DevicesManager.getInstance().getDevicesList().getDevices()) {
+ for (Device device : devices) {
TableItem tableItem = new TableItem(table, SWT.NONE);
tableItem.setText(new String[] {device.getName(), String.valueOf(device.getWidth()), String.valueOf(device.getHeight()), device.getUserAgent()});
}
+ table.setSelection(selectedDeviceIndex);
}
}
[View Less]
13 years, 2 months
JBoss Tools SVN: r36216 - trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/actions.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2011-11-08 05:11:07 -0500 (Tue, 08 Nov 2011)
New Revision: 36216
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/actions/messages.properties
Log:
JBIDE-9995 - text correction
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/actions/messages.properties
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/…
[View More]jbossui/org/jboss/ide/eclipse/as/ui/actions/messages.properties 2011-11-08 09:41:51 UTC (rev 36215)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/actions/messages.properties 2011-11-08 10:11:07 UTC (rev 36216)
@@ -10,4 +10,4 @@
ChangeTimeStampActionDelegate_cannot_unregister=Cannot unregister project {0} from server {1}
ChangeTimeStampActionDelegate_could_not_register_project=Could not register project {0}
DeployActionMessageBoxTitle=Really mark these resources as deployable?
-DeployActionMessageBoxMsg=The selection's enclosing projects are already able to be deployed to servers. Marking the selected resources as deployable may be neither necessary nor desired. \n\nYou may prefer to right-click the project and select \n "run as -> run on server"
+DeployActionMessageBoxMsg=The selection's enclosing projects are already able to be deployed to servers. Marking the selected resources as deployable may be neither necessary nor desired.\n\nYou may prefer to use "Run As -> Run on server" instead.\n\nContinue marking these resources deployable?
\ No newline at end of file
[View Less]
13 years, 2 months
JBoss Tools SVN: r36215 - trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/META-INF.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-11-08 04:41:51 -0500 (Tue, 08 Nov 2011)
New Revision: 36215
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/META-INF/MANIFEST.MF
Log:
[JBIDE-10035] set bundle provider name
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/META-INF/MANIFEST.MF 2011-11-08 09:39:39 UTC (…
[View More]rev 36214)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/META-INF/MANIFEST.MF 2011-11-08 09:41:51 UTC (rev 36215)
@@ -35,4 +35,5 @@
org.jboss.tools.common.ui.databinding,
org.jboss.tools.common.ui.preferencevalue,
org.jboss.tools.common.ui.ssh
+Bundle-Vendor: JBoss by Red Hat
[View Less]
13 years, 2 months
JBoss Tools SVN: r36214 - trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-11-08 04:39:39 -0500 (Tue, 08 Nov 2011)
New Revision: 36214
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationWizardPage.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CredentialsWizardPage.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/…
[View More]internal/ui/wizard/NewApplicationWizardPage.java
Log:
[JBIDE-10043] corrected wording
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationWizardPage.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationWizardPage.java 2011-11-08 01:32:34 UTC (rev 36213)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationWizardPage.java 2011-11-08 09:39:39 UTC (rev 36214)
@@ -71,7 +71,7 @@
private ImportProjectWizardModel wizardModel;
protected ApplicationWizardPage(IWizard wizard, ImportProjectWizardModel wizardModel) {
- super("Application selection", "Please select an OpenShift Express application",
+ super("Application selection", "Please select an application to start with, or create a new one.",
"Application selection", wizard);
this.wizardModel = wizardModel;
this.model = new ApplicationWizardPageModel(wizardModel);
@@ -140,7 +140,7 @@
return ValidationStatus.ok();
}
else {
- return ValidationStatus.info("You have to select an application...");
+ return ValidationStatus.info("Please select an application to start with, or create a new one");
}
}
}),
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CredentialsWizardPage.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CredentialsWizardPage.java 2011-11-08 01:32:34 UTC (rev 36213)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CredentialsWizardPage.java 2011-11-08 09:39:39 UTC (rev 36214)
@@ -62,7 +62,7 @@
GridLayoutFactory.fillDefaults().numColumns(3).margins(10, 10).applyTo(container);
Link signupLink = new Link(container, SWT.WRAP);
- signupLink.setText("If you have no user account on OpenShift Express yet, please sign up <a>here</a>.");
+ signupLink.setText("If you dont have an account on OpenShift, please sign up <a>here</a>.");
GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).span(3, 1).hint(SWT.DEFAULT, 30).applyTo(signupLink);
signupLink.addSelectionListener(onSignupLinkClicked());
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewApplicationWizardPage.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewApplicationWizardPage.java 2011-11-08 01:32:34 UTC (rev 36213)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewApplicationWizardPage.java 2011-11-08 09:39:39 UTC (rev 36214)
@@ -70,7 +70,7 @@
ControlDecorationSupport.create(nameBinding, SWT.LEFT | SWT.TOP);
Label cartridgeLabel = new Label(parent, SWT.WRAP);
- cartridgeLabel.setText("&Cartridge");
+ cartridgeLabel.setText("&Application Type");
GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).applyTo(cartridgeLabel);
Combo cartridgesCombo = new Combo(parent, SWT.BORDER |
SWT.READ_ONLY);
[View Less]
13 years, 2 months