Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 248893 Details for
Bug 121057
[jres] 'Execution Environments' preference page not updated after JRE addition
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Debug patch to support Apply in JREs Preference page
Bug 121057 - JDT Debug New.patch (text/plain), 8.35 KB, created by
Sarika Sinha
on 2014-11-25 04:06:29 EST
(
hide
)
Description:
Debug patch to support Apply in JREs Preference page
Filename:
MIME Type:
Creator:
Sarika Sinha
Created:
2014-11-25 04:06:29 EST
Size:
8.35 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.debug.ui >diff --git ui/org/eclipse/jdt/internal/debug/ui/jres/InstalledJREsBlock.java ui/org/eclipse/jdt/internal/debug/ui/jres/InstalledJREsBlock.java >index 2e5e46d..e3480f9 100644 >--- ui/org/eclipse/jdt/internal/debug/ui/jres/InstalledJREsBlock.java >+++ ui/org/eclipse/jdt/internal/debug/ui/jres/InstalledJREsBlock.java >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2013 IBM Corporation and others. >+ * Copyright (c) 2000, 2014 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -209,6 +209,8 @@ > */ > public static final String MACOSX_VM_TYPE_ID = "org.eclipse.jdt.internal.launching.macosx.MacOSXType"; //$NON-NLS-1$ > >+ private String fVMListTimeStamp; >+ > /** > * Content provider to show a list of JREs > */ >@@ -1141,6 +1143,10 @@ > setJREs(standins.toArray(new IVMInstall[standins.size()])); > } > >+ protected void initializeTimeStamp(){ >+ fVMListTimeStamp = getEncodedSettings(); >+ } >+ > /** > * Disposes the block and any listeners > * >@@ -1149,5 +1155,48 @@ > public void dispose() { > JavaRuntime.removeVMInstallChangedListener(fListener); > } >- >+ >+ >+ private StringBuffer appendVMAttributes(IVMInstall vmInstall, StringBuffer buf) { >+ if (vmInstall != null) { >+ String str = vmInstall.getName(); >+ buf.append('[').append(str.length()).append(']').append(str); >+ str = vmInstall.getVMInstallType().getName(); >+ buf.append('[').append(str.length()).append(']').append(str); >+ if (vmInstall.getVMArguments() != null) { >+ str = vmInstall.getVMArguments().toString(); >+ buf.append('[').append(str.length()).append(']').append(str); >+ } >+ str = vmInstall.getInstallLocation().getAbsolutePath(); >+ buf.append('[').append(str.length()).append(']').append(str).append(';'); >+ ; >+ } else { >+ buf.append('[').append(']').append(';'); >+ } >+ return buf; >+ } >+ >+ private String getEncodedSettings() { >+ StringBuffer buf = new StringBuffer(); >+ IVMInstall vmInstall = getCheckedJRE(); >+ buf.append('[').append("defaultVM").append(']'); //$NON-NLS-1$ >+ if (vmInstall != null) { >+ buf.append('[').append(vmInstall.getName().length()).append(']').append(vmInstall.getName()).append(';'); >+ } else { >+ buf.append('[').append(']').append(';'); >+ } >+ >+ int nElements = fVMs.size(); >+ buf.append('[').append(nElements).append(']'); >+ for (int i = 0; i < nElements; i++) { >+ IVMInstall elem = fVMs.get(i); >+ appendVMAttributes(elem, buf); >+ } >+ return buf.toString(); >+ } >+ >+ public boolean hasChangesInDialog() { >+ String currSettings = getEncodedSettings(); >+ return !currSettings.equals(fVMListTimeStamp); >+ } > } >diff --git ui/org/eclipse/jdt/internal/debug/ui/jres/JREMessages.java ui/org/eclipse/jdt/internal/debug/ui/jres/JREMessages.java >index 224f7e0..8d3071b 100644 >--- ui/org/eclipse/jdt/internal/debug/ui/jres/JREMessages.java >+++ ui/org/eclipse/jdt/internal/debug/ui/jres/JREMessages.java >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2013 IBM Corporation and others. >+ * Copyright (c) 2000, 2014 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -74,6 +74,11 @@ > public static String JREsPreferencePage_13; > > public static String JREsPreferencePage_3; >+ public static String JREsPreferencePage_4; >+ public static String JREsPreferencePage_5; >+ public static String JREsPreferencePage_6; >+ public static String JREsPreferencePage_7; >+ public static String JREsPreferencePage_8; > > public static String addVMDialog_duplicateName; > public static String addVMDialog_enterLocation; >diff --git ui/org/eclipse/jdt/internal/debug/ui/jres/JREMessages.properties ui/org/eclipse/jdt/internal/debug/ui/jres/JREMessages.properties >index dc4985f..bc61e1a 100644 >--- ui/org/eclipse/jdt/internal/debug/ui/jres/JREMessages.properties >+++ ui/org/eclipse/jdt/internal/debug/ui/jres/JREMessages.properties >@@ -1,5 +1,5 @@ > ############################################################################### >-# Copyright (c) 2000, 2013 IBM Corporation and others. >+# Copyright (c) 2000, 2014 IBM Corporation and others. > # All rights reserved. This program and the accompanying materials > # are made available under the terms of the Eclipse Public License v1.0 > # which accompanies this distribution, and is available at >@@ -69,6 +69,11 @@ > JREsPreferencePage_13=You must select a default JRE for the workspace > JREsPreferencePage_14=Conflicting compliance settings can be changed on the <a>Compiler</a> page. > JREsPreferencePage_3=You must provide at least one JRE to act as the workspace default >+JREsPreferencePage_4=Setting Installed JREs >+JREsPreferencePage_5=This page contains unsaved modifications. Do you want to save changes so that other related pages can be updated? >+JREsPreferencePage_6=Apply >+JREsPreferencePage_7=Discard >+JREsPreferencePage_8=Apply Later > > addVMDialog_duplicateName=The JRE name is already in use. > addVMDialog_enterLocation=Enter the home directory of the JRE. >diff --git ui/org/eclipse/jdt/internal/debug/ui/jres/JREsPreferencePage.java ui/org/eclipse/jdt/internal/debug/ui/jres/JREsPreferencePage.java >index 9c4f474..2494030 100644 >--- ui/org/eclipse/jdt/internal/debug/ui/jres/JREsPreferencePage.java >+++ ui/org/eclipse/jdt/internal/debug/ui/jres/JREsPreferencePage.java >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2013 IBM Corporation and others. >+ * Copyright (c) 2000, 2014 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -31,6 +31,7 @@ > import org.eclipse.jface.dialogs.ErrorDialog; > import org.eclipse.jface.dialogs.IDialogSettings; > import org.eclipse.jface.dialogs.IMessageProvider; >+import org.eclipse.jface.dialogs.MessageDialog; > import org.eclipse.jface.preference.PreferencePage; > import org.eclipse.jface.viewers.ISelectionChangedListener; > import org.eclipse.jface.viewers.SelectionChangedEvent; >@@ -104,7 +105,7 @@ > protected Control createContents(Composite ancestor) { > initializeDialogUnits(ancestor); > >- noDefaultAndApplyButton(); >+ noDefaultButton(); > > GridLayout layout= new GridLayout(); > layout.numColumns= 1; >@@ -134,6 +135,7 @@ > }); > PlatformUI.getWorkbench().getHelpSystem().setHelp(ancestor, IJavaDebugHelpContextIds.JRE_PREFERENCE_PAGE); > initDefaultVM(); >+ fJREBlock.initializeTimeStamp(); > fJREBlock.addSelectionChangedListener(new ISelectionChangedListener() { > public void selectionChanged(SelectionChangedEvent event) { > IVMInstall install = getCurrentDefaultVM(); >@@ -257,6 +259,7 @@ > // save column widths > IDialogSettings settings = JDIDebugUIPlugin.getDefault().getDialogSettings(); > fJREBlock.saveColumnSettings(settings, IJavaDebugHelpContextIds.JRE_PREFERENCE_PAGE); >+ fJREBlock.initializeTimeStamp(); > > return super.performOk(); > } >@@ -312,4 +315,30 @@ > super.dispose(); > fJREBlock.dispose(); > } >+ >+ /* >+ * @see org.eclipse.jface.preference.PreferencePage#okToLeave() >+ */ >+ @Override >+ public boolean okToLeave() { >+ if (fJREBlock != null && fJREBlock.hasChangesInDialog()) { >+ String title = JREMessages.JREsPreferencePage_4; >+ String message = JREMessages.JREsPreferencePage_5; >+ String[] buttonLabels = new String[] { JREMessages.JREsPreferencePage_6, JREMessages.JREsPreferencePage_7, >+ JREMessages.JREsPreferencePage_8 }; >+ MessageDialog dialog = new MessageDialog(getShell(), title, null, message, MessageDialog.QUESTION, buttonLabels, 0); >+ int res = dialog.open(); >+ if (res == 0) { // save >+ return performOk() && super.okToLeave(); >+ } else if (res == 1) { // discard >+ fJREBlock.fillWithWorkspaceJREs(); >+ fJREBlock.restoreColumnSettings(JDIDebugUIPlugin.getDefault().getDialogSettings(), IJavaDebugHelpContextIds.JRE_PREFERENCE_PAGE); >+ initDefaultVM(); >+ fJREBlock.initializeTimeStamp(); >+ } else { >+ // keep unsaved >+ } >+ } >+ return super.okToLeave(); >+ } > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 121057
:
248562
|
248563
|
248564
|
248892
|
248893
|
248894
|
249124
|
249125
|
249126
|
249127
|
249277
|
249279
|
249458
|
249512