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 24824 Details for
Bug 79567
Provide ability to edit host names in "Add log file" dialog
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]
trace.ui patch
traceui_79567.txt (text/plain), 41.06 KB, created by
Valentina Popescu
on 2005-07-14 22:03:41 EDT
(
hide
)
Description:
trace.ui patch
Filename:
MIME Type:
Creator:
Valentina Popescu
Created:
2005-07-14 22:03:41 EDT
Size:
41.06 KB
patch
obsolete
>Index: plugin.properties >=================================================================== >RCS file: /home/tptp/platform/org.eclipse.hyades.trace.ui/plugin.properties,v >retrieving revision 1.36 >diff -u -r1.36 plugin.properties >--- plugin.properties 14 Jun 2005 16:20:25 -0000 1.36 >+++ plugin.properties 15 Jul 2005 02:02:50 -0000 >@@ -71,18 +71,18 @@ > #OpenWizardAction > > #RefreshFromLocalAction >-UNLOAD_MEMORY = Free up memory... >-RELOAD_LOCAL_FILE = Reload the project from local files >-RELOAD_LOCAL_FILE_TOOLTIP = Reload the project from local files >-RELOAD_QUESTION = You have chosen not to save modified files. This action will remove any unsaved resources from the view. Are you sure you want to do this? >-FREE_MEMORY_QUESTION = This action will remove any unsaved resources.\nPlease select the resources to save: >-RELOAD_INFORMATION_TITLE = Confirm 'Free up memory...' selection >-RELOAD_INFORMATION = Selecting 'Free up memory...' will remove all the resources from memory, and from the views. >+UNLOAD_MEMORY = Unload profiling data... >+RELOAD_INFORMATION = You chose to unload from memory the profiling data.Any view displaying this data will also be reset.\nDo you want to continue? >+FREE_MEMORY_QUESTION = The following data is not yet saved to the file system.\nPlease select the profiling data you want to save. >+FREE_MEMORY_QUESTION1 = You chose to save only some of the modified profiling data.Unsaved data will be discarded after being unload from memory.\nDo you want to continue? > > #RefreshTreeACtion > REFRESH = &Refresh > REFRESH_THE_TREE = Refresh the tree > REFRESH_TREE_TOOLTIP = Refresh tree >+CONFIRM_REFRESH_MSG = Refresh selected resource? >+STR_REFRESH_RES_SYS = &Refresh contents from the file system >+STR_NOT_REFRESH_RES = &Do not refresh from the file system > > #SaveTOLocalAction > SAVE = Save >@@ -152,11 +152,8 @@ > > #LogProcessWizardPage > ENABLE_LOGGING = Ena&ble logging >-ADD_AGENT = &New agent: >-ADD_AGENT_BUTTON = Add A&gent >-REMOVE_AGENT = &Remove Agent >-#DEFAULT_AGENT = Default Logging Agent >-#LOGGING_AGENT = Logging Agents: >+ADD_LOG_AGENT = Add Agent >+LOG_AGENT_LABEL = Agent name: > > #NewFolderWizard > #CONTAINER = Folder >@@ -236,7 +233,7 @@ > #preferences > STR_PREF_HOST_NODE = Defa&ult Hosts: > STR_PREF_HOST_IP = &Host name or IP address: >-STR_PREF_ADD = &Add >+STR_PREF_ADD = &Add... > STR_PREF_NODE_PAGE = Hosts > STR_PREF_TRACE = Profiling and Logging > STR_PREF_TRACE_VIEW = Appearance >@@ -374,7 +371,7 @@ > ATTACH_INFO_MESSAGE = IWAT0021I To collect data, the agent must be monitoring the application. \nFrom the pop-up menu of the agent in the Profiling Monitor view, select 'Start Monitoring'. > ATTACH_MESSAGE_CHECKBOX_MSG = Do not show this message again. > SHOW_PROFILE_TIPS = &Show profiling tips >-SHOW_RELOAD_MESSAGE = S&how 'Free up memory...' warning >+SHOW_RELOAD_MESSAGE = S&how Unload profiling data message > PROFILING_TIP_TITLE = Profiling Tips > STR_ERROR_FOLDER_CREATION = IWAT0023E Unable to create the target folder. Make sure the path is correct. > STR_FOLDER_CREATION_MSG = Directory %1 does not exist. Do you want to create it? >@@ -491,6 +488,7 @@ > > > RAC_PORT_TEXT = A&gent Controller port: >+STR_ADD_HOST = Add host > > STR_INVALID_BOUND_VALUE = Invalid Boundary Class Depth value, it must be positive integer. > STR_INVALID_COLLECTION_VALUE = Value must be positive interger. >Index: src/org/eclipse/hyades/trace/ui/internal/actions/RefreshFromLocalAction.java >=================================================================== >RCS file: /home/tptp/platform/org.eclipse.hyades.trace.ui/src/org/eclipse/hyades/trace/ui/internal/actions/RefreshFromLocalAction.java,v >retrieving revision 1.7 >diff -u -r1.7 RefreshFromLocalAction.java >--- src/org/eclipse/hyades/trace/ui/internal/actions/RefreshFromLocalAction.java 25 May 2005 18:48:05 -0000 1.7 >+++ src/org/eclipse/hyades/trace/ui/internal/actions/RefreshFromLocalAction.java 15 Jul 2005 02:02:50 -0000 >@@ -13,7 +13,6 @@ > package org.eclipse.hyades.trace.ui.internal.actions; > > import java.util.ArrayList; >-import java.util.Arrays; > import java.util.Iterator; > import java.util.List; > >@@ -21,7 +20,6 @@ > import org.eclipse.emf.ecore.resource.Resource; > import org.eclipse.hyades.models.hierarchy.TRCAgent; > import org.eclipse.hyades.models.hierarchy.util.HierarchyResourceSetImpl; >-import org.eclipse.hyades.trace.internal.ui.PDContentProvider; > import org.eclipse.hyades.trace.internal.ui.PDProjectExplorer; > import org.eclipse.hyades.trace.internal.ui.TraceConstants; > import org.eclipse.hyades.trace.ui.IDeleteListener; >@@ -37,6 +35,7 @@ > import org.eclipse.jface.viewers.IStructuredContentProvider; > import org.eclipse.jface.viewers.IStructuredSelection; > import org.eclipse.jface.viewers.Viewer; >+import org.eclipse.swt.widgets.Display; > import org.eclipse.swt.widgets.Shell; > import org.eclipse.ui.IWorkbenchWindow; > import org.eclipse.ui.PlatformUI; >@@ -55,14 +54,14 @@ > public RefreshFromLocalAction(INavigator viewer) > { > super(viewer.getViewer(), UIPlugin.getResourceString("UNLOAD_MEMORY")); >- setDescription(UIPlugin.getResourceString("RELOAD_LOCAL_FILE")); >+ setDescription(UIPlugin.getResourceString("UNLOAD_MEMORY")); > fViewer = viewer; > > PlatformUI.getWorkbench().getHelpSystem().setHelp( > this, > UIPlugin.getPluginId()+".refl0000"); > >- setToolTipText(UIPlugin.getResourceString("RELOAD_LOCAL_FILE_TOOLTIP")); >+ setToolTipText(UIPlugin.getResourceString("UNLOAD_MEMORY")); > } > > public void run() >@@ -76,7 +75,7 @@ > > if (UIPlugin.getDefault().getPreferenceStore().getBoolean(TraceConstants.RELOAD_INFO)) { > MessageDialogWithToggle dialog = MessageDialogWithToggle.openOkCancelConfirm(shell, >- UIPlugin.getResourceString("RELOAD_INFORMATION_TITLE"), //$NON-NLS-1$ >+ UIPlugin.getResourceString("TRACE_MSG"), //$NON-NLS-1$ > UIPlugin.getResourceString("RELOAD_INFORMATION"), //$NON-NLS-1$ > UIPlugin.getResourceString("ATTACH_MESSAGE_CHECKBOX_MSG"), //$NON-NLS-1$ > false, UIPlugin.getDefault().getPreferenceStore(), >@@ -113,52 +112,53 @@ > > ListSelectionDialog dlg = > new ListSelectionDialog( >- fViewer.getViewSite().getShell(), >+ Display.getCurrent().getActiveShell(), > listArray, > contentProvider, > new SimpleLayout(null).getLabelProvider(), > UIPlugin.getResourceString("FREE_MEMORY_QUESTION")); > dlg.setInitialSelections(listArray); >- dlg.setTitle(UIPlugin.getResourceString("UNLOAD_MEMORY")); >+ dlg.setTitle(UIPlugin.getResourceString("TRACE_MSG")); > > int result = dlg.open(); > if(result == ListSelectionDialog.CANCEL) > return; > >- if(!Arrays.asList(dlg.getResult()).isEmpty()) >+ Object[] selections = dlg.getResult(); >+ if(listArray.length != selections.length) > { >- try{ >- SaveAction saveLogs = new SaveAction(fViewer); >- saveLogs.run(result); >- }catch (Exception e) { >- HyadesUIPlugin.logError(e); >- } >- }else{ > String title = UIPlugin.getResourceString("TRACE_MSG"); >- String msg = UIPlugin.getResourceString("RELOAD_QUESTION"); >+ String msg = UIPlugin.getResourceString("FREE_MEMORY_QUESTION1"); > >- if(! MessageDialog.openQuestion(fViewer.getViewSite().getShell(), title, msg)) >+ if(! MessageDialog.openQuestion(Display.getCurrent().getActiveShell(), title, msg)) > return; > } >+ >+ try{ >+ SaveAction saveAction = new SaveAction(fViewer); >+ saveAction.finishSaving(selections); >+ }catch (Exception e) { >+ HyadesUIPlugin.logError(e); >+ } > } >- >- ProfileEvent event = new ProfileEvent(); >- event.setSource(ResourcesPlugin.getWorkspace().getRoot()); >- >+ > handleResources(); > > if(!(fViewer instanceof PDProjectExplorer)) > { >+ ProfileEvent event = new ProfileEvent(); >+ event.setSource(ResourcesPlugin.getWorkspace().getRoot()); > event.setType(ProfileEvent.REFRESH_LOG_NAVIGATOR); > UIPlugin.getDefault().notifyProfileEventListener(event); > } >- >- event.setType(ProfileEvent.REFRESH_PD_EXPLORER); >- UIPlugin.getDefault().notifyProfileEventListener(event); >- >- } >+ else >+ fViewer.getViewer().refresh(); >+ } >+ > /** >- * @param list >+ * >+ * @param onlyModified >+ * @return > */ > protected List getProcessProxies(boolean onlyModified) > { >@@ -175,17 +175,16 @@ > if(!list.contains(agent.getAgentProxy().getProcessProxy())) > list.add(agent.getAgentProxy().getProcessProxy()); > } catch (Exception e) { >- // TODO: handle exception > } > } > } > } > return list; > } >+ > /** >- * >- */ >- >+ * >+ */ > public void selectionChanged(IStructuredSelection selection) > { > setEnabled(isEnabled()); >@@ -205,9 +204,7 @@ > } > > protected void handleResources(){ >- >- PDContentProvider.resetMonitors(); >- >+ > Object[] resources = HierarchyResourceSetImpl.getInstance().getResources().toArray(); > for (int idx=0;idx < resources.length;idx++) > { >@@ -217,14 +214,18 @@ > for(int i=0;i<elements.length;i++) > { > Object obj = elements[i]; >+ > > List deletelist = UIPlugin.getDefault().getDeleteListeners(); > for(int j=0; j<deletelist.size();j++) > { > ((IDeleteListener)deletelist.get(j)).deregister(obj); > } >- >- element.unload(); >+ >+ if(obj instanceof TRCAgent) >+ { >+ element.unload(); >+ } > } > } > } >Index: src/org/eclipse/hyades/trace/ui/internal/actions/RefreshTreeAction.java >=================================================================== >RCS file: /home/tptp/platform/org.eclipse.hyades.trace.ui/src/org/eclipse/hyades/trace/ui/internal/actions/RefreshTreeAction.java,v >retrieving revision 1.3 >diff -u -r1.3 RefreshTreeAction.java >--- src/org/eclipse/hyades/trace/ui/internal/actions/RefreshTreeAction.java 25 May 2005 18:48:05 -0000 1.3 >+++ src/org/eclipse/hyades/trace/ui/internal/actions/RefreshTreeAction.java 15 Jul 2005 02:02:50 -0000 >@@ -12,11 +12,31 @@ > > package org.eclipse.hyades.trace.ui.internal.actions; > >+import java.util.List; >+ >+import org.eclipse.core.resources.ResourcesPlugin; >+import org.eclipse.emf.ecore.resource.Resource; >+import org.eclipse.hyades.models.hierarchy.util.HierarchyResourceSetImpl; >+import org.eclipse.hyades.trace.internal.ui.PDContentProvider; > import org.eclipse.hyades.trace.internal.ui.PDPluginImages; >+import org.eclipse.hyades.trace.internal.ui.PDProjectExplorer; >+import org.eclipse.hyades.trace.ui.IDeleteListener; >+import org.eclipse.hyades.trace.ui.ProfileEvent; > import org.eclipse.hyades.trace.ui.UIPlugin; > import org.eclipse.hyades.ui.internal.navigator.INavigator; >+import org.eclipse.jface.dialogs.IDialogConstants; >+import org.eclipse.jface.dialogs.MessageDialog; > import org.eclipse.jface.viewers.ISelectionChangedListener; > import org.eclipse.jface.viewers.IStructuredSelection; >+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.GridLayout; >+import org.eclipse.swt.widgets.Button; >+import org.eclipse.swt.widgets.Composite; >+import org.eclipse.swt.widgets.Control; >+import org.eclipse.swt.widgets.Shell; > import org.eclipse.ui.PlatformUI; > import org.eclipse.ui.actions.SelectionProviderAction; > >@@ -27,7 +47,64 @@ > public class RefreshTreeAction extends SelectionProviderAction > implements ISelectionChangedListener > { >- private INavigator fViewer; >+ class RefreshResourceDialog extends MessageDialog { >+ >+ private boolean refreshContent = false; >+ private Button radio1; >+ private Button radio2; >+ >+ RefreshResourceDialog(Shell parentShell) { >+ super( >+ parentShell, >+ UIPlugin.getResourceString("TRACE_MSG"), >+ null, >+ // accept the default window icon >+ UIPlugin.getResourceString("CONFIRM_REFRESH_MSG"), >+ MessageDialog.QUESTION, >+ new String[] { >+ IDialogConstants.YES_LABEL, >+ IDialogConstants.NO_LABEL }, >+ 0); >+ // yes is the default >+ } >+ >+ protected Control createCustomArea(Composite parent) { >+ Composite composite = new Composite(parent, SWT.NONE); >+ composite.setLayout(new GridLayout()); >+ radio1 = new Button(composite, SWT.RADIO); >+ radio1.addSelectionListener(selectionListener); >+ String text1 = >+ UIPlugin.getResourceString("STR_REFRESH_RES_SYS"); >+ radio1.setText(text1); >+ >+ radio2 = new Button(composite, SWT.RADIO); >+ radio2.addSelectionListener(selectionListener); >+ String text2 = >+ UIPlugin.getResourceString("STR_NOT_REFRESH_RES"); >+ radio2.setText(text2); >+ >+ // set initial state >+ radio1.setSelection(refreshContent); >+ radio2.setSelection(!refreshContent); >+ >+ return composite; >+ } >+ >+ private SelectionListener selectionListener = new SelectionAdapter() { >+ public void widgetSelected(SelectionEvent e) { >+ Button button = (Button) e.widget; >+ if (button.getSelection()) { >+ refreshContent = (button == radio1); >+ } >+ } >+ }; >+ >+ public boolean getRefreshContent() { >+ return refreshContent; >+ } >+ } >+ >+private INavigator fViewer; > > public RefreshTreeAction(INavigator viewer) > { >@@ -44,8 +121,55 @@ > } > public void run() > { >- fViewer.getViewer().refresh(); >- } >+ RefreshResourceDialog dlg = new RefreshResourceDialog(fViewer.getViewSite().getShell()); >+ if (dlg.open() != 0) >+ return; >+ >+ boolean refreshContents = dlg.getRefreshContent(); >+ >+ if(refreshContents) >+ { >+ PDContentProvider.resetMonitors(); >+ >+ Object[] resources = HierarchyResourceSetImpl.getInstance().getResources().toArray(); >+ for (int idx=0;idx < resources.length;idx++) >+ { >+ Resource element = (Resource) resources[idx]; >+ if(element!=null && element.isLoaded()){ >+ Object[] elements = element.getContents().toArray(); >+ for(int i=0;i<elements.length;i++) >+ { >+ Object obj = elements[i]; >+ >+ List deletelist = UIPlugin.getDefault().getDeleteListeners(); >+ for(int j=0; j<deletelist.size();j++) >+ { >+ ((IDeleteListener)deletelist.get(j)).deregister(obj); >+ } >+ >+ element.unload(); >+ } >+ } >+ } >+ >+ if(!(fViewer instanceof PDProjectExplorer)) >+ { >+ ProfileEvent event = new ProfileEvent(); >+ event.setSource(ResourcesPlugin.getWorkspace().getRoot()); >+ event.setType(ProfileEvent.REFRESH_LOG_NAVIGATOR); >+ UIPlugin.getDefault().notifyProfileEventListener(event); >+ } >+ else >+ fViewer.getViewer().refresh(); >+ >+ } >+ else >+ { >+ fViewer.getViewer().refresh(); >+ } >+ >+ } >+ > public void selectionChanged(IStructuredSelection selection) > { > setEnabled(true); >Index: src/org/eclipse/hyades/trace/ui/internal/actions/SaveAction.java >=================================================================== >RCS file: /home/tptp/platform/org.eclipse.hyades.trace.ui/src/org/eclipse/hyades/trace/ui/internal/actions/SaveAction.java,v >retrieving revision 1.5 >diff -u -r1.5 SaveAction.java >--- src/org/eclipse/hyades/trace/ui/internal/actions/SaveAction.java 27 Jun 2005 17:54:38 -0000 1.5 >+++ src/org/eclipse/hyades/trace/ui/internal/actions/SaveAction.java 15 Jul 2005 02:02:50 -0000 >@@ -13,8 +13,8 @@ > package org.eclipse.hyades.trace.ui.internal.actions; > > import java.lang.reflect.InvocationTargetException; >+import java.util.ArrayList; > import java.util.Arrays; >-import java.util.Iterator; > > import org.eclipse.core.resources.IProject; > import org.eclipse.core.resources.IResource; >@@ -31,11 +31,10 @@ > import org.eclipse.jface.viewers.ISelection; > import org.eclipse.jface.viewers.ISelectionChangedListener; > import org.eclipse.jface.viewers.IStructuredSelection; >-import org.eclipse.swt.widgets.Shell; >+import org.eclipse.swt.widgets.Display; > import org.eclipse.ui.PlatformUI; > import org.eclipse.ui.actions.SelectionProviderAction; > import org.eclipse.ui.actions.WorkspaceModifyDelegatingOperation; >-import org.eclipse.ui.dialogs.ListSelectionDialog; > > /* > * CONTEXT_ID save0000 for save to local action >@@ -45,9 +44,6 @@ > > private INavigator fViewer; > private Object[] fSelections; >- private IResource fResSelection; >- private IResource[] fResSelections; >- private Shell fShell; > > public SaveAction(INavigator viewer) { > super(viewer.getViewer(), UIPlugin.getResourceString("SAVE")); >@@ -62,16 +58,12 @@ > } > public void run() { > String msg = ""; >- >+ > ISelection sel = > (ISelection) getSelection(); >- if(sel instanceof IStructuredSelection) >- fSelections = ((IStructuredSelection)sel).toArray(); >- else >+ if(!(sel instanceof IStructuredSelection)) > return; > >- fShell = fViewer.getViewSite().getShell(); >- > if(sel != null && !sel.isEmpty()) > { > if(((IStructuredSelection)sel).size()==1 && ((IStructuredSelection)sel).getFirstElement()!=null && ((IStructuredSelection)sel).getFirstElement() instanceof IProject){ >@@ -83,86 +75,69 @@ > > if (!MessageDialog > .openQuestion( >- fShell, >+ Display.getCurrent().getActiveShell(), > UIPlugin.getResourceString("SAVTOLOCACT_DIA_TITLE"), > msg)) > return; > >- finishSaving(sel); >+ finishSaving(((IStructuredSelection)sel).toArray()); > > } > >- public void run(int result) { >- >- ISelection sel = >- (ISelection) getSelection(); >- if(sel instanceof IStructuredSelection) >- fSelections = ((IStructuredSelection)sel).toArray(); >- else >- return; >- >- fShell = fViewer.getViewSite().getShell(); >- >- if(sel != null && !sel.isEmpty() && result == ListSelectionDialog.OK) >- { >- finishSaving(sel); >- } >- >- } >- >- protected void finishSaving(ISelection sel){ >- int j = 0; >- int s = ((IStructuredSelection)sel).size(); >- fResSelections = new IResource[s]; >- for (Iterator iter = ((IStructuredSelection)sel).iterator(); iter.hasNext();) { >- fResSelections[j++] = >- HyadesUtil.getSelectionFolder(iter.next()); >- >- } >- >- fResSelection = fResSelections[0]; >+ public void finishSaving(Object[] selections){ > >+ fSelections = selections; > try { >- new ProgressMonitorDialog(fShell).run( >+ new ProgressMonitorDialog(Display.getCurrent().getActiveShell()).run( > true, > true, > new WorkspaceModifyDelegatingOperation(this)); > } catch (InterruptedException e) { > try { >- if (fResSelection != null && fResSelection.exists()) >- fResSelection.getProject().refreshLocal( >- IResource.DEPTH_INFINITE, >- null); >+ >+ ArrayList folders = new ArrayList(); >+ for(int idx=0; idx<fSelections.length; idx++) >+ { >+ IResource res = HyadesUtil.getSelectionFolder(fSelections[idx]); >+ >+ if (res != null && res.exists() && !folders.contains(res)) >+ folders.add(res); >+ res.getProject().refreshLocal( >+ IResource.DEPTH_INFINITE, >+ null); >+ } >+ folders.clear(); >+ fSelections = null; >+ >+ return; >+ > } catch (CoreException exc) { > exc.printStackTrace(); > } >- >- fResSelection = null; >- fResSelections = null; >- >- return; >- > } catch (InvocationTargetException e) { > e.printStackTrace(); > >- fResSelection = null; >- fResSelections = null; >- >- return; > } > > try { >- if (fResSelection != null && fResSelection.exists()) >- fResSelection.getProject().refreshLocal( >- IResource.DEPTH_INFINITE, >- null); >+ >+ ArrayList folders = new ArrayList(); >+ for(int idx=0; idx<fSelections.length; idx++) >+ { >+ IResource res = HyadesUtil.getSelectionFolder(fSelections[idx]); >+ >+ if (res != null && res.exists() && !folders.contains(res)) >+ folders.add(res); >+ res.getProject().refreshLocal( >+ IResource.DEPTH_INFINITE, >+ null); >+ } >+ folders.clear(); >+ fSelections = null; >+ > } catch (CoreException exc) { > exc.printStackTrace(); > } >- >- fResSelection = null; >- fResSelections = null; >- > } > > protected INavigator getViewer(){ >@@ -173,6 +148,10 @@ > } > > public void run(IProgressMonitor monitor) { >+ >+ if(fSelections == null) >+ return; >+ > SaveUtil.save(Arrays.asList(fSelections), monitor, fViewer.getID()); > } > >@@ -183,9 +162,6 @@ > public void dispose() { > super.dispose(); > fViewer = null; >- fResSelection = null; >- fResSelections = null; >- fShell = null; > fSelections = null; > } > } >Index: src/org/eclipse/hyades/trace/ui/internal/core/TraceHostUI.java >=================================================================== >RCS file: /home/tptp/platform/org.eclipse.hyades.trace.ui/src/org/eclipse/hyades/trace/ui/internal/core/TraceHostUI.java,v >retrieving revision 1.5 >diff -u -r1.5 TraceHostUI.java >--- src/org/eclipse/hyades/trace/ui/internal/core/TraceHostUI.java 27 Jun 2005 15:53:10 -0000 1.5 >+++ src/org/eclipse/hyades/trace/ui/internal/core/TraceHostUI.java 15 Jul 2005 02:02:50 -0000 >@@ -19,20 +19,24 @@ > import org.eclipse.hyades.trace.ui.UIPlugin; > import org.eclipse.hyades.trace.ui.internal.util.AbstractChangeable; > import org.eclipse.hyades.ui.util.GridUtil; >+import org.eclipse.jface.dialogs.Dialog; >+import org.eclipse.jface.dialogs.IDialogConstants; > import org.eclipse.jface.preference.IPreferenceStore; >+import org.eclipse.jface.window.Window; > import org.eclipse.jface.wizard.WizardPage; > import org.eclipse.swt.SWT; > import org.eclipse.swt.events.ModifyEvent; > import org.eclipse.swt.events.ModifyListener; > import org.eclipse.swt.events.SelectionEvent; > import org.eclipse.swt.events.SelectionListener; >-import org.eclipse.swt.events.TraverseEvent; >-import org.eclipse.swt.events.TraverseListener; > 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.Control; >+import org.eclipse.swt.widgets.Display; > import org.eclipse.swt.widgets.Label; >+import org.eclipse.swt.widgets.Shell; > import org.eclipse.swt.widgets.Table; > import org.eclipse.swt.widgets.TableItem; > import org.eclipse.swt.widgets.Text; >@@ -60,6 +64,7 @@ > > public class TraceHostUI extends AbstractChangeable implements > SelectionListener, ModifyListener { >+ > private Button _delete; > > private Button _add; >@@ -74,6 +79,91 @@ > > private WizardPage _wizardPage = null; > >+ class AddHostDialog extends Dialog implements ModifyListener { >+ private Text _host; >+ private Text _port; >+ private String hostStr; >+ private String portStr; >+ >+ public AddHostDialog() { >+ super(Display.getCurrent().getActiveShell()); >+ } >+ >+ protected void configureShell(Shell shell) { >+ super.configureShell(shell); >+ shell.setText(UIPlugin.getResourceString("STR_ADD_HOST")); >+ } >+ >+ protected Control createDialogArea(Composite parent) { >+ Composite result = (Composite) super.createDialogArea(parent); >+ >+ GridLayout layout; >+ GridData data; >+ Label label; >+ >+ layout = new GridLayout(); >+ layout.numColumns = 2; >+ result.setLayout(layout); >+ data = GridUtil.createFill(); >+ data.widthHint = 400; >+ result.setLayoutData(data); >+ >+ label = new Label(result, SWT.NONE); >+ label.setText(UIPlugin.getResourceString("STR_PREF_HOST_IP")); >+ _host = new Text(result, SWT.BORDER); >+ _host.setLayoutData(GridUtil.createHorizontalFill()); >+ _host.addModifyListener(this); >+ >+ label = new Label(result, SWT.NONE); >+ label.setText(UIPlugin.getResourceString("RAC_PORT_TEXT")); >+ _port = new Text(result, SWT.BORDER); >+ _port.setLayoutData(GridUtil.createHorizontalFill()); >+ _port.addModifyListener(this); >+ >+ _port.setText(String.valueOf(Constants.CTL_PORT_NUM_SERVER)); >+ _host.setText("localhost"); >+ _host.setFocus(); >+ _host.selectAll(); >+ >+ return result; >+ } >+ >+ public void modifyText(ModifyEvent e) { >+ if (getButton(IDialogConstants.OK_ID) != null) >+ getButton(IDialogConstants.OK_ID).setEnabled( >+ _port.getText().trim().length() > 0 && _host.getText().trim().length() > 0); >+ } >+ >+ protected void okPressed() { >+ hostStr = _host.getText().trim(); >+ portStr = _port.getText().trim(); >+ super.okPressed(); >+ } >+ >+ /* >+ * Set the initial Ok button enablement. >+ */ >+ protected Control createContents(Composite parent) { >+ Control result = super.createContents(parent); >+ getButton(IDialogConstants.OK_ID).setEnabled(_port.getText().trim().length() > 0); >+ return result; >+ } >+ >+ /** >+ * @return Returns the hostStr. >+ */ >+ public String getHost() { >+ return hostStr; >+ } >+ >+ /** >+ * @return Returns the portStr. >+ */ >+ public String getPort() { >+ return portStr; >+ } >+ } >+ > /** > * TraceOptionsUI constructor comment. > */ >@@ -91,12 +181,22 @@ > * PM) > */ > public void addHost() { >- addHost(_host.getText().trim() + ":" + _port.getText().trim()); >- _host.setText(""); >- _port.setText(String.valueOf(Constants.CTL_PORT_NUM_SERVER)); >- _host.setFocus(); >+ >+ AddHostDialog dialog = new AddHostDialog(); >+ dialog.open(); >+ >+ if (dialog.getReturnCode() == Window.OK) { >+ >+ StringBuffer buffer = new StringBuffer(dialog.getHost()); >+ buffer.append(":").append(dialog.getPort()); >+ addHost(buffer.toString()); >+ >+ enableButtons(); >+ changed(); >+ setHostText(); >+ } > } >- >+ > /** > * Insert the method's description here. Creation date: (4/26/2001 5:17:57 > * PM) >@@ -107,7 +207,10 @@ > public void addHost(String text) { > for (int idx = 0; idx < _list.getItemCount(); idx++) { > if (text.equals(_list.getItem(idx).getText())) >+ { >+ _list.select(idx); > return; >+ } > } > > TableItem item = new TableItem(_list, SWT.NONE); >@@ -128,7 +231,7 @@ > // since I only get called upon initialization > // I will remove all the previous hosts > // and then add these hosts >- if (hosts != null && !hosts.equals("")) { >+ if (hosts != null && hosts.length() > 0) { > int idx = 0; > > while (idx != -1) { >@@ -219,9 +322,13 @@ > layout.numColumns = 1; > buttonWidget1.setLayout(layout); > >+ _add = new Button(buttonWidget1, SWT.NULL); >+ _add.setLayoutData(GridUtil.createHorizontalFill()); >+ _add.setText(UIPlugin.getResourceString("STR_PREF_ADD")); >+ > _delete = new Button(buttonWidget1, SWT.NULL); > _delete.setLayoutData(GridUtil.createHorizontalFill()); >- _delete.setText(UIPlugin.getResourceString("DELETE")); >+ _delete.setText(UIPlugin.getResourceString("REMOVE_TEXT")); > > _testConnection = new Button(buttonWidget1, SWT.NULL); > _testConnection.setLayoutData(GridUtil.createHorizontalFill()); >@@ -231,17 +338,6 @@ > Label l = new Label(buttonWidget1, SWT.NULL); > l.setLayoutData(GridUtil.createVerticalFill()); > >- Composite buttonWidget2 = new Composite(buttonWidget, SWT.NULL); >- data = GridUtil.createHorizontalFill(); >- buttonWidget2.setLayoutData(data); >- layout = new GridLayout(); >- layout.numColumns = 1; >- buttonWidget2.setLayout(layout); >- >- _add = new Button(buttonWidget2, SWT.NULL); >- _add.setLayoutData(GridUtil.createHorizontalFill()); >- _add.setText(UIPlugin.getResourceString("STR_PREF_ADD")); >- > _add.addSelectionListener(this); > _delete.addSelectionListener(this); > _testConnection.addSelectionListener(this); >@@ -250,32 +346,11 @@ > _host.addModifyListener(this); > _port.addModifyListener(this); > >- _add.setEnabled(false); > _delete.setEnabled(false); > _testConnection.setEnabled(false); > > initializeValues(); > >- _host.setFocus(); >- >- _host.addTraverseListener(new TraverseListener() { >- public void keyTraversed(TraverseEvent e) { >- if (e.detail == SWT.TRAVERSE_RETURN) { >- if (_host.getText().trim() == "" >- || _port.getText().trim() == "") >- return; >- >- addHost(); >- e.doit = false; >- >- if (_wizardPage != null) >- _wizardPage >- .setPageComplete(_list.getSelectionIndex() != -1); >- >- } >- } >- }); >- > PlatformUI.getWorkbench().getHelpSystem().setHelp(_list, > UIPlugin.getPluginId() + ".hstp0001"); > >@@ -330,6 +405,9 @@ > int i = _list.getSelectionIndex(); > if (i != -1) > _list.remove(i); >+ >+ _host.setText(""); >+ _port.setText(""); > > } > >@@ -413,6 +491,8 @@ > > String hosts = store.getString(HyadesConstants.HOST_KEY); > addHosts(hosts); >+ setHostText(); >+ > enableButtons(); > } > >@@ -423,22 +503,13 @@ > * an event containing information about the modify > */ > public void modifyText(ModifyEvent e) { >- if (e.widget == _host) >- _add.setEnabled((!_host.getText().trim().equals("")) >- && (!_port.getText().trim().equals(""))); >- else if (e.widget == _port) { >- try { >- int value = Integer.parseInt(_port.getText().trim()); >- if (value < 0 || value > 65535) { >- _add.setEnabled(false); >- return; >- } >- _add.setEnabled((!_host.getText().trim().equals("")) >- && (!_port.getText().trim().equals(""))); >- } catch (NumberFormatException nfe) { >- _add.setEnabled(false); >+ if (e.widget == _host || e.widget == _port) >+ { >+ TableItem[] selected = _list.getSelection(); >+ if(selected.length > 0) >+ { >+ selected[0].setText((new StringBuffer(_host.getText().trim()).append(":").append(_port.getText().trim())).toString()); > } >- > } > } > >@@ -489,11 +560,10 @@ > > if (e.widget == _add) { > addHost(); >- enableButtons(); >- changed(); > > if (_wizardPage != null) > _wizardPage.setPageComplete(_list.getSelectionIndex() != -1); >+ > } else if (e.widget == _delete) { > deleteHost(); > enableButtons(); >@@ -501,10 +571,11 @@ > > if (_wizardPage != null) > _wizardPage.setPageComplete(_list.getSelectionIndex() != -1); >+ > } else if (e.widget == _list) { >- TableItem[] selected = _list.getSelection(); > enableButtons(); >- _list.setSelection(selected); >+ setHostText(); >+ > changed(); > if (_wizardPage != null) > _wizardPage.setPageComplete(_list.getSelectionIndex() != -1); >@@ -523,4 +594,31 @@ > } > } > } >+ >+ private void setHostText() >+ { >+ TableItem[] selected = _list.getSelection(); >+ if(selected.length > 0) >+ { >+ String text = selected[0].getText(); >+ int idx=text.lastIndexOf(":"); >+ if(idx != -1) >+ { >+ _host.setText(text.substring(0, idx)); >+ >+ if(idx<text.length()-1) >+ { >+ _port.setText(text.substring(idx+1)); >+ } >+ else >+ _port.setText(""); >+ } >+ } >+ else >+ { >+ _host.setText(""); >+ _port.setText(""); >+ } >+ >+ } > } >Index: src/org/eclipse/hyades/trace/ui/internal/core/TraceLogUI.java >=================================================================== >RCS file: /home/tptp/platform/org.eclipse.hyades.trace.ui/src/org/eclipse/hyades/trace/ui/internal/core/TraceLogUI.java,v >retrieving revision 1.3 >diff -u -r1.3 TraceLogUI.java >--- src/org/eclipse/hyades/trace/ui/internal/core/TraceLogUI.java 27 Jun 2005 15:53:10 -0000 1.3 >+++ src/org/eclipse/hyades/trace/ui/internal/core/TraceLogUI.java 15 Jul 2005 02:02:50 -0000 >@@ -12,31 +12,101 @@ > package org.eclipse.hyades.trace.ui.internal.core; > > import org.eclipse.hyades.trace.ui.UIPlugin; >-import org.eclipse.hyades.trace.ui.internal.util.CList; > import org.eclipse.hyades.ui.util.GridUtil; >+import org.eclipse.jface.dialogs.Dialog; >+import org.eclipse.jface.dialogs.IDialogConstants; >+import org.eclipse.jface.window.Window; > import org.eclipse.swt.SWT; > import org.eclipse.swt.events.ModifyEvent; > import org.eclipse.swt.events.ModifyListener; >-import org.eclipse.swt.events.SelectionAdapter; > import org.eclipse.swt.events.SelectionEvent; > import org.eclipse.swt.events.SelectionListener; >-import org.eclipse.swt.events.TraverseEvent; >-import org.eclipse.swt.events.TraverseListener; > 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.Control; >+import org.eclipse.swt.widgets.Display; > import org.eclipse.swt.widgets.Label; >+import org.eclipse.swt.widgets.Shell; >+import org.eclipse.swt.widgets.Table; >+import org.eclipse.swt.widgets.TableItem; > import org.eclipse.swt.widgets.Text; > > public class TraceLogUI implements SelectionListener, ModifyListener { > >- private CList _list; >+ private Table _list; > private Button _delete; > private Button _addAgent; >- private Label _newAgentLabel; > private Text _newAgent; > >+ class AddAgentDialog extends Dialog implements ModifyListener { >+ private Text agent; >+ private String agentStr; >+ >+ public AddAgentDialog() { >+ super(Display.getCurrent().getActiveShell()); >+ } >+ >+ protected void configureShell(Shell shell) { >+ super.configureShell(shell); >+ shell.setText(UIPlugin.getResourceString("ADD_LOG_AGENT")); >+ } >+ >+ protected Control createDialogArea(Composite parent) { >+ Composite result = (Composite) super.createDialogArea(parent); >+ >+ GridLayout layout; >+ GridData data; >+ Label label; >+ >+ layout = new GridLayout(); >+ layout.numColumns = 2; >+ result.setLayout(layout); >+ data = GridUtil.createFill(); >+ data.widthHint = 400; >+ result.setLayoutData(data); >+ >+ label = new Label(result, SWT.NONE); >+ label.setText(UIPlugin.getResourceString("LOG_AGENT_LABEL")); >+ agent = new Text(result, SWT.BORDER); >+ agent.setLayoutData(GridUtil.createHorizontalFill()); >+ >+ agent.setText("logAgent"); >+ agent.setFocus(); >+ agent.selectAll(); >+ >+ return result; >+ } >+ >+ public void modifyText(ModifyEvent e) { >+ if (getButton(IDialogConstants.OK_ID) != null) >+ getButton(IDialogConstants.OK_ID).setEnabled( >+ agent.getText().trim().length() > 0); >+ } >+ >+ protected void okPressed() { >+ agentStr = agent.getText().trim(); >+ super.okPressed(); >+ } >+ >+ /* >+ * Set the initial Ok button enablement. >+ */ >+ protected Control createContents(Composite parent) { >+ Control result = super.createContents(parent); >+ getButton(IDialogConstants.OK_ID).setEnabled(agent.getText().trim().length() > 0); >+ return result; >+ } >+ >+ /** >+ * @return Returns the agentStr. >+ */ >+ public String getAgentName() { >+ return agentStr; >+ } >+ } >+ > public TraceLogUI() { > super(); > } >@@ -45,25 +115,38 @@ > * Creation date: (11/06/2000 3:38:47 PM) > */ > protected void addAgent() { >- String agentName = _newAgent.getText().trim(); >- >- addAgent(agentName); >+ >+ AddAgentDialog dialog = new AddAgentDialog(); >+ dialog.open(); >+ >+ if (dialog.getReturnCode() == Window.OK) { >+ >+ addAgent(dialog.getAgentName()); >+ } > } > /** > * Insert the method's description here. > * Creation date: (4/30/2001 12:21:38 PM) > * @param name java.lang.String > */ >- public void addAgent(String name) { >- _list.add(name); >- _list.getList().setSelection(_list.getList().indexOf(name)); >+ public void addAgent(String text) { >+ >+ for (int idx = 0; idx < _list.getItemCount(); idx++) { >+ if (text.equals(_list.getItem(idx).getText())) >+ { >+ _list.select(idx); >+ setAgentText(); >+ return; >+ } >+ } > >- _newAgent.setText(""); >- _newAgent.setFocus(); >+ TableItem item = new TableItem(_list, SWT.NONE); >+ item.setText(text); > >- _addAgent.setEnabled(false); >- _delete.setEnabled(true); >+ _list.setSelection(new TableItem[] { item }); >+ setAgentText(); > } >+ > public Composite createControl(Composite parent) { > GridLayout layout; > GridData gd; >@@ -75,7 +158,9 @@ > _result.setLayout(layout); > _result.setLayoutData(GridUtil.createFill()); > >- _list = new CList(_result, ""); >+ _list = new Table(_result, SWT.BORDER | SWT.H_SCROLL); >+ gd = GridUtil.createFill(); >+ _list.setLayoutData(gd); > > Composite buttons = new Composite(_result, SWT.NULL); > layout = new GridLayout(); >@@ -88,8 +173,12 @@ > gd.widthHint = 120; > buttons.setLayoutData(gd); > >+ _addAgent = new Button(buttons, SWT.PUSH); >+ _addAgent.setText(UIPlugin.getResourceString("STR_PREF_ADD")); >+ _addAgent.setLayoutData(GridUtil.createHorizontalFill()); >+ > _delete = new Button(buttons, SWT.PUSH | SWT.NULL); >- _delete.setText(UIPlugin.getResourceString("REMOVE_AGENT")); >+ _delete.setText(UIPlugin.getResourceString("REMOVE_TEXT")); > _delete.setLayoutData(GridUtil.createHorizontalFill()); > Composite space = new Composite(buttons, SWT.NULL); > space.setLayout(layout); >@@ -102,59 +191,32 @@ > addAgent.setLayout(layout); > addAgent.setLayoutData(GridUtil.createHorizontalFill()); > >- _newAgentLabel = new Label(addAgent, SWT.NULL); >- _newAgentLabel.setText(UIPlugin.getResourceString("ADD_AGENT")); >+ Label label = new Label(addAgent, SWT.NULL); >+ label.setText(UIPlugin.getResourceString("LOG_AGENT_LABEL")); > _newAgent = new Text(addAgent, SWT.BORDER); > _newAgent.setLayoutData(GridUtil.createHorizontalFill()); >- >- Composite addButton = new Composite(_result, SWT.NULL); >- layout = new GridLayout(); >- layout.numColumns = 1; >- layout.verticalSpacing = 1; >- addButton.setLayout(layout); >- gd = new GridData(); >- gd.widthHint = 120; >- addButton.setLayoutData(gd); >- >- _addAgent = new Button(addButton, SWT.PUSH); >- _addAgent.setText(UIPlugin.getResourceString("ADD_AGENT_BUTTON")); >- _addAgent.setLayoutData(GridUtil.createHorizontalFill()); >- >- _addAgent.setEnabled(false); >- _delete.setEnabled(false); >- >+ > _delete.addSelectionListener(this); > _addAgent.addSelectionListener(this); > _newAgent.addModifyListener(this); > >- /*_newAgent.addKeyListener(new KeyAdapter() { >- public void keyReleased(KeyEvent key) { >- if (key.character == 13) >- addAgent(); >- } >- });*/ >- >- _newAgent.addTraverseListener(new TraverseListener() { >- public void keyTraversed(TraverseEvent e) { >- if (e.detail == SWT.TRAVERSE_RETURN) { >- addAgent(); >- e.doit = false; >- } >- } >- }); >- >- _list.getList().addSelectionListener(new SelectionAdapter() { >- public void widgetSelected(SelectionEvent e) { >- _delete.setEnabled(_list.getSelectedIndices().length > 0); >- } >- }); >+ _list.addSelectionListener(this); > >- _newAgent.setFocus(); >+ _delete.setEnabled(false); > > return _result; > } > public String[] getAgents() { >- return _list.getList().getItems(); >+ >+ TableItem[] items = _list.getItems(); >+ String[] agents = new String[items.length]; >+ >+ for(int idx=0; idx<items.length; idx++) >+ { >+ agents[idx]=items[idx].getText(); >+ } >+ >+ return agents; > } > /** > * Insert the method's description here. >@@ -163,37 +225,31 @@ > */ > public void modifyText(ModifyEvent event) { > if (event.widget == _newAgent) >- _addAgent.setEnabled(!_newAgent.getText().trim().equals("")); >+ { >+ TableItem[] selected = _list.getSelection(); >+ if(selected.length > 0) >+ { >+ selected[0].setText(_newAgent.getText().trim()); >+ } >+ } > } > /** > * Insert the method's description here. > * Creation date: (11/06/2000 3:52:27 PM) > */ > protected void removeAgent() { >- int selection = _list.getSelectedIndex(); >- _list.remove(selection); >- >- if (_list.getItemCount() > 0) { >- if (selection == 0) >- _list.setSelectedIndex(0); >- if (selection < _list.getItemCount()) >- _list.setSelectedIndex(selection); >- else if ((selection - 1) < _list.getItemCount()) >- _list.setSelectedIndex(selection - 1); >- else >- _list.setSelectedIndex(0); >- } else >- _delete.setEnabled(false); >- >- _newAgent.setFocus(); >- _newAgent.selectAll(); >+ int i = _list.getSelectionIndex(); >+ if (i != -1) >+ _list.remove(i); >+ >+ _newAgent.setText(""); > } > /** > * Insert the method's description here. > * Creation date: (4/30/2001 12:22:33 PM) > */ > public void reset() { >- _list.getList().removeAll(); >+ _list.removeAll(); > _delete.setEnabled(false); > } > /** >@@ -213,5 +269,24 @@ > addAgent(); > else if (event.widget == _delete) > removeAgent(); >+ else if (event.widget == _list) { >+ _delete.setEnabled(_list.getSelectionIndex() != -1); >+ setAgentText(); >+ } >+ } >+ >+ private void setAgentText() >+ { >+ TableItem[] selected = _list.getSelection(); >+ if(selected.length > 0) >+ { >+ _newAgent.setText(selected[0].getText()); >+ } >+ else >+ { >+ _newAgent.setText(""); >+ } >+ > } >+ > } >\ No newline at end of file
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 79567
: 24824