List of usage examples for org.apache.commons.lang3 SystemUtils IS_JAVA_1_6
boolean IS_JAVA_1_6
To view the source code for org.apache.commons.lang3 SystemUtils IS_JAVA_1_6.
Click Source Link
Is true if this is Java version 1.6 (also 1.6.x versions).
From source file:de.huxhorn.lilith.swing.MainFrame.java
public MainFrame(ApplicationPreferences applicationPreferences, SplashScreen splashScreen, String appName, boolean enableBonjour) { super(appName); this.applicationPreferences = applicationPreferences; this.coloringWholeRow = this.applicationPreferences.isColoringWholeRow(); this.splashScreen = splashScreen; setSplashStatusText("Creating main frame."); groovyFormatter = new GroovyEventWrapperHtmlFormatter(applicationPreferences); thymeleafFormatter = new ThymeleafEventWrapperHtmlFormatter(applicationPreferences); smallProgressIcon = new ImageIcon(MainFrame.class.getResource("/otherGraphics/Progress16.gif")); ImageIcon frameIcon = new ImageIcon(MainFrame.class.getResource("/otherGraphics/Lilith16.jpg")); setIconImage(frameIcon.getImage());/* ww w . ja v a2 s.co m*/ //colorsReferenceQueue=new ReferenceQueue<Colors>(); //colorsCache=new ConcurrentHashMap<EventIdentifier, SoftColorsReference>(); application = new DefaultApplication(); autostartProcesses = new ArrayList<AutostartRunnable>(); addWindowListener(new MainWindowListener()); setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); // fixes ticket #79 Runtime runtime = Runtime.getRuntime(); Thread shutdownHook = new Thread(new ShutdownRunnable()); runtime.addShutdownHook(shutdownHook); senderService = new SenderService(this); this.enableBonjour = enableBonjour; /* if(application.isMac()) { setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE); } else { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } */ longTaskManager = new TaskManager<Long>(); longTaskManager.setUsingEventQueue(true); longTaskManager.startUp(); longTaskManager.addTaskListener(new MainTaskListener()); startupApplicationPath = this.applicationPreferences.getStartupApplicationPath(); loggingFileFactory = new LogFileFactoryImpl(new File(startupApplicationPath, LOGGING_FILE_SUBDIRECTORY)); accessFileFactory = new LogFileFactoryImpl(new File(startupApplicationPath, ACCESS_FILE_SUBDIRECTORY)); Map<String, String> loggingMetaData = new HashMap<String, String>(); loggingMetaData.put(FileConstants.CONTENT_TYPE_KEY, FileConstants.CONTENT_TYPE_VALUE_LOGGING); loggingMetaData.put(FileConstants.CONTENT_FORMAT_KEY, FileConstants.CONTENT_FORMAT_VALUE_PROTOBUF); loggingMetaData.put(FileConstants.COMPRESSION_KEY, FileConstants.COMPRESSION_VALUE_GZIP); // TODO: configurable format and compressed loggingFileBufferFactory = new LoggingFileBufferFactory(loggingFileFactory, loggingMetaData); Map<String, String> accessMetaData = new HashMap<String, String>(); accessMetaData.put(FileConstants.CONTENT_TYPE_KEY, FileConstants.CONTENT_TYPE_VALUE_ACCESS); accessMetaData.put(FileConstants.CONTENT_FORMAT_KEY, FileConstants.CONTENT_FORMAT_VALUE_PROTOBUF); accessMetaData.put(FileConstants.COMPRESSION_KEY, FileConstants.COMPRESSION_VALUE_GZIP); // TODO: configurable format and compressed accessFileBufferFactory = new AccessFileBufferFactory(accessFileFactory, accessMetaData); rrdFileFilter = new RrdFileFilter(); loggingEventViewManager = new LoggingEventViewManager(this); accessEventViewManager = new AccessEventViewManager(this); this.applicationPreferences.addPropertyChangeListener(new PreferencesChangeListener()); loggingSourceListener = new LoggingEventSourceListener(); accessSourceListener = new AccessEventSourceListener(); // this.cleanupWindowChangeListener = new CleanupWindowChangeListener(); desktop = new JDesktopPane(); statusBar = new JPanel(new GridBagLayout()); GridBagConstraints gbc = new GridBagConstraints(); statusLabel = new JLabel(); statusLabel.setText("Starting..."); gbc.fill = GridBagConstraints.HORIZONTAL; gbc.gridx = 0; gbc.gridy = 0; gbc.weightx = 0.0; gbc.anchor = GridBagConstraints.CENTER; gbc.insets = new Insets(0, 5, 0, 0); statusBar.add(statusLabel, gbc); taskStatusLabel = new JLabel(); taskStatusLabel.setText(""); taskStatusLabel.setForeground(Color.BLUE); taskStatusLabel.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent mouseEvent) { showTaskManager(); } @Override public void mouseEntered(MouseEvent mouseEvent) { taskStatusLabel.setForeground(Color.RED); } @Override public void mouseExited(MouseEvent mouseEvent) { taskStatusLabel.setForeground(Color.BLUE); } }); gbc.gridx = 1; gbc.gridy = 0; gbc.weightx = 1.0; gbc.anchor = GridBagConstraints.CENTER; gbc.insets = new Insets(0, 5, 0, 0); statusBar.add(taskStatusLabel, gbc); MemoryStatus memoryStatus = new MemoryStatus(); memoryStatus.setBackground(Color.WHITE); memoryStatus.setOpaque(true); memoryStatus.setUsingBinaryUnits(true); memoryStatus.setUsingTotal(false); memoryStatus.setBorder(new EtchedBorder(EtchedBorder.LOWERED)); gbc.fill = GridBagConstraints.NONE; gbc.gridx = 2; gbc.gridy = 0; gbc.weightx = 0.0; gbc.anchor = GridBagConstraints.CENTER; gbc.insets = new Insets(0, 0, 0, 0); statusBar.add(memoryStatus, gbc); add(desktop, BorderLayout.CENTER); add(statusBar, BorderLayout.SOUTH); if (SystemUtils.IS_JAVA_1_6) { setSplashStatusText("Creating statistics dialog."); if (logger.isDebugEnabled()) logger.debug("Before creation of statistics-dialog..."); statisticsDialog = new StatisticsDialog(this); if (logger.isDebugEnabled()) logger.debug("After creation of statistics-dialog..."); } setSplashStatusText("Creating about dialog."); aboutDialog = new AboutDialog(this, "About " + appName + "...", appName); setSplashStatusText("Creating update dialog."); checkForUpdateDialog = new CheckForUpdateDialog(this); setSplashStatusText("Creating debug dialog."); debugDialog = new DebugDialog(this, this); setSplashStatusText("Creating preferences dialog."); if (logger.isDebugEnabled()) logger.debug("Before creation of preferences-dialog..."); preferencesDialog = new PreferencesDialog(this); if (logger.isDebugEnabled()) logger.debug("After creation of preferences-dialog..."); setSplashStatusText("Creating \"Open inactive\" dialog."); openInactiveLogsDialog = new OpenPreviousDialog(MainFrame.this); setSplashStatusText("Creating help frame."); helpFrame = new HelpFrame(this); helpFrame.setTitle("Help Topics"); openFileChooser = new JFileChooser(); openFileChooser.setFileFilter(new LilithFileFilter()); openFileChooser.setFileHidingEnabled(false); openFileChooser.setCurrentDirectory(this.applicationPreferences.getPreviousOpenPath()); importFileChooser = new JFileChooser(); importFileChooser.setFileFilter(new XmlImportFileFilter()); importFileChooser.setFileHidingEnabled(false); importFileChooser.setCurrentDirectory(this.applicationPreferences.getPreviousImportPath()); exportFileChooser = new JFileChooser(); exportFileChooser.setFileFilter(new LilithFileFilter()); exportFileChooser.setFileHidingEnabled(false); exportFileChooser.setCurrentDirectory(this.applicationPreferences.getPreviousExportPath()); setSplashStatusText("Creating task manager frame."); taskManagerFrame = new TaskManagerInternalFrame(this); taskManagerFrame.setTitle("Task Manager"); taskManagerFrame.setDefaultCloseOperation(JInternalFrame.HIDE_ON_CLOSE); taskManagerFrame.setBounds(0, 0, 320, 240); desktop.add(taskManagerFrame); desktop.validate(); // the following code must be executed after desktop has been initialized... try { // try to use the 1.6 transfer handler... new MainFrameTransferHandler16(this).attach(); } catch (Throwable t) { // ... and use the basic 1.5 transfer handler if this fails. new MainFrameTransferHandler(this).attach(); } setSplashStatusText("Creating Tip of the Day dialog."); tipOfTheDayDialog = new TipOfTheDayDialog(this); setSplashStatusText("Creating actions and menus."); viewActions = new ViewActions(this, null); viewActions.getPopupMenu(); // initialize popup once in main frame only. JMenuBar menuBar = viewActions.getMenuBar(); toolbar = viewActions.getToolbar(); add(toolbar, BorderLayout.NORTH); setJMenuBar(menuBar); setShowingToolbar(applicationPreferences.isShowingToolbar()); setShowingStatusbar(applicationPreferences.isShowingStatusbar()); }
From source file:org.kie.workbench.common.stunner.bpmn.backend.forms.conditions.parser.ParsingUtilsTest.java
private boolean isJavaVersionOlderThan9() { return (SystemUtils.IS_JAVA_1_8 || SystemUtils.IS_JAVA_1_7 || SystemUtils.IS_JAVA_1_6 || SystemUtils.IS_JAVA_1_5 || SystemUtils.IS_JAVA_1_4 || SystemUtils.IS_JAVA_1_3 || SystemUtils.IS_JAVA_1_2 || SystemUtils.IS_JAVA_1_1); }
From source file:org.tinymediamanager.core.UpdaterTask.java
@Override public Boolean doInBackground() { if (ReleaseInfo.isSvnBuild()) { return false; }/*w w w. j ava 2s .c o m*/ File getdownFile = new File("getdown.txt"); File digestFile = new File("digest.txt"); ArrayList<String> updateUrls = new ArrayList<>(); try { Thread.currentThread().setName("updateThread"); LOGGER.info("Checking for updates..."); // read getdown.txt (IOEx on any error) for (String line : readLines(new FileReader(getdownFile))) { String[] kv = line.split("="); if ("appbase".equals(kv[0].trim()) || "mirror".equals(kv[0].trim())) { updateUrls.add(kv[1].trim()); } } boolean valid = false; boolean changeReleasePath = false; String remoteDigest = ""; String remoteUrl = ""; // try to download from all our mirrors for (String uu : updateUrls) { try { if (!uu.endsWith("/")) { uu += '/'; } // we're on legacy update path, but no java6 -> use regular release if (uu.contains(LEGACY_PATH)) { if (!SystemUtils.IS_JAVA_1_6) { changeReleasePath = true; uu = uu.replace(LEGACY_PATH, REGULAR_PATH); } } else { // we're on regular update path, but java6 -> use legacy release if (SystemUtils.IS_JAVA_1_6) { changeReleasePath = true; uu = uu.replace(REGULAR_PATH, LEGACY_PATH); } } Url upd = new Url(uu + "digest.txt?z=" + System.currentTimeMillis()); // cache bust LOGGER.trace("Checking " + uu); remoteDigest = IOUtils.toString(upd.getInputStream(), "UTF-8"); if (remoteDigest != null && remoteDigest.contains("tmm.jar")) { remoteDigest = remoteDigest.trim(); valid = true; // bingo! remoteUrl = uu; } } catch (Exception e) { LOGGER.warn("Unable to download from mirror: " + e.getMessage()); } if (valid) { break; // no exception - step out :) } } if (!valid) { // we failed to download from all mirrors // last chance: throw ex and try really hardcoded mirror throw new Exception("Error downloading remote checksum information."); } // compare with our local String localDigest = FileUtils.readFileToString(digestFile, "UTF-8"); localDigest = localDigest.trim(); if (!localDigest.equals(remoteDigest)) { LOGGER.info("Update needed..."); Url gd = new Url(remoteUrl + "getdown.txt?z=" + System.currentTimeMillis()); // cache bust String remoteGD = IOUtils.toString(gd.getInputStream(), "UTF-8"); if (remoteGD.contains("forceUpdate")) { forceUpdate = true; } if (changeReleasePath) { // we're up/downgrading dist - DL txts.. LOGGER.debug("Switching distribution due to java versoin, preloading correct files."); FileUtils.writeStringToFile(getdownFile, remoteGD, "UTF-8"); FileUtils.writeStringToFile(digestFile, remoteDigest, "UTF-8"); } // download changelog.txt for preview Url upd = new Url(remoteUrl + "changelog.txt?z=" + System.currentTimeMillis()); // cache bust changelog = IOUtils.toString(upd.getInputStream(), "UTF-8"); return true; } else { LOGGER.info("Already up2date :)"); } } catch (Exception e) { LOGGER.error("Update task failed badly! " + e.getMessage()); try { // try a hardcoded "backup url" for GD.txt, where we could specify a new location :) LOGGER.info("Trying fallback..."); String fallback = "http://www.tinymediamanager.org"; if (SystemUtils.IS_JAVA_1_6) { fallback += LEGACY_PATH; } if (ReleaseInfo.isPreRelease()) { fallback += "/getdown_prerelease.txt"; } else if (ReleaseInfo.isNightly()) { fallback += "/getdown_nightly.txt"; } else { fallback += "/getdown.txt"; } Url upd = new Url(fallback); String gd = IOUtils.toString(upd.getInputStream(), "UTF-8"); if (gd == null || gd.isEmpty() || !gd.contains("appbase")) { throw new Exception("could not even download our fallback"); } FileUtils.writeStringToFile(getdownFile, gd); return true; } catch (Exception e2) { LOGGER.error("Update fallback failed!" + e.getMessage()); MessageManager.instance.pushMessage(new Message(MessageLevel.ERROR, "Please reinstal tinyMediaManager!", "Update check failed very badly :(")); } } return false; }
From source file:org.tinymediamanager.ui.MainWindow.java
/** * Initialize the contents of the frame. *///from w ww . j a v a 2s. c o m private void initialize() { // set the logo setIconImages(LOGOS); setBounds(5, 5, 1100, 727); // do nothing, we have our own windowClosing() listener // setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); getContentPane().setLayout(new BorderLayout(0, 0)); JLayeredPane content = new JLayeredPane(); content.setLayout(new FormLayout( new ColumnSpec[] { ColumnSpec.decode("default:grow"), FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("right:270px"), }, new RowSpec[] { RowSpec.decode("fill:max(500px;default):grow"), })); getContentPane().add(content, BorderLayout.CENTER); JPanel mainPanel = new JPanel(); mainPanel.setLayout(new FormLayout(new ColumnSpec[] { ColumnSpec.decode("default:grow") }, new RowSpec[] { RowSpec.decode("fill:max(500px;default):grow") })); content.add(mainPanel, "1, 1, 3, 1, fill, fill"); content.setLayer(mainPanel, 1); JTabbedPane tabbedPane = VerticalTextIcon.createTabbedPane(JTabbedPane.LEFT); tabbedPane.setTabPlacement(JTabbedPane.LEFT); mainPanel.add(tabbedPane, "1, 1, fill, fill"); // getContentPane().add(tabbedPane, "1, 2, fill, fill"); panelStatusBar = new StatusBar(); getContentPane().add(panelStatusBar, BorderLayout.SOUTH); panelMovies = new MoviePanel(); VerticalTextIcon.addTab(tabbedPane, BUNDLE.getString("tmm.movies"), panelMovies); //$NON-NLS-1$ panelMovieSets = new MovieSetPanel(); VerticalTextIcon.addTab(tabbedPane, BUNDLE.getString("tmm.moviesets"), panelMovieSets); //$NON-NLS-1$ panelTvShows = new TvShowPanel(); VerticalTextIcon.addTab(tabbedPane, BUNDLE.getString("tmm.tvshows"), panelTvShows); //$NON-NLS-1$ // shutdown listener - to clean database connections safely addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { closeTmm(); } }); MessageManager.instance.addListener(TmmUIMessageCollector.instance); // mouse event listener for context menu Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() { @Override public void eventDispatched(AWTEvent arg0) { if (arg0 instanceof MouseEvent && MouseEvent.MOUSE_RELEASED == arg0.getID() && arg0.getSource() instanceof JTextComponent) { MouseEvent me = (MouseEvent) arg0; JTextComponent tc = (JTextComponent) arg0.getSource(); if (me.isPopupTrigger() && tc.getComponentPopupMenu() == null) { TextFieldPopupMenu.buildCutCopyPaste().show(tc, me.getX(), me.getY()); } } } }, AWTEvent.MOUSE_EVENT_MASK); // temp info for users using Java 6 if (SystemUtils.IS_JAVA_1_6) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { JOptionPane.showMessageDialog(MainWindow.this, BUNDLE.getString("tmm.java6")); //$NON-NLS-1$ } }); } // inform user is MI could not be loaded if (Platform.isLinux() && StringUtils.isBlank(MediaInfo.version())) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { JOptionPane.showMessageDialog(MainWindow.this, BUNDLE.getString("mediainfo.failed.linux")); //$NON-NLS-1$ } }); } }