|
Lines 1-37
Link Here
|
| 1 |
/******************************************************************************* |
1 |
/******************************************************************************* |
| 2 |
* Copyright (c) 2008 The Eclipse Foundation and others |
2 |
* Copyright (c) 2008 The Eclipse Foundation and others |
| 3 |
* All rights reserved. This program and the accompanying materials |
3 |
* All rights reserved. This program and the accompanying materials |
| 4 |
* are made available under the terms of the Eclipse Public License v1.0 |
4 |
* are made available under the terms of the Eclipse Public License v1.0 |
| 5 |
* which accompanies this distribution, and is available at |
5 |
* which accompanies this distribution, and is available at |
| 6 |
* http://www.eclipse.org/legal/epl-v10.html |
6 |
* http://www.eclipse.org/legal/epl-v10.html |
| 7 |
* |
7 |
* |
| 8 |
* Contributors: |
8 |
* Contributors: |
| 9 |
* Eclipse Foundation - initial API and implementation |
9 |
* Eclipse Foundation - initial API and implementation |
| 10 |
*******************************************************************************/ |
10 |
*******************************************************************************/ |
| 11 |
package org.eclipse.ide4edu.javalite.infrastructure; |
11 |
package org.eclipse.ide4edu.javalite.infrastructure; |
| 12 |
|
12 |
|
| 13 |
import org.eclipse.ide4edu.javalite.ui.view.LitePackageExplorer; |
13 |
import java.io.IOException; |
| 14 |
import org.eclipse.ui.IFolderLayout; |
14 |
|
| 15 |
import org.eclipse.ui.IPageLayout; |
15 |
import org.eclipse.ide4edu.javalite.ui.view.LitePackageExplorer; |
| 16 |
import org.eclipse.ui.IPerspectiveFactory; |
16 |
import org.eclipse.ui.IFolderLayout; |
| 17 |
|
17 |
import org.eclipse.ui.IPageLayout; |
| 18 |
|
18 |
import org.eclipse.ui.IPerspectiveFactory; |
| 19 |
public class JavaLitePerspective implements IPerspectiveFactory { |
19 |
import org.eclipse.ui.editors.text.EditorsUI; |
| 20 |
|
20 |
import org.eclipse.ui.preferences.ScopedPreferenceStore; |
| 21 |
public void createInitialLayout(IPageLayout layout){ |
21 |
|
| 22 |
String editorArea = layout.getEditorArea(); |
22 |
|
| 23 |
|
23 |
public class JavaLitePerspective implements IPerspectiveFactory { |
| 24 |
//Create folder layout (left to editor) to hold views |
24 |
|
| 25 |
IFolderLayout leftFolder = layout.createFolder("leftFolder",IPageLayout.LEFT, (float) 0.20, editorArea); |
25 |
public void createInitialLayout(IPageLayout layout){ |
| 26 |
leftFolder.addView(LitePackageExplorer.ID); |
26 |
String editorArea = layout.getEditorArea(); |
| 27 |
|
27 |
|
| 28 |
IFolderLayout bottomFolder = layout.createFolder("bottomFolder",IPageLayout.BOTTOM, (float) 0.80, editorArea); |
28 |
//Create folder layout (left to editor) to hold views |
| 29 |
bottomFolder.addView("org.eclipse.ui.console.ConsoleView"); |
29 |
IFolderLayout leftFolder = layout.createFolder("leftFolder",IPageLayout.LEFT, (float) 0.20, editorArea); |
| 30 |
|
30 |
leftFolder.addView(LitePackageExplorer.ID); |
| 31 |
//layout.setEditorAreaVisible(false); |
31 |
|
| 32 |
layout.addNewWizardShortcut("org.eclipse.ide4edu.javalite.ui.LiteProjectCreationWizard"); |
32 |
IFolderLayout bottomFolder = layout.createFolder("bottomFolder",IPageLayout.BOTTOM, (float) 0.80, editorArea); |
| 33 |
layout.addNewWizardShortcut("org.eclipse.ide4edu.javalite.ui.LitePackageCreationWizard"); |
33 |
bottomFolder.addView("org.eclipse.ui.console.ConsoleView"); |
| 34 |
layout.addNewWizardShortcut("org.eclipse.ide4edu.javalite.ui.LiteClassCreationWizard"); |
34 |
|
| 35 |
} |
35 |
//layout.setEditorAreaVisible(false); |
| 36 |
|
36 |
layout.addNewWizardShortcut("org.eclipse.ide4edu.javalite.ui.LiteProjectCreationWizard"); |
| 37 |
} |
37 |
layout.addNewWizardShortcut("org.eclipse.ide4edu.javalite.ui.LitePackageCreationWizard"); |
|
|
38 |
layout.addNewWizardShortcut("org.eclipse.ide4edu.javalite.ui.LiteClassCreationWizard"); |
| 39 |
|
| 40 |
// get the preference store of the plug-in |
| 41 |
ScopedPreferenceStore prefs = (ScopedPreferenceStore) EditorsUI.getPreferenceStore(); |
| 42 |
|
| 43 |
// Check if this is the first time the JavaLitePerspective is being opened |
| 44 |
if (!prefs.contains("initial")) { |
| 45 |
// Mark that the JavaLitePerspective has been opened for the first time |
| 46 |
prefs.putValue("initial", "opened"); |
| 47 |
// display the line number ruler by default |
| 48 |
prefs.setValue("lineNumberRuler", true); |
| 49 |
|
| 50 |
try { |
| 51 |
// save the preferences |
| 52 |
prefs.save(); |
| 53 |
} catch (IOException e) { |
| 54 |
e.printStackTrace(); |
| 55 |
} |
| 56 |
} |
| 57 |
} |
| 58 |
} |