private Mode editorMode(Workspace workspace) { Mode ourMode = workspace.findMode(this); if (ourMode == null) { ourMode = workspace.createMode( CloneableEditorSupport.EDITOR_MODE, getName(), CloneableEditorSupport.class.getResource( "/org/openide/resources/editorMode.gif" // NOI18N ) ); } return ourMode; }
public Set getModes() { Set s = new HashSet(); for(Iterator it = new HashSet(workspaces.values()).iterator(); it.hasNext(); ) { Workspace w = (Workspace)it.next(); s.addAll(w.getModes()); } return s; }
public synchronized void setWorkspaces(Workspace[] ws) { if (ws.length == 0) throw new IllegalArgumentException(); workspaces.clear(); for (int i = 0; i < ws.length; i++) { workspaces.put(ws[i].getName(), ws[i]); } if (pcs != null) { pcs.firePropertyChange(PROP_WORKSPACES, null, null); pcs.firePropertyChange(PROP_CURRENT_WORKSPACE, null, null); } }
/** Initializes listeners atc to the given workspace */ void attachWorkspace (Workspace workspace, Workspace[] currentDeskRef, Hashtable workspace2Menu, Hashtable menu2Workspace, Hashtable workspace2Listener, JMenu menu) { // bugfix #6116 - change from getName() to getDisplayName() JRadioButtonMenuItem menuItem = new JRadioButtonMenuItem(); Actions.setMenuText(menuItem, workspace.getDisplayName(), true); HelpCtx.setHelpIDString (menuItem, WorkspaceSwitchAction.class.getName()); ActionListener listener = createActionListener(menuItem, currentDeskRef, menu2Workspace, workspace2Menu); menuItem.addActionListener(listener); menu2Workspace.put(listener, workspace); workspace2Listener.put(workspace, listener); workspace2Menu.put(workspace, menuItem); workspace.addPropertyChangeListener(createNameListener(menuItem)); menu.add(menuItem); }
/** @return Preferred size of editor top component */ @Override public Dimension getPreferredSize() { @SuppressWarnings("deprecation") Rectangle bounds = WindowManager.getDefault().getCurrentWorkspace().getBounds(); return new Dimension(bounds.width / 2, bounds.height / 2); }
/** Dock this top component to editor mode if it is not docked * in some mode at this time */ private void dockIfNeeded(Workspace workspace) { // dock into editor mode if possible Mode ourMode = workspace.findMode(this); if (ourMode == null) { editorMode(workspace).dockInto(this); } }
public void actionPerformed(java.awt.event.ActionEvent evt) { Workspace desk = (Workspace) menu2Workspace.get(this); if (desk == null) return; if (workspace2Menu.get(desk) == null) return; ((JRadioButtonMenuItem)workspace2Menu.get(desk)).setSelected(true); if (desk == currentDeskRef[0]) return; // deactivate old if present if (currentDeskRef[0] != null) { ((JRadioButtonMenuItem)workspace2Menu.get(currentDeskRef[0])). setSelected(false); } currentDeskRef[0] = desk; desk.activate (); } };
/** Initializes listeners atc to the given workspace */ void attachWorkspace (Workspace workspace, Workspace[] currentDeskRef, Hashtable workspace2Menu, Hashtable menu2Workspace, Hashtable workspace2Listener, JMenu menu) { // bugfix #6116 - change from getName() to getDisplayName() JRadioButtonMenuItem menuItem = new JRadioButtonMenuItem(); Actions.setMenuText(menuItem, workspace.getDisplayName(), true); HelpCtx.setHelpIDString (menuItem, WorkspaceSwitchAction.class.getName()); ActionListener listener = createActionListener(menuItem, currentDeskRef, menu2Workspace, workspace2Menu); menuItem.addActionListener(listener); menu2Workspace.put(listener, workspace); workspace2Listener.put(workspace, listener); workspace2Menu.put(workspace, menuItem); workspace.addPropertyChangeListener(createNameListener(menuItem)); menu.add(menuItem); }
/** @return Preferred size of editor top component */ public Dimension getPreferredSize() { Rectangle bounds = WindowManager.getDefault().getCurrentWorkspace().getBounds(); return new Dimension(bounds.width / 2, bounds.height / 2); }
/** Dock this top component to editor mode if it is not docked * in some mode at this time */ private void dockIfNeeded(Workspace workspace) { // dock into editor mode if possible Mode ourMode = workspace.findMode(this); if (ourMode == null) { editorMode(workspace).dockInto(this); } }
public void actionPerformed(java.awt.event.ActionEvent evt) { Workspace desk = (Workspace) menu2Workspace.get(this); if (desk == null) return; if (workspace2Menu.get(desk) == null) return; ((JRadioButtonMenuItem)workspace2Menu.get(desk)).setSelected(true); if (desk == currentDeskRef[0]) return; // deactivate old if present if (currentDeskRef[0] != null) { ((JRadioButtonMenuItem)workspace2Menu.get(currentDeskRef[0])). setSelected(false); } currentDeskRef[0] = desk; desk.activate (); } };
private Mode editorMode(Workspace workspace) { Mode ourMode = workspace.findMode(this); if (ourMode == null) { ourMode = workspace.createMode( CloneableEditorSupport.EDITOR_MODE, getName(), CloneableEditorSupport.class.getResource( "/org/openide/resources/editorMode.gif" // NOI18N ) ); } return ourMode; }
/** @return Preferred size of editor top component */ public Dimension getPreferredSize() { Rectangle bounds = WindowManager.getDefault().getCurrentWorkspace().getBounds(); return new Dimension(bounds.width / 2, bounds.height / 2); }
public synchronized void setWorkspaces(Workspace[] ws) { if (ws.length == 0) throw new IllegalArgumentException(); workspaces.clear(); for (int i = 0; i < ws.length; i++) { workspaces.put(ws[i].getName(), ws[i]); } if (pcs != null) { pcs.firePropertyChange(PROP_WORKSPACES, null, null); pcs.firePropertyChange(PROP_CURRENT_WORKSPACE, null, null); } }
public Set getModes() { Set s = new HashSet(); for(Iterator it = new HashSet(workspaces.values()).iterator(); it.hasNext(); ) { Workspace w = (Workspace)it.next(); s.addAll(w.getModes()); } return s; }
synchronized void delete(Workspace w) { workspaces.remove(w.getName()); if (workspaces.isEmpty()) { createWorkspace("default", null); // NOI18N } if (pcs != null) { pcs.firePropertyChange(PROP_WORKSPACES, null, null); pcs.firePropertyChange(PROP_CURRENT_WORKSPACE, null, null); } }
synchronized void delete(Workspace w) { workspaces.remove(w.getName()); if (workspaces.isEmpty()) { createWorkspace("default", null); // NOI18N } if (pcs != null) { pcs.firePropertyChange(PROP_WORKSPACES, null, null); pcs.firePropertyChange(PROP_CURRENT_WORKSPACE, null, null); } }