Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow switching between perspectives in the Integrated IDE #52

Merged
merged 7 commits into from Apr 24, 2017

Conversation

@Mukarr
Copy link
Collaborator

Mukarr commented Aug 14, 2016

A new dialog box was added that allows :

  1. To choose the perspective that you want to use, when Integrated IDE starts.
  2. To switch to other perspective while working with one.
@martinec
Copy link
Member

martinec commented Aug 14, 2016

It would be better to show the "Choose perspective" dialog in the center of the screen and always on top

@martinec
Copy link
Member

martinec commented Aug 14, 2016

For the Classic perspective, It would be better to put the Perspective menu as a sub-menu of Window. This will be more consistent with the Window > Change Perspective menu of the Project-Oriented perspective.

@martinec
Copy link
Member

martinec commented Aug 14, 2016

In the following scenario, the change perspective feature does not work as expected:

What steps will reproduce the problem?

  • Launch GramLab.jar
  • Select the Classic perspective
  • Select English as language
  • Perspective > Change Perspective
  • Select the Project-oriented perspective
  • Window > Change Perspective
  • Select the Classic perspective
  • Select English as language

What is the expected behavior?

The IDE switches from the Project-oriented to the Classic perspective

What do you see instead?

An exception is thrown:

java.lang.ClassCastException: Cannot cast org.gramlab.core.gramlab.frames.GramlabInternalFrameManager to org.gramlab.core.umlv.unitex.frames.UnitexInternalFrameManager
at java.lang.Class.cast(Class.java:3186)
at org.gramlab.core.gramlab.project.GramlabProject.getFrameManagerAs(GramlabProject.java:517)
at org.gramlab.core.umlv.unitex.frames.UnitexFrame$5.languageChanged(UnitexFrame.java:288)
at org.gramlab.core.umlv.unitex.config.Config.fireLanguageChanged(Config.java:1600)
at org.gramlab.core.umlv.unitex.config.Config.setCurrentLanguage(Config.java:1066)
at org.gramlab.core.umlv.unitex.config.Config.chooseInitialLanguage(Config.java:1340)
at org.gramlab.core.umlv.unitex.config.Config.initConfig(Config.java:259)
at org.gramlab.core.Main$4$1$1.run(Main.java:176)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:312)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:745)
at java.awt.EventQueue.access$300(EventQueue.java:103)
at java.awt.EventQueue$3.run(EventQueue.java:706)
at java.awt.EventQueue$3.run(EventQueue.java:704)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:77)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:715)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)

java.lang.ClassCastException: Cannot cast org.gramlab.core.gramlab.frames.GramlabInternalFrameManager to org.gramlab.core.umlv.unitex.frames.UnitexInternalFrameManager
at java.lang.Class.cast(Class.java:3186)
at org.gramlab.core.gramlab.project.GramlabProject.getFrameManagerAs(GramlabProject.java:517)
at org.gramlab.core.umlv.unitex.frames.UnitexFrame$5.languageChanged(UnitexFrame.java:288)
at org.gramlab.core.umlv.unitex.config.Config.fireLanguageChanged(Config.java:1600)
at org.gramlab.core.umlv.unitex.config.Config.setCurrentLanguage(Config.java:1066)
at org.gramlab.core.umlv.unitex.config.Config.chooseInitialLanguage(Config.java:1340)
at org.gramlab.core.umlv.unitex.config.Config.initConfig(Config.java:259)
at org.gramlab.core.Main$4$1$1.run(Main.java:176)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:312)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:745)
at java.awt.EventQueue.access$300(EventQueue.java:103)
at java.awt.EventQueue$3.run(EventQueue.java:706)
at java.awt.EventQueue$3.run(EventQueue.java:704)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:77)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:715)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)
… the Integrated IDE

A new dialog box was added that allows :
1. To choose the perspective that you want to use, when Integrated IDE starts.
2. To switch to other perspective while working with one.
The dialog can be improved by adding a 'Remember me' checkbox, to avoid asking to choose perspective again and again.
@Mukarr Mukarr force-pushed the Mukarr:addswitch branch from 7a60be9 to c45d8e9 Aug 16, 2016
@martinec
Copy link
Member

martinec commented Aug 16, 2016

In the following scenario, the feature does not work as expected:

What steps will reproduce the problem?

  • Launch GramLab.jar
  • Select the Project-oriented perspective
  • Click on New project > Create a project from a Unitex user directory
  • Set Name: Test, Language: English (en), Directory to import: /foo/bar/Unitex-GramLab-3.1/English/
  • Click on Test > src > Graphs > Preprocessing > Sentence > Sentence.grf
  • Select the Open a sup-graph icon from the graph toolbox.
  • Click on the Interjection box

What is the expected behavior?

The IDE open the graph Interjection

What do you see instead?

An exception is thrown:

java.lang.NullPointerException
at org.gramlab.core.umlv.unitex.graphrendering.GraphicalZone$MyMouseListener.customMouseClicked(GraphicalZone.java:1395)
at org.gramlab.core.umlv.unitex.graphrendering.GraphicalZone$MyMouseListener.mouseReleased(GraphicalZone.java:1542)
at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:289)
at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:289)
at java.awt.Component.processMouseEvent(Component.java:6535)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
at java.awt.Component.processEvent(Component.java:6300)
at java.awt.Container.processEvent(Container.java:2236)
at java.awt.Component.dispatchEventImpl(Component.java:4891)
at java.awt.Container.dispatchEventImpl(Container.java:2294)
at java.awt.Component.dispatchEvent(Component.java:4713)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4888)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4525)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4466)
at java.awt.Container.dispatchEventImpl(Container.java:2280)
at java.awt.Window.dispatchEventImpl(Window.java:2750)
at java.awt.Component.dispatchEvent(Component.java:4713)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
at java.awt.EventQueue.access$500(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.awt.EventQueue$3.run(EventQueue.java:703)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
at java.awt.EventQueue$4.run(EventQueue.java:731)
at java.awt.EventQueue$4.run(EventQueue.java:729)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
Mukarr added 2 commits Aug 17, 2016
…ted perspectives"

This reverts commit db8b04e. The approach failed.
…ted perspectives

This commit would save instance of project-manager of particular perspective. This would enable re-switching to a perspective after switching to the other perspective.
center.add(projectOriented);
bg.add(classic);
bg.add(projectOriented);
final JLabel error = new JLabel("You are already using "+currPerspective+" Perspective.");

This comment has been minimized.

Copy link
@martinec

martinec Aug 17, 2016

Member

It would be better to avoid this kind of feedback. What about to disable by default the radio button corresponding to the current active perspective?

JPanel center=new JPanel(new GridLayout(7,7));
center.add(new JLabel(""));
final JRadioButton classic=new JRadioButton("Classic",true);
final JRadioButton projectOriented=new JRadioButton("Project-Oriented",false);

This comment has been minimized.

Copy link
@martinec

martinec Aug 17, 2016

Member

Project-oriented

@@ -1411,7 +1414,7 @@ public void actionPerformed(ActionEvent e) {
menu.add(open);
return menu;
}

JMenu buildWindowsMenu() {
final JMenu windows = new JMenu("Windows");

This comment has been minimized.

Copy link
@martinec

martinec Aug 17, 2016

Member

Window

This comment has been minimized.

Copy link
@Mukarr

Mukarr Aug 17, 2016

Author Collaborator

It was Windows earlier. Should I change it to Window ?



private JMenu createWindowMenu() {
JMenu m = new JMenu("Window");

This comment has been minimized.

Copy link
@martinec

martinec Aug 17, 2016

Member

Use Window > Perspective >Change Perspective

@@ -1497,6 +1505,7 @@ private JMenuBar createMenuBar() {
JMenuBar bar = new JMenuBar();
bar.add(createWorkspaceMenu());
bar.add(createProjectMenu());
bar.add(createWindowMenu());

This comment has been minimized.

Copy link
@martinec

martinec Aug 17, 2016

Member

Put the Window menu just before Help

}

public static GramlabProjectManager getGramlabProjectManager () {
return projectoriented;

This comment has been minimized.

Copy link
@martinec

martinec Aug 17, 2016

Member

projectOriented

}

public static void setGramlabProjectManager (ProjectManager manager) {
GlobalProjectManager.projectoriented = (GramlabProjectManager) manager;

This comment has been minimized.

Copy link
@martinec

martinec Aug 17, 2016

Member

projectOriented

private static ProjectManager projectManager;

private static ProjectManager classic;
private static GramlabProjectManager projectoriented;

This comment has been minimized.

Copy link
@martinec

martinec Aug 17, 2016

Member

projectOriented

System.err
.println("Your version of Java does not contain all the classes required by GramLab.\nProgram Terminated");
.println("Your version of Java does not contain all the classes required by Unitex.\nProgram Terminated");

This comment has been minimized.

Copy link
@martinec

martinec Aug 17, 2016

Member

by GramLab

@martinec
Copy link
Member

martinec commented Aug 17, 2016

In the following scenario, the feature does not work as expected:

What steps will reproduce the problem?

  • Launch GramLab.jar (The splash screen is displayed)
  • Select the Classic perspective (The splash screen is displayed again)

What is the expected behavior?

The splash screen is displayed once.

What do you see instead?

The splash screen is displayed twice.

@martinec
Copy link
Member

martinec commented Aug 17, 2016

In the following scenario, the feature does not work as expected:

What steps will reproduce the problem?

  • Launch GramLab.jar
  • Select the Classic perspective
  • Select English as language
  • Click on FSGraph > Open > Preprocessing > Sentence > Sentence.grf
  • Click on Window > Perspective > Change Perspective
  • Select the Project-oriented perspective
  • Click on Window > Change Perspective
  • Select the Classic perspective
  • Select the Graphs that call this one icon from the Sentence.grf graph toolbox

What is the expected behavior?

The panel containing the list of graphs that call Sentence.grfis show

What do you see instead?

An exception is thrown:

java.lang.ClassCastException: Cannot cast org.gramlab.core.umlv.unitex.project.manager.UnitexProjectManager to org.gramlab.core.gramlab.project.GramlabProjectManager
at java.lang.Class.cast(Class.java:3369)
at org.gramlab.core.umlv.unitex.common.project.manager.GlobalProjectManager.getAs(GlobalProjectManager.java:64)
at org.gramlab.core.gramlab.project.config.ProjectPreferences.getCurrentLanguageDir(ProjectPreferences.java:297)
at org.gramlab.core.umlv.unitex.frames.GraphFrame.showGraphDependencies(GraphFrame.java:947)
at org.gramlab.core.umlv.unitex.frames.GraphFrame$31.actionPerformed(GraphFrame.java:777)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)
at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:289)
at java.awt.Component.processMouseEvent(Component.java:6535)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
at java.awt.Component.processEvent(Component.java:6300)
at java.awt.Container.processEvent(Container.java:2236)
at java.awt.Component.dispatchEventImpl(Component.java:4891)
at java.awt.Container.dispatchEventImpl(Container.java:2294)
at java.awt.Component.dispatchEvent(Component.java:4713)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4888)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4525)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4466)
at java.awt.Container.dispatchEventImpl(Container.java:2280)
at java.awt.Window.dispatchEventImpl(Window.java:2750)
at java.awt.Component.dispatchEvent(Component.java:4713)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
at java.awt.EventQueue.access$500(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.awt.EventQueue$3.run(EventQueue.java:703)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
at java.awt.EventQueue$4.run(EventQueue.java:731)
at java.awt.EventQueue$4.run(EventQueue.java:729)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
@Mukarr
Copy link
Collaborator Author

Mukarr commented Aug 20, 2016

@aleksandrachasch The above mentioned scenario always throws an exception, even in the current version of gramlab-ide. You can also check with master branch.
Since you are trying to open a file that is not present in the current project's workspace, it throws an exception.
I think a separate issue should be opened for this, as this is not pertaining to this PR.

@aleksandrachasch
Copy link
Collaborator

aleksandrachasch commented Aug 20, 2016

To my mind, it would be more convenient if the buttons cancel and OK in Select perspective frame are switched, as usually the OK button is situated on the left, while Cancel is situated on the right.

@martinec
Copy link
Member

martinec commented Aug 22, 2016

In the following scenario, the feature does not work as expected:

What steps will reproduce the problem?

  • Launch GramLab.jar
  • Select the Project-oriented perspective
  • Click on New project > Create a project from a Unitex user directory
  • Set Name: Test, Language: English (en), Directory to import: /foo/bar/Unitex-GramLab-3.1/English/
  • Click on Test > src > Graphs > Preprocessing > Sentence > Sentence.grf
  • Select the Remove a box icon from the graph toolbox.

What is the expected behavior?

The cursor is set to the icon of the Remove a box tool

gramlab-graph-toolbox

What do you see instead?

The cursor is not set to the icon of the Remove a box tool

gramlab-graph-toolbox_no_icon

@martinec martinec changed the title Allow switching between perspectives(Classic and Project-oriented) in the Integrated IDE Allow switching between perspectives in the Integrated IDE Feb 20, 2017
@martinec
Copy link
Member

martinec commented Apr 24, 2017

LGTM. I’m merging this pull request but there is still a minor issue to fix concerning mouse icons. @Mukarr would you mind to take a look? Thank you

@martinec martinec merged commit cafc576 into UnitexGramLab:feature/plugins Apr 24, 2017
2 checks passed
2 checks passed
code-review/pullapprove Approved by aleksandrachasch
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.