2 * Copyright (C) 2008 The Android Open Source Project
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package com.android.hierarchyviewer;
19 import com.android.hierarchyviewer.ui.Workspace;
20 import com.android.hierarchyviewer.device.DeviceBridge;
22 import javax.swing.SwingUtilities;
23 import javax.swing.UIManager;
24 import javax.swing.UnsupportedLookAndFeelException;
26 public class HierarchyViewer {
27 private static final CharSequence OS_WINDOWS = "Windows";
28 private static final CharSequence OS_MACOSX = "Mac OS X";
30 private static void initUserInterface() {
31 System.setProperty("apple.laf.useScreenMenuBar", "true");
32 System.setProperty("apple.awt.brushMetalLook", "true");
33 System.setProperty("com.apple.mrj.application.apple.menu.about.name", "HierarchyViewer");
35 final String os = System.getProperty("os.name");
38 if (os.contains(OS_WINDOWS) || os.contains(OS_MACOSX)) {
39 UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
41 UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
43 } catch (ClassNotFoundException e) {
45 } catch (InstantiationException e) {
47 } catch (IllegalAccessException e) {
49 } catch (UnsupportedLookAndFeelException e) {
54 public static void main(String[] args) {
56 DeviceBridge.initDebugBridge();
58 SwingUtilities.invokeLater(new Runnable() {
60 Workspace workspace = new Workspace();
61 workspace.setDefaultCloseOperation(Workspace.EXIT_ON_CLOSE);
62 workspace.setLocationRelativeTo(null);
63 workspace.setVisible(true);