|
From: Robert E. <sky...@us...> - 2009-12-14 11:30:32
|
Update of /cvsroot/jcommander/plugins/org.jcommander.ui.app/src/org/jcommander/ui/app In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv9767/src/org/jcommander/ui/app Modified Files: JCmdWorkbenchAdvisor.java Log Message: Fixed logging Index: JCmdWorkbenchAdvisor.java =================================================================== RCS file: /cvsroot/jcommander/plugins/org.jcommander.ui.app/src/org/jcommander/ui/app/JCmdWorkbenchAdvisor.java,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** JCmdWorkbenchAdvisor.java 11 Jul 2006 14:45:14 -0000 1.38 --- JCmdWorkbenchAdvisor.java 14 Dec 2009 11:30:17 -0000 1.39 *************** *** 7,10 **** --- 7,11 ---- import org.apache.commons.vfs.*; + import org.apache.log4j.Logger; import org.eclipse.jface.dialogs.*; import org.eclipse.jface.preference.*; *************** *** 24,46 **** /** * The workbench advisor for the JCommander RCP. ! * * @author sky_halud */ public class JCmdWorkbenchAdvisor extends WorkbenchAdvisor { /* * (non-Javadoc) ! * * @see org.eclipse.ui.application.WorkbenchAdvisor#getInitialWindowPerspectiveId() */ ! protected String actualCaption; private String captionPrefix; private StartupParameters startupParameters; ! public JCmdWorkbenchAdvisor(String captionPrefix) { this.captionPrefix = captionPrefix; ! TabMediator.setCaptionPrefix(captionPrefix); ! actualCaption = captionPrefix + FilePanelView.CAPTION_SUFFIX; } --- 25,49 ---- /** * The workbench advisor for the JCommander RCP. ! * * @author sky_halud */ public class JCmdWorkbenchAdvisor extends WorkbenchAdvisor { + protected static final Logger LOG = Logger.getLogger(JCmdWorkbenchAdvisor.class); + /* * (non-Javadoc) ! * * @see org.eclipse.ui.application.WorkbenchAdvisor#getInitialWindowPerspectiveId() */ ! protected String actualCaption; private String captionPrefix; private StartupParameters startupParameters; ! public JCmdWorkbenchAdvisor(String captionPrefix) { this.captionPrefix = captionPrefix; ! TabMediator.setCaptionPrefix(captionPrefix); ! actualCaption = captionPrefix + FilePanelView.CAPTION_SUFFIX; } *************** *** 49,53 **** actualCaption = FilePanelView.CAPTION_SUFFIX; } ! public void initialize(org.eclipse.ui.application.IWorkbenchConfigurer configurer) { super.initialize(configurer); --- 52,56 ---- actualCaption = FilePanelView.CAPTION_SUFFIX; } ! public void initialize(org.eclipse.ui.application.IWorkbenchConfigurer configurer) { super.initialize(configurer); *************** *** 73,79 **** configurer.setShowFastViewBars(true); configurer.setShowPerspectiveBar(true); ! IPreferenceStore appPrefStore = AppPlugin.getDefault().getPreferenceStore(); ! if(appPrefStore.getBoolean(AppPlugin.FIRST_STARTUP_KEY)) { new ChooseProfile().run(null); --- 76,82 ---- configurer.setShowFastViewBars(true); configurer.setShowPerspectiveBar(true); ! IPreferenceStore appPrefStore = AppPlugin.getDefault().getPreferenceStore(); ! if(appPrefStore.getBoolean(AppPlugin.FIRST_STARTUP_KEY)) { new ChooseProfile().run(null); *************** *** 85,89 **** } ! /** * @param configurer --- 88,92 ---- } ! /** * @param configurer *************** *** 91,100 **** private void setWindowInfo(IWorkbenchWindowConfigurer configurer) { configurer.setTitle(actualCaption); ! /* Let the Eclipse runtime handle the positioning and sizing */ // Shell appShell = configurer.getWindow().getShell(); // WindowUtils.centerRelativeTo(appShell, appShell.getDisplay()); } ! public boolean preWindowShellClose(IWorkbenchWindowConfigurer configurer) { configurer.getWorkbenchConfigurer().setSaveAndRestore(saveOnExit()); --- 94,103 ---- private void setWindowInfo(IWorkbenchWindowConfigurer configurer) { configurer.setTitle(actualCaption); ! /* Let the Eclipse runtime handle the positioning and sizing */ // Shell appShell = configurer.getWindow().getShell(); // WindowUtils.centerRelativeTo(appShell, appShell.getDisplay()); } ! public boolean preWindowShellClose(IWorkbenchWindowConfigurer configurer) { configurer.getWorkbenchConfigurer().setSaveAndRestore(saveOnExit()); *************** *** 103,112 **** //if confirmed to ask about exit, display the dialog if(conf) { ! MessageDialogWithToggle dlg = MessageDialogWithToggle .openOkCancelConfirm( configurer.getWindow().getShell(), "Exit Confirmation", "Do you want to close jCommander?", "&Always ask", conf, null, null); ! boolean isOK = (dlg.getReturnCode() == IDialogConstants.OK_ID); --- 106,115 ---- //if confirmed to ask about exit, display the dialog if(conf) { ! MessageDialogWithToggle dlg = MessageDialogWithToggle .openOkCancelConfirm( configurer.getWindow().getShell(), "Exit Confirmation", "Do you want to close jCommander?", "&Always ask", conf, null, null); ! boolean isOK = (dlg.getReturnCode() == IDialogConstants.OK_ID); *************** *** 122,126 **** if (saveOnExit()) { loadConfig(configurer); ! } else { createDefaultTab(); --- 125,129 ---- if (saveOnExit()) { loadConfig(configurer); ! } else { createDefaultTab(); *************** *** 134,149 **** // is through the getInstance mechanism) IPreferenceStore appPrefStore = AppPlugin.getDefault().getPreferenceStore(); ! // Display native library loading info if( appPrefStore.getBoolean(AppPlugin.DISPLAY_NATIVE_MANAGER_KEY)) { NativeManagerUi.displayNativeErrors(configurer.getWindow().getShell()); } ! if(appPrefStore.getBoolean(AppPlugin.FIRST_STARTUP_KEY) || appPrefStore.getBoolean(AppPlugin.DISPLAY_WELCOME_KEY)) { ! //enter button in intro page showWelcomePage(configurer.getWindow(),true); ! if(appPrefStore.getBoolean(AppPlugin.FIRST_STARTUP_KEY)) { // Display the welcome page only at first startup (if not specified otherwise) --- 137,152 ---- // is through the getInstance mechanism) IPreferenceStore appPrefStore = AppPlugin.getDefault().getPreferenceStore(); ! // Display native library loading info if( appPrefStore.getBoolean(AppPlugin.DISPLAY_NATIVE_MANAGER_KEY)) { NativeManagerUi.displayNativeErrors(configurer.getWindow().getShell()); } ! if(appPrefStore.getBoolean(AppPlugin.FIRST_STARTUP_KEY) || appPrefStore.getBoolean(AppPlugin.DISPLAY_WELCOME_KEY)) { ! //enter button in intro page showWelcomePage(configurer.getWindow(),true); ! if(appPrefStore.getBoolean(AppPlugin.FIRST_STARTUP_KEY)) { // Display the welcome page only at first startup (if not specified otherwise) *************** *** 159,175 **** public static void showWelcomePage(IWorkbenchWindow window,boolean displayEnterButton) { LoggerPlugin.rootLogger.debug("Checking intro..."); ! if (PlatformUI.getWorkbench().getIntroManager() .hasIntro()) { LoggerPlugin.rootLogger.debug("DISPLAYING."); ! IIntroManager introManager = PlatformUI.getWorkbench().getIntroManager(); IIntroPart introPart = introManager.showIntro(window, false); ! //display or not enter button in intro if(introPart instanceof JCmdIntroPart){ ((JCmdIntroPart)introPart).setDisplayEnterButton(displayEnterButton); } ! introPart.setFocus(); } else { --- 162,178 ---- public static void showWelcomePage(IWorkbenchWindow window,boolean displayEnterButton) { LoggerPlugin.rootLogger.debug("Checking intro..."); ! if (PlatformUI.getWorkbench().getIntroManager() .hasIntro()) { LoggerPlugin.rootLogger.debug("DISPLAYING."); ! IIntroManager introManager = PlatformUI.getWorkbench().getIntroManager(); IIntroPart introPart = introManager.showIntro(window, false); ! //display or not enter button in intro if(introPart instanceof JCmdIntroPart){ ((JCmdIntroPart)introPart).setDisplayEnterButton(displayEnterButton); } ! introPart.setFocus(); } else { *************** *** 177,182 **** } } ! ! /* (non-Javadoc) * @see org.eclipse.ui.application.WorkbenchAdvisor#preShutdown() --- 180,185 ---- } } ! ! /* (non-Javadoc) * @see org.eclipse.ui.application.WorkbenchAdvisor#preShutdown() *************** *** 189,194 **** PlatformUI.getWorkbench().showPerspective(getInitialWindowPerspectiveId(), EclipseBroker.getWorkbenchWindow()); } catch (WorkbenchException e) { ! // TODO Auto-generated catch block ! e.printStackTrace(); } if(saveOnExit()){ --- 192,196 ---- PlatformUI.getWorkbench().showPerspective(getInitialWindowPerspectiveId(), EclipseBroker.getWorkbenchWindow()); } catch (WorkbenchException e) { ! LOG.warn(e, e); } if(saveOnExit()){ *************** *** 209,213 **** return captionPrefix; } ! private void createDefaultTab(){ try { --- 211,215 ---- return captionPrefix; } ! private void createDefaultTab(){ try { *************** *** 218,228 **** EclipseBroker.getWorkbenchWindow(), leftPanelFile, rightPanelFile); ! crtMediator.setCaption("DefaultTab"); } catch (FileSystemException e) { MessageDisplayer.displayMessage(e.getMessage()); } } ! private void loadConfig(IWorkbenchWindowConfigurer configurer){ java.util.List allViews = new ArrayList(); --- 220,231 ---- EclipseBroker.getWorkbenchWindow(), leftPanelFile, rightPanelFile); ! crtMediator.setCaption("DefaultTab"); } catch (FileSystemException e) { + LOG.warn(e, e); MessageDisplayer.displayMessage(e.getMessage()); } } ! private void loadConfig(IWorkbenchWindowConfigurer configurer){ java.util.List allViews = new ArrayList(); *************** *** 231,237 **** return; } ! IWorkbenchPage page = configurer.getWindow().getPages()[0]; allViews.addAll(Arrays.asList(page.getViewReferences())); ! boolean shownATab = false; try { Configuration conf = Configuration.getInstance(); --- 234,240 ---- return; } ! IWorkbenchPage page = configurer.getWindow().getPages()[0]; allViews.addAll(Arrays.asList(page.getViewReferences())); ! boolean shownATab = false; try { Configuration conf = Configuration.getInstance(); *************** *** 242,249 **** } ConfigurationTab tab = conf.getTab(ref.getId(), ref.getSecondaryId()); ! if(ref.getView(true) instanceof FilePanelView) { FilePanelView view = (FilePanelView)ref.getView(true); ! if((null != tab) && (null != view)){ setupTabInView(view, ref.getSecondaryId(), tab); it.remove(); --- 245,252 ---- } ConfigurationTab tab = conf.getTab(ref.getId(), ref.getSecondaryId()); ! if(ref.getView(true) instanceof FilePanelView) { FilePanelView view = (FilePanelView)ref.getView(true); ! if((null != tab) && (null != view)){ setupTabInView(view, ref.getSecondaryId(), tab); it.remove(); *************** *** 260,264 **** for(Iterator i = allViews.iterator(); i.hasNext(); ){ IViewReference view = (IViewReference)i.next(); ! IViewPart viewPart = view.getView(true); if(viewPart instanceof FilePanelView){ ((FilePanelView)viewPart).raiseShutdownClose(); --- 263,267 ---- for(Iterator i = allViews.iterator(); i.hasNext(); ){ IViewReference view = (IViewReference)i.next(); ! IViewPart viewPart = view.getView(true); if(viewPart instanceof FilePanelView){ ((FilePanelView)viewPart).raiseShutdownClose(); *************** *** 270,274 **** } } ! private void setupTabInView(FilePanelView view, String viewID, ConfigurationTab tab){ try { --- 273,277 ---- } } ! private void setupTabInView(FilePanelView view, String viewID, ConfigurationTab tab){ try { *************** *** 283,287 **** view.setRightPanelHidden(tab.isRightPanelHidden()); view.setDetailsShown(tab.isDetailsShown()); ! view.getFileTab().getLeftFilePanel().showTree(tab.getLeftpanel().isShowTree()); view.getFileTab().getRightFilePanel().showTree(tab.getRightpanel().isShowTree()); --- 286,290 ---- view.setRightPanelHidden(tab.isRightPanelHidden()); view.setDetailsShown(tab.isDetailsShown()); ! view.getFileTab().getLeftFilePanel().showTree(tab.getLeftpanel().isShowTree()); view.getFileTab().getRightFilePanel().showTree(tab.getRightpanel().isShowTree()); *************** *** 290,294 **** } } ! private boolean saveOnExit(){ IPreferenceStore appPrefStore = AppPlugin.getDefault().getPreferenceStore(); --- 293,297 ---- } } ! private boolean saveOnExit(){ IPreferenceStore appPrefStore = AppPlugin.getDefault().getPreferenceStore(); |