|
From: Matthias K <mat...@us...> - 2006-07-08 22:43:04
|
Update of /cvsroot/jcommander/plugins/org.jcommander.ui.filepanel/src/org/jcommander/ui/filepanel/controls In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv25471/src/org/jcommander/ui/filepanel/controls Modified Files: FilePanel.java FilePanelMediator.java Log Message: Implementation of feature request [1369613]: Panel auto-refresh disabling option. Index: FilePanelMediator.java =================================================================== RCS file: /cvsroot/jcommander/plugins/org.jcommander.ui.filepanel/src/org/jcommander/ui/filepanel/controls/FilePanelMediator.java,v retrieving revision 1.50 retrieving revision 1.51 diff -C2 -d -r1.50 -r1.51 *** FilePanelMediator.java 15 May 2006 18:08:50 -0000 1.50 --- FilePanelMediator.java 8 Jul 2006 22:43:00 -0000 1.51 *************** *** 126,129 **** --- 126,130 ---- // transfer the info to the model model.setPreviousParent(previousParent); + updateFilePanelAutoRefresh(currentFile); fileControl.changeToDirectory(currentFile); *************** *** 155,158 **** --- 156,163 ---- filePanel.refresh(); } + + public void refreshConditioned() throws FileSystemException { + filePanel.refreshConditioned(); + } /** *************** *** 344,346 **** --- 349,369 ---- + newName; } + + public void updateAutoRefresh(){ + if (FilePanelPlugin.getDefault().getPreferenceStore().getString(FilePanelPlugin.ADVANCED_AUTO_REFRESH).equals(FilePanelPlugin.AUTO_REFRESH_AUTOMATIC)){ + updateFilePanelAutoRefresh(model.getCurrentParent()); + } + } + + private void updateFilePanelAutoRefresh(FileObject File){ + try { + String protocol = File.getURL().getProtocol(); + if ((protocol.compareToIgnoreCase("sftp")==0)||(protocol.compareToIgnoreCase("ftp")==0)) { + filePanel.setAutoRefresh(false); + } else { + filePanel.setAutoRefresh(true); + } + } catch (FileSystemException e) { + } + } } Index: FilePanel.java =================================================================== RCS file: /cvsroot/jcommander/plugins/org.jcommander.ui.filepanel/src/org/jcommander/ui/filepanel/controls/FilePanel.java,v retrieving revision 1.65 retrieving revision 1.66 diff -C2 -d -r1.65 -r1.66 *** FilePanel.java 17 May 2006 11:19:05 -0000 1.65 --- FilePanel.java 8 Jul 2006 22:43:00 -0000 1.66 *************** *** 88,91 **** --- 88,93 ---- private Button toggleAutoRefreshButton = null; + private boolean autoRefresh; + public FilePanel(FileControlModel model, FileTab fileTab, SashForm sashForm, int style) { super(sashForm, style); *************** *** 261,269 **** Image refreshImg = refreshImgDesc.createImage(getDisplay()); ! // TODO Temporary until feature implemented ! toggleAutoRefreshButton.setSelection(true); ! toggleAutoRefreshButton.setEnabled(false); toggleAutoRefreshButton.setImage(refreshImg); partitionInfoLabel = new Label(partitionComposite, SWT.NONE); --- 263,283 ---- Image refreshImg = refreshImgDesc.createImage(getDisplay()); ! setAutoRefresh(FilePanelPlugin.getDefault().getPreferenceStore().getBoolean(FilePanelPlugin.AUTO_REFRESH_PANEL_CONTENTS)); toggleAutoRefreshButton.setImage(refreshImg); + toggleAutoRefreshButton.addSelectionListener(new SelectionListener() { + + public void widgetSelected(SelectionEvent e) { + autoRefresh = toggleAutoRefreshButton.getSelection(); + } + + public void widgetDefaultSelected(SelectionEvent e) { + // TODO Auto-generated method stub + + } + + }); + + updateAutoRefreshMethod(); partitionInfoLabel = new Label(partitionComposite, SWT.NONE); *************** *** 590,593 **** --- 604,618 ---- } + /** + * Refreshes the contents of this file panel. + * @throws FileSystemException + */ + public void refreshConditioned() throws FileSystemException { + if (autoRefresh) { + fileControl.doRefresh(); + refreshPartitionInfo(); + } + } + public StatsPanel getStatsPanel() { return statsPanel; *************** *** 822,824 **** --- 847,869 ---- this.currentDirectoryLabel.setFocus(); } + + public boolean isAutoRefresh() { + return autoRefresh; + } + + public void setAutoRefresh(boolean autoRefresh) { + this.autoRefresh = autoRefresh; + toggleAutoRefreshButton.setSelection(autoRefresh); + } + + public void updateAutoRefreshMethod(){ + String method = FilePanelPlugin.getDefault().getPreferenceStore().getString(FilePanelPlugin.ADVANCED_AUTO_REFRESH); + if (method.equals(FilePanelPlugin.AUTO_REFRESH_AUTOMATIC)) { + toggleAutoRefreshButton.setEnabled(false); + } + else { + toggleAutoRefreshButton.setEnabled(true); + } + panelMediator.updateAutoRefresh(); + } } // @jve:decl-index=0:visual-constraint="10,10" |