本文整理汇总了Java中org.openide.windows.TopComponent.isOpened方法的典型用法代码示例。如果您正苦于以下问题:Java TopComponent.isOpened方法的具体用法?Java TopComponent.isOpened怎么用?Java TopComponent.isOpened使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.openide.windows.TopComponent
的用法示例。
在下文中一共展示了TopComponent.isOpened方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: willCloseNotify
import org.openide.windows.TopComponent; //导入方法依赖的package包/类
@Override
public void willCloseNotify(List<ComponentInfo> components) {
for (ComponentInfo ci : components) {
Component c = ci.getComponent();
if (c instanceof TopComponent) {
TopComponent tc = (TopComponent) c;
boolean isOpened = tc.isOpened();
String tcId = WindowManager.getDefault().findTopComponentID(tc);
Properties.getDefault().getProperties(PROPERTY_BASE_NAME).
getProperties(PROPERTY_CLOSED_TC).setBoolean(tcId, !isOpened);
boolean isMinimized = WindowManager.getDefault().isTopComponentMinimized(tc);
Properties.getDefault().getProperties(PROPERTY_BASE_NAME).
getProperties(PROPERTY_MINIMIZED_TC).setBoolean(tcId, isMinimized);
}
}
}
示例2: addModeOpenedTopComponent
import org.openide.windows.TopComponent; //导入方法依赖的package包/类
/** Adds opened TopComponent into model and requests view (if needed). */
public void addModeOpenedTopComponent(ModeImpl mode, TopComponent tc) {
boolean wasOpened = tc.isOpened();
if(getModeOpenedTopComponents(mode).contains(tc)) {
return;
}
// Validate the TopComponent was removed from other modes.
removeTopComponentFromOtherModes(mode, tc);
model.addModeOpenedTopComponent(mode, tc);
if(isVisible()) {
viewRequestor.scheduleRequest(
new ViewRequest(mode, View.CHANGE_MODE_TOPCOMPONENT_ADDED,
null, tc));
}
if( !wasOpened ) { //make sure componentOpened() is called just once
// Notify opened.
WindowManagerImpl.getInstance().notifyTopComponentOpened(tc);
}
}
示例3: insertModeOpenedTopComponent
import org.openide.windows.TopComponent; //导入方法依赖的package包/类
public void insertModeOpenedTopComponent(ModeImpl mode, TopComponent tc, int index) {
boolean wasOpened = tc.isOpened();
List openedTcs = getModeOpenedTopComponents(mode);
if(index >= 0 && !openedTcs.isEmpty()
&& openedTcs.size() > index && openedTcs.get(index) == tc) {
return;
}
// Validate the TopComponent was removed from other modes.
removeTopComponentFromOtherModes(mode, tc);
model.insertModeOpenedTopComponent(mode, tc, index);
if(isVisible()) {
viewRequestor.scheduleRequest(
new ViewRequest(mode, View.CHANGE_MODE_TOPCOMPONENT_ADDED, // PENDING inserted?
null, tc));
}
if( !wasOpened ) { //make sure componentOpened() is called just once
// #102258: Notify opened when opened through openAtTabPosition as well
WindowManagerImpl.getInstance().notifyTopComponentOpened(tc);
}
}
示例4: setTopComponentMinimized
import org.openide.windows.TopComponent; //导入方法依赖的package包/类
void setTopComponentMinimized( TopComponent tc, boolean minimized ) {
if( !tc.isOpened() ) {
return;
}
if( isTopComponentMinimized( tc ) == minimized ) {
return; //nothing todo
}
ModeImpl mode = ( ModeImpl ) WindowManagerImpl.getInstance().findMode( tc );
if( null == mode || mode.getState() != Constants.MODE_STATE_JOINED ) {
return;
}
if( minimized ) {
slide( tc, mode, guessSlideSide( tc ) );
} else {
unSlide( tc, mode );
}
//#207438 - make sure global minimize/dock actions get updated
WindowManagerImpl.getInstance().doFirePropertyChange(
WindowManager.PROP_MODES, null, null);
}
示例5: getTopComponents
import org.openide.windows.TopComponent; //导入方法依赖的package包/类
/** Used to get array for view and for persistence */
public TopComponent [] getTopComponents() {
List<TopComponent> tcList = new ArrayList<TopComponent>(tcIdList.size());
WindowManager wm = WindowManager.getDefault();
for (int i = 0; i < tcIdList.size(); i++) {
String tcId = tcIdList.get( i );
TopComponent tc = null;
Reference<TopComponent> ref = tcCache.get( tcId );
if( null != ref ) {
tc = ref.get();
}
if( null == tc ) {
tc = wm.findTopComponent( tcId );
if( null != tc )
tcCache.put( tcId, new WeakReference<TopComponent>( tc ) );
}
if ((tc != null) && tc.isOpened()) {
tcList.add(tc);
}
}
return tcList.toArray(new TopComponent[tcList.size()]);
}
示例6: dockIntoImpl
import org.openide.windows.TopComponent; //导入方法依赖的package包/类
/** Actually performs the docking operation.
* @param tc top component to dock into this mode
* @param orderWeight weight for ordering. Smaller weight number means
* smaller position index, which means closer to the top or start in
* visual representations
* @param select <code>true</code> if the docked <code>TopComponent</code>
* will be selected afterwards
* @return true if top component was succesfully docked to this */
private boolean dockIntoImpl(final TopComponent tc, final boolean select) {
if(DEBUG) {
Debug.log(ModeImpl.class, "Docking tc=" + tc.getName() + " into mode=" + this); // NOI18N
Debug.dumpStack(ModeImpl.class);
}
boolean opened = false;
// PENDING
// Preferably all in one step.
ModeImpl mode = (ModeImpl)WindowManagerImpl.getInstance().findMode(tc);
if(mode != null && mode != this) {
// XXX if only closin (mode.close(tc)) there could happen,
// there is the same TopComponent as closed in two modes. Revise.
opened = tc.isOpened();
mode.removeTopComponent(tc);
}
if( opened ) {
//don't close the TopComponent if it was opened in the previous mode
addOpenedTopComponent( tc );
} else {
addClosedTopComponent(tc);
}
return true;
}
示例7: closing
import org.openide.windows.TopComponent; //导入方法依赖的package包/类
static void closing(List<ComponentInfo> components) {
for (ComponentInfo ci : components) {
Component c = ci.getComponent();
if (c instanceof TopComponent) {
TopComponent tc = (TopComponent) c;
/* To check which components we're closing:
try {
Method pid = TopComponent.class.getDeclaredMethod("preferredID");
pid.setAccessible(true);
System.err.println("ComponentInfoFromBeanContext.closing("+pid.invoke(tc)+")");
} catch (Exception ex) {
ex.printStackTrace();
}*/
boolean isOpened = tc.isOpened();
Properties.getDefault().getProperties(DebuggerManagerListener.class.getName()).
getProperties(PROPERTY_CLOSED_TC).setBoolean(tc.getName(), !isOpened);
boolean isMinimized = WindowManager.getDefault().isTopComponentMinimized(tc);
Properties.getDefault().getProperties(DebuggerManagerListener.class.getName()).
getProperties(PROPERTY_MINIMIZED_TC).setBoolean(tc.getName(), isMinimized);
}
}
}
示例8: getCurrentlyOpenedFiles
import org.openide.windows.TopComponent; //导入方法依赖的package包/类
/**
*
* @return all the currenlty opened FileObjects
*/
private Collection<FileObject> getCurrentlyOpenedFiles() {
LinkedHashSet<FileObject> result = new LinkedHashSet<FileObject>();
for (TopComponent tc : TopComponent.getRegistry().getOpened()) {
DataObject dob = tc.getLookup().lookup(DataObject.class);
if (tc.isOpened() && dob != null && isFromEditorWindow(dob, tc)) {
FileObject primaryFile = dob.getPrimaryFile();
if (primaryFile != null) {
result.add(primaryFile);
}
}
}
return result;
}
示例9: componentShowing
import org.openide.windows.TopComponent; //导入方法依赖的package包/类
@Override
protected void componentShowing() {
super.componentShowing();
TopComponent properties = WindowManager.getDefault().findTopComponent("properties"); // NOI18N
if (properties != null) {
if (!properties.isOpened()) {
propertiesOpened = true;
properties.open();
}
}
}
示例10: showPalette
import org.openide.windows.TopComponent; //导入方法依赖的package包/类
static void showPalette() {
WindowManager wm = WindowManager.getDefault();
TopComponent palette = wm.findTopComponent("CommonPalette"); // NOI18N
if (null == palette) {
Logger.getLogger(PaletteSwitch.class.getName()).log(Level.INFO, "Cannot find CommonPalette component."); // NOI18N
//for unit-testing
palette = getDefault();
}
if (!palette.isOpened()) {
palette.open();
}
}
示例11: isTopComponentPersistent
import org.openide.windows.TopComponent; //导入方法依赖的package包/类
/** Tests if given top component with specified stringId is persistent.
* This method is used for saving of TopComponent.
* @param tc top component in question
* @return true if component is persistent (which is by default), false
* otherwise - top component's property exists saying "don't make me persistent"
*/
public boolean isTopComponentPersistent (TopComponent tc) {
int persistenceType = persistenceType(tc);
if ((TopComponent.PERSISTENCE_NEVER == persistenceType)
|| ((TopComponent.PERSISTENCE_ONLY_OPENED == persistenceType) && !tc.isOpened())) {
return false;
}
return true;
}
示例12: loadAllNow
import org.openide.windows.TopComponent; //导入方法依赖的package包/类
void loadAllNow() {
isActive = false;
isLoading = true;
PersistenceHandler persistenceHandler = PersistenceHandler.getDefault();
for( LazyMode lazyMode : lazyModes.values() ) {
for( String tcId : lazyMode.getTopComponents() ) {
TopComponent tc = persistenceHandler.getTopComponentForID( tcId, true );
if( null != tc && !tc.isOpened() ) {
lazyMode.mode.addOpenedTopComponent( tc, lazyMode.getPosition( tcId ) );
}
}
}
lazyModes.clear();
}
示例13: loadNow
import org.openide.windows.TopComponent; //导入方法依赖的package包/类
private void loadNow( ModeImpl mode, String tcId, int position ) {
if( !isActive )
return;
TopComponent tc = PersistenceHandler.getDefault().getTopComponentForID( tcId, true );
if( null != tc && !tc.isOpened() ) {
if( position < 0 )
position = mode.getOpenedTopComponentsIDs().size();
mode.addOpenedTopComponent( tc, position );
}
remove( mode, tcId );
}
示例14: isTopComponentMinimized
import org.openide.windows.TopComponent; //导入方法依赖的package包/类
boolean isTopComponentMinimized( TopComponent tc ) {
if( !tc.isOpened() ) {
return false;
}
ModeImpl mode = ( ModeImpl ) WindowManagerImpl.getInstance().findMode( tc );
return null != mode && mode.getKind() == Constants.MODE_KIND_SLIDING;
}
示例15: openWatchesView
import org.openide.windows.TopComponent; //导入方法依赖的package包/类
private static void openWatchesView() {
// open watches view
TopComponent watchesView = WindowManager.getDefault().findTopComponent("watchesView"); // NOI18N
if (watchesView != null && watchesView.isOpened()) {
Mode mw = WindowManager.getDefault().findMode(watchesView);
if (mw != null && mw.getSelectedTopComponent() == watchesView) {
return ; // Watches is already selected
}
}
String viewName = VariablesViewButtons.isWatchesViewNested() ? "localsView" : "watchesView";
ViewActions.openComponent (viewName, false).requestVisible();
}